Re: Hypothetical synonyms

2002-08-29 Thread Markus Laire

This really belongs to perl6-internals and not perl6-language.

On 28 Aug 2002 at 17:19, Sean O'Rourke wrote:

> On Thu, 29 Aug 2002, Markus Laire wrote:
> > (only 32bit numbers, modulo not fully working, no capturing regexps,
> > )
> 
> Where does modulo break?

Modulo is currently defined for Perlint (and only with integers) and 
not for Perlnum. So once a scalar contains a fractional number, 
modulo doesn't work anymore.

Currently I don't have enough knowledge of parrot or perl6 source to 
submit any patches, but maybe in future.

-- 
Markus Laire 'malaire' <[EMAIL PROTECTED]>





Re: [PRE-RELEASE] Parrot 0.0.8

2002-08-29 Thread Markus Laire

> Codename Octarine
> 
> Schedule as follows:
> 
> August 29, 8am EDT: Code slush, only bug and warning fixes allowed.
> August 30, 11:59pm EDT: Code freeze and pretag
> August 31, 00:59 EDT: Tag and Release

Is there any reason to not to use GMT times in general? I have hard 
time remembering all the different TLAs for timezones.

-- 
Markus Laire 'malaire' <[EMAIL PROTECTED]>





[perl #16838] [PATCH] oops ops

2002-08-29 Thread via RT

# New Ticket Created by  Leopold Toetsch 
# Please include the string:  [perl #16838]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16838 >


Hi,

during hacking on imcc and testing with life.p6 I found wrong core.ops 
of type:

inline op  (out PMC, out PMC, out PMC)

add is ok, broken are mul, div, mod, sub, concat.

Attached patch + make && make shared helps.
Please apply.

TIA,
leo

PS: imcc uses the IN/OUT/INOUT information for life analysis of symbols. 
With improved register allocation above bugs emerged.

PPS: all tests still pass.


-- attachment  1 --
url: http://rt.perl.org/rt2/attach/35992/29114/74a267/core.ops.diff



--- core.opsFri Aug 23 20:10:40 2002
+++ /home/lt/src/parrot-007/core.opsThu Aug 29 12:24:40 2002
@@ -1492,7 +1492,7 @@
   goto NEXT();
 }
 
-inline op div (out PMC, out PMC, out PMC) {
+inline op div (out PMC, in PMC, in PMC) {
   $2->vtable->divide(interpreter, $2, $3, $1);
   goto NEXT();
 }
@@ -1591,7 +1591,7 @@
   goto NEXT();
 }
 
-inline op mod (out PMC, out PMC, out PMC) {
+inline op mod (out PMC, in PMC, in PMC) {
   $2->vtable->modulus(interpreter, $2, $3, $1);
   goto NEXT();
 }
@@ -1665,7 +1665,7 @@
   goto NEXT();
 }
 
-inline op mul (inout PMC, out PMC) {
+inline op mul (inout PMC, in PMC) {
   $1->vtable->multiply(interpreter, $1, $2, $1);
   goto NEXT();
 }
@@ -1680,7 +1680,7 @@
   goto NEXT();
 }
 
-inline op mul (out PMC, out PMC, out PMC) {
+inline op mul (out PMC, in PMC, in PMC) {
   $2->vtable->multiply(interpreter, $2, $3, $1);
   goto NEXT();
 }
@@ -1829,7 +1829,7 @@
   goto NEXT();
 }
 
-inline op sub (out PMC, out PMC, out PMC) {
+inline op sub (out PMC, in PMC, in PMC) {
   $2->vtable->subtract(interpreter, $2, $3, $1);
   goto NEXT();
 }
@@ -1898,7 +1898,7 @@
   goto NEXT();
 }
 
-inline op concat (out PMC, out PMC, out PMC) {
+inline op concat (out PMC, in PMC, in PMC) {
   $2->vtable->concatenate(interpreter, $2, $3, $1);
   goto NEXT();
 }



[perl #16839] MANIFEST (again)

2002-08-29 Thread Jürgen

# New Ticket Created by  Jürgen Bömmels 
# Please include the string:  [perl #16839]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16839 >


Hi!

This MANIFEST things come up again and again. This time there are 5
missing files from 2 contributers. 

There really need some automatic testing on this. There is already a
manicheck.pl in tools/dev, but the user has to run in manually. Ok
stop whining, just do it. Here is a "make test" test which will
compare the MANIFEST with the CVS/Entries files, a diffrence between
these are reported as failure.
Uncommitted cvs add/remove are recognised, so a make test just before
the commit should complete with no error.
tarballs without CVS-directories will skip the CVS/Entries parsing.

The icu/ directory is skipped and ignored.

I named this test manifest.t in t/src but don't have a strong opinion
on this. Put it were you like, but remember to update the MANIFEST :-)



-- attachment  1 --
url: http://rt.perl.org/rt2/attach/35994/29117/8c8c3b/manifest.t

-- attachment  2 --
url: http://rt.perl.org/rt2/attach/35994/29118/7c7c8f/manifest.diff



#! perl -w

use Test::More tests => 4;

use File::Find qw(find);
use ExtUtils::Manifest;

my $ignore_re = qr,(?: ^ icu/ )
  |(?:   \.cvsignore $ ),x;

ok (-e $ExtUtils::Manifest::MANIFEST, 'MANIFEST exists');

$ExtUtils::Manifest::Quiet = 1;
ok (!ExtUtils::Manifest::manicheck (), 'manicheck ()');

sub scan_cvs;
sub list_diff (\@\@);
sub read_manifest;

SKIP: {
  skip ('No CVS version', 1) unless -e 'CVS';

  local @cvs_entries;
  find { wanted => \&scan_cvs }, '.';

  @cvs_entries = grep { s,^./,, && !m/$ignore_re/ } @cvs_entries;

  my @manifest = sort keys %{ExtUtils::Manifest::maniread()};

  my ($cvs_miss, $mani_miss);

  ($cvs_miss, $mani_miss) = list_diff @cvs_entries, @manifest;

  local $" = "\n\t";

  ok (!@$cvs_miss, 'all files in MANIFEST are in CVS')
or diag ("Missing files in CVS:\n\t@$cvs_miss");

  ok (!@$mani_miss, 'all files in CVS are in MANIFEST')
or diag ("Missing files in Manifest:\n\t@$mani_miss");
}

sub scan_cvs {
  my $file = $_;

  if ( $file eq 'CVS') {
local *CVS;

open CVS, 'CVS/Entries';

while () {
  chop; 
  next if m/^D/; # directories are will be further scanned

  my (undef, $entry, $rev) = split '/';
  push @cvs_entries, "$File::Find::dir/$entry" if $rev !~ m/^-/;
}

close CVS;

$File::Find::prune = 1;
  }
}

sub list_diff (\@\@) {
  my ($a, $b) = @_;

  my %elem;
  grep { $elem{$_}++ } @$a;
  grep { $elem{$_}-- } @$b;

  return ( [ sort grep { $elem{$_} < 0 } keys %elem ],
   [ sort grep { $elem{$_} > 0 } keys %elem ] );
}



Index: MANIFEST
===
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.205
diff -u -r1.205 MANIFEST
--- MANIFEST	27 Aug 2002 05:31:39 -	1.205
+++ MANIFEST	29 Aug 2002 09:31:18 -
@@ -58,6 +58,8 @@
 config/gen/config_h/config_h.in
 config/gen/config_pm.pl
 config/gen/config_pm/Config_pm.in
+config/gen/libparrot_def.pl
+config/gen/libparrot_def/libparrot_def.in
 config/gen/makefiles.pl
 config/gen/makefiles/classes.in
 config/gen/makefiles/docs.in
@@ -67,6 +69,7 @@
 config/gen/makefiles/perl6.in
 config/gen/makefiles/root.in
 config/gen/makefiles/scheme.in
+config/gen/makefiles/imcc.in
 config/gen/platform.pl
 config/gen/platform/ansi.c
 config/gen/platform/ansi.h
@@ -377,6 +380,7 @@
 languages/perl6/examples/mandel.p6
 languages/perl6/examples/qsort.p6
 languages/perl6/mkdistro.sh
+languages/perl6/overview.pod
 languages/perl6/pconfig.pl
 languages/perl6/perl6
 languages/perl6/perl6re/Perl6RE.bnf
@@ -433,6 +437,7 @@
 languages/perl6/t/parser/speed_3.exp
 languages/perl6/t/parser/speed_3.pl
 languages/perl6/t/rx/basic.t
+languages/perl6/t/rx/call.t
 languages/perl6/t/rx/special.t
 languages/python/python.bnf
 languages/python/python.prd
@@ -584,6 +589,7 @@
 t/pmc/pmc.t
 t/pmc/sub.t
 t/src/basic.t
+t/src/manifest.t
 test_main.c
 tools/dev/check_source_standards.pl
 tools/dev/lib_deps.pl
Index: MANIFEST.SKIP
===
RCS file: /cvs/public/parrot/MANIFEST.SKIP,v
retrieving revision 1.5
diff -u -r1.5 MANIFEST.SKIP
--- MANIFEST.SKIP	12 Jun 2002 22:12:15 -	1.5
+++ MANIFEST.SKIP	29 Aug 2002 09:31:18 -
@@ -19,6 +19,7 @@
 
 ^core_ops\.c$
 ^core_ops_prederef\.c$
+^core_ops_cg\.c$
 
 ^lib/Parrot/Jit\.pm$
 ^lib/Parrot/PMC\.pm$
@@ -33,4 +34,9 @@
 
 ^parrot$
 ^pdump$
+^pdb$
 ^blib/
+
+^icu/
+
+^t/.*/.*_\d+\.



Re: Does ::: constrain the pattern engine implementation?

2002-08-29 Thread Jerome Vouillon

On Wed, Aug 28, 2002 at 10:36:54AM -0700, Larry Wall wrote:
> That is a worthy consideration, but expressiveness takes precedence
> over it in this case.  DFAs are really only good for telling you
> *whether* and *where* a pattern matches as a whole.  They are
> relatively useless for telling you *how* a pattern matches.

Actually, DFAs can also tell you *how* a pattern matches matches.  For
instance the RE library (http://www.sourceforge.net/projects/libre/)
is DFA-based and support a lot of Perl 5 regular expression features:
- submatches
- left-most matching semantics
- greedy and non-greedy operators (*, *?, ?, ??)
- zero-length assertions such as ^, $, \b.

I don't know how to implement back-references and embedded Perl code
using a DFA.  Look-ahead and look-behind assertion can probably be
implemented, though this looks tricky.  But, these features are not
used that often.  So, I believe than most "real-life" Perl 5 regular
expressions can be handled by a DFA.

> Add to that the fact that most real-life patterns don't generally do
> much backtracking, because they're written to succeed, not to fail.
> This pattern never backtracks, for instance:
> 
> my ($num) = /^Items: (\d+)/;

Another advantage of DFAs over NFAs is that the core of a DFA-based
pattern matching implementation is a small simple loop which is
executed very efficiently by modern CPUs.  On the other hand, the core
of a NFA-based implementation is much larger and much more complex,
and I'm not sure it is executed as efficiently.  In particular, there
is probably a lot more branch mispredictions.

As an example of what performance improvement one can sometimes
achieve using a DFA-based rather than a NFA-based implementation,
here are the results I get on my computer for the regular expression
benchmark from the "Great Computer Language Shootout".
(http://www.bagley.org/~doug/shootout/bench/regexmatch/)

Perl 5  3.49s
OCaml with PCRE (NFA-based) 3.17s
OCaml with RE (DFA-based)   0.34s

-- Jerome



backtracking into { code }

2002-08-29 Thread Ken Fox

A question: Do rules matched in a { code } block set backtrack points for
the outer rule? For example, are these rules equivalent?

  rule expr1 {
 { /@operators/ or fail } 
  }

  rule expr2 {
 @operators 
  }

And a comment: It would be nice to have procedural control over back-
tracking so that { code } can fail, succeed (not fail), or succeed and
commit. Right now we can follow { code } with ::, :::, etc. but that does
not allow much control. I'm a little afraid of what happens in an LL(Inf)
grammar if backtracking states aren't aggressively pruned.

- Ken



Re: Hypothetical synonyms

2002-08-29 Thread Luke Palmer

> The ° character doesn't have any special meaning,
> that's why I choosed it in the above example.
> However, it also symbolizes a little capturing
> and as it isn't filled,
> it could really symbolize an uncapturing.

Interesting idea.  I'm not sure if I agree with it yet.  However, I don't 
agree with your syntax, as I can't type that character.  Is it possible to 
modify what was captured?

/" ([ \\ . { chop; chop } | <[^\\]> ]*?) "/

Or is that just too ugly?

Luke




Re: backtracking into { code }

2002-08-29 Thread Aaron Sherman

On Thu, 2002-08-29 at 08:05, Ken Fox wrote:
> A question: Do rules matched in a { code } block set backtrack points for
> the outer rule? For example, are these rules equivalent?
> 
>   rule expr1 {
>  { /@operators/ or fail } 
>   }
> 
>   rule expr2 {
>  @operators 
>   }
> 
> And a comment: It would be nice to have procedural control over back-
> tracking so that { code } can fail, succeed (not fail), or succeed and
> commit. Right now we can follow { code } with ::, :::, etc. but that does
> not allow much control. I'm a little afraid of what happens in an LL(Inf)
> grammar if backtracking states aren't aggressively pruned.

Well, if /.../ is returning a result object (Let's say
CORE::RX::Result), then I would imagine it's an easy enough thing to let
you create your own, or return the one from a rule that you invoke.
e.g.:

rule {  { /@operators/.commit(1) or fail }  }

The hypothetical commit() method being one that would take a number and
modify the result object so that it commits as if you had used that many
colons.

{} inside a rule would, I imagine be implemented like so:

sub rxbraces ($code) {
my $stat = $code();
if $stat.isa(CORE::RX::Result) {
return $stat;
} else {
my $r is CORE::RX::Result;
$r.success($stat); # Boolean status-setting method
return $r;
}
}

Or the moral equiv In other words, it should be able to return a
result of your choosing.

Sorry if I've missed some of the design. My Perl 6 pseudo-code may not
be legal.





Re: backtracking into { code }

2002-08-29 Thread Ken Fox

Aaron Sherman wrote:
> rule {  { /@operators/.commit(1) or fail }  }
> 
> The hypothetical commit() method being one that would take a number and

That would only be useful if the outer rule can backtrack into the
inner /@operators/ rule. Can it?

I agree with you that a commit method would be useful -- especially when
used on $self. I'd probably write your example as:

  rule {  { m/@operators { $self.commit(1) }/ or fail }  }

which is of course just a complicated

  rule {  { m/@operators :/ or fail }  }

BTW, why isn't fail a method? Then a rule could pass itself to a sub-rule
and allow the sub-rule to fail it's parent, but not the entire match. Isn't
failing just invoking the last continuation on the backtrack stack?

- Ken



[perl #16842] Solaris8/gcc warnings/errors

2002-08-29 Thread via RT

# New Ticket Created by  Andy Bussey 
# Please include the string:  [perl #16842]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16842 >


I am compiling Parrot under Solaris 8 using gcc.

- I get lots of warnings about
  "padding struct to align 'whatever'"
  "padding struct size to alignment boundary" etc

- During the 'make', just after doing
  'gcc -o parrot...', it then does:
=
cd docs && make && cd ..
perldoc -u ../packfile.c > packfile-c.pod
Unknown option: u
perlman [-h] PageName|ModuleName...
-h   Display this help message.
PageName|ModuleName...
 is the name of a piece of documentation that you want to look at. You
 may either give a descriptive name of the page (as in the case of
 `perlfunc') or the name of a module, either like `Term::Info',
 `Term/Info'.

Any switches in the PERLDOC environment variable will be used before the
command line arguments.

*** Error code 2
make: Fatal error: Command failed for target `packfile-c.pod'
Current working directory /opt/perl_src/parrot/docs
*** Error code 1
make: Fatal error: Command failed for target `docs/.dummy'


   I assume that this is something to do with documentation.
   If I do 'make test', all tests that are not skipped pass.

   I ran Configure.pl with Perl 5.8.0 and it is not in my
   path. The version of Perl that is in my path is 5.005_03.
   I don't know if this makes a difference.

   Information from the perl I used for Configure.pl follows:
===
$ /opt/perl/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
osname=solaris, osvers=2.8, archname=sun4-solaris
uname='sunos rigel 5.8 generic_108528-13 sun4u sparc sunw,ultra-5_10 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
  Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64',
optimize='-O',
cppflags='-fno-strict-aliasing'
ccversion='', gccversion='3.0.3', gccosandvers='solaris2.8'
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
  Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib '
libpth=/usr/local/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc
perllibs=-lsocket -lnsl -ldl -lm -lc
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-E'
cccdlflags='-fPIC', lddlflags=' -Wl,-E -G -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: USE_LARGE_FILES
  Built under solaris
  Compiled at Aug  7 2002 16:10:20
  @INC:
/opt/perl/lib/5.8.0/sun4-solaris
/opt/perl/lib/5.8.0
/opt/perl/lib/site_perl/5.8.0/sun4-solaris
/opt/perl/lib/site_perl/5.8.0
/opt/perl/lib/site_perl
.
===

Cheers,

Andy Bussey


=
Andy Bussey
Email  [EMAIL PROTECTED]
Mobile 07814 740887

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com





[BUG] GC collects argv aka P0

2002-08-29 Thread Leopold Toetsch

Hi,

examples/life-ar.p6 uses a rather lengthy initialisation

my  @world = (
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 ...
}; # 512 values

then tries to figure out, how many generations to run:

my $gen = @ARGS[0] || 512;

at this point, @ARGS[0] aka P0[1] aka argv[1] is already dead:

$ perl6 -k examples/life-ar.p6 5
Running  generations
^^

- It's not a perl6 problem
- inserting "collectoff" at the start of life-ar.imc avoids the bug:

$ perl6 examples/life-ar.imc 5
Running 5 generations

I hope someone of the GC hackers out there can find a solution.

TIA,
leo




Re: auto deserialization

2002-08-29 Thread Steve Canfield

From: Dan Sugalski [EMAIL PROTECTED]
>I actually had something a bit more subversive
>in mind, where the assignment operator for the
>Date class did some magic the same way we do
>now when we do math on strings.

I was thinking a simple general purpose rule. If the variable is
typed, and its class has a standard static method for
instantiating from a string, and if a String object is being assigned
to the variable, then the class's deserialization method is called,
returning the new object and assigning it to the variable.

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com




Re: backtracking into { code }

2002-08-29 Thread Aaron Sherman

On Thu, 2002-08-29 at 10:28, Ken Fox wrote:
> Aaron Sherman wrote:
> > rule {  { /@operators/.commit(1) or fail }  }
> > 
> > The hypothetical commit() method being one that would take a number and
> 
> That would only be useful if the outer rule can backtrack into the
> inner /@operators/ rule. Can it?

Of course not. In the same way that 

rule foo { b }
rule bar { a + b }
"abb" =~ //

would not. You backtrack OVER it, and that's when your commit (of
whatever degree) would come into play.

> I agree with you that a commit method would be useful -- especially when
> used on $self. I'd probably write your example as:
> 
>   rule {  { m/@operators { $self.commit(1) }/ or fail }  }.
> which is of course just a complicated
> 
>   rule {  { m/@operators :/ or fail }  }

There's no way that can affect anything, as ":" doesn't affect calling
rules, e.g.:

rule foo { b : }
rule bar { a + b }
"abb" =~ //

will match, because the foo rule never needs to backtrack. If foo had
used C<<  >>, then you'd fail, but that's a horse of a different
animal.

The goal was to dynamically cause backtracking over inline code to fail.





Re: auto deserialization

2002-08-29 Thread Nicholas Clark

On Thu, Aug 29, 2002 at 07:52:42AM -0700, Steve Canfield wrote:
> From: Dan Sugalski [EMAIL PROTECTED]
> >I actually had something a bit more subversive
> >in mind, where the assignment operator for the
> >Date class did some magic the same way we do
> >now when we do math on strings.
> 
> I was thinking a simple general purpose rule. If the variable is
> typed, and its class has a standard static method for
> instantiating from a string, and if a String object is being assigned
> to the variable, then the class's deserialization method is called,
> returning the new object and assigning it to the variable.

This is possibly more an internals question, but I was assuming that the
serialization/deserialization methods would normally be converting an object
to an efficient packed 8 bit binary serial format (much like Storable
does).

In which case, is it a counterproductive assumption to expect (or mandate)
that the incoming serialization method on a class accepts well formed
human readable Unicode (or Shift-JIS or ASCII or whatever) strings?

Surely a class is allowed to make a distinction between the format that it
uses to serialize itself, and the format(s) of initialization strings it
accepts?

Nicholas Clark



Re: Hypothetical synonyms

2002-08-29 Thread Janek Schleicher

Luke Palmer wrote at Thu, 29 Aug 2002 15:21:57 +0200:

>> The ° character doesn't have any special meaning,
>> that's why I choosed it in the above example.
>> However, it also symbolizes a little capturing
>> and as it isn't filled,
>> it could really symbolize an uncapturing.
> 
> Interesting idea.  I'm not sure if I agree with it yet.  However, I don't 
> agree with your syntax, as I can't type that character.  

Year, that's of course a problem.
But I don't have any imagination what over typeable character
with no other meaning could be choosen.

> Is it possible to 
> modify what was captured?
> 
>   /" ([ \\ . { chop; chop } | <[^\\]> ]*?) "/
> 
> Or is that just too ugly?

IMHO, that looks as ugly as the other workaround solutions :-)

I think, the greatest strength of Perl is that
it expresses simple things in a simple, short and natural way.

Such a regexp behaviour would simplify a lot of
jobs where we have to make workarounds instead
about the simple stuff
  "Match it, capture the relevant parts and ignore some irrelevant subparts".

It's always possible to implemented with
- more captures, joined together later
or
- a substitution regexp/translitariton for the captured part
  to remove the irrelevant subparts


It's from my IMHO comparable to problem
  "Group it, but don't capture it"
what had been solved with the (?:) sytnax.
>From that regarding,
a (?_...) (Questionmark underscore) syntax could also be an idea
with the meaning
  "Group it, don't capture it even not in surrounding captures".
With it,
the OP problem would look like:
/\s*((?_").*?"(?_°)|\S+)/;

(I choosed the underscore, as it is typeable and could have the mnemonic meaning
 of some underlying unimport background group)


But perhaps, I'm only dreaming 


Cheerio,
Janek




[perl #16851] [PATCH] GC_VERBOSE: Allow make test with GC_DEBUG

2002-08-29 Thread via RT

# New Ticket Created by  Steve Fink 
# Please include the string:  [perl #16851]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16851 >


This patch disables the possibly spurious warnings reported by
GC_DEBUG when walking the system stack. With it, you can run make test
and not have bogus failures because the warning message got mixed up
in the output. Change GC_VERBOSE to 1 to see all possible problems.



-- attachment  1 --
url: http://rt.perl.org/rt2/attach/36033/29149/36cccb/gc_verbose.patch



? .timestamp
? MANIFEST.u
? Makefile.in-1.142
? Makefile.in-mine-1.142
? Test
? Types.pm.diff
? assemble.pl.diff
? crap.c
? libparrot.def
? life
? life.c
? noop.asm
? noop.pbc
? pbc2c.pl.diff
? stest.pbc
? test
? test_gnuc
? test_parrot
? testbyteorder
? testparrotfuncptr
? testparrotsizes
? tree
? xxx.pasm
? xxx.pbc
? languages/regex/test.pasm
? languages/regex/test.pbc
? t/src/basic_1.
? t/src/basic_1.c
? t/src/basic_2.
? t/src/basic_2.c
Index: include/parrot/dod.h
===
RCS file: /cvs/public/parrot/include/parrot/dod.h,v
retrieving revision 1.2
diff -p -u -r1.2 dod.h
--- include/parrot/dod.h23 Aug 2002 07:55:22 -  1.2
+++ include/parrot/dod.h29 Aug 2002 19:14:54 -
@@ -47,6 +47,9 @@ buffer_lives(Buffer *buffer)
  * If it *is* a bug, you may want to read the notes in
  * get_free_buffer() in headers.c for tips on debugging using
  * gdb with this pointer and version number. */
+#if ! GC_VERBOSE
+if (! CONSERVATIVE_POINTER_CHASING)
+#endif
 fprintf(stderr, "GC Warning! Live buffer %p version " INTVAL_FMT " found on 
free list\n", buffer, buffer->version);
 assert(CONSERVATIVE_POINTER_CHASING);
 }
Index: include/parrot/parrot.h
===
RCS file: /cvs/public/parrot/include/parrot/parrot.h,v
retrieving revision 1.48
diff -p -u -r1.48 parrot.h
--- include/parrot/parrot.h 23 Aug 2002 13:46:21 -  1.48
+++ include/parrot/parrot.h 29 Aug 2002 19:14:56 -
@@ -155,6 +155,12 @@ typedef void (*funcptr_t)(void);
  * to occur more frequently. It does significantly reduce performance. */
 #define GC_DEBUG 0
 
+/* If you're really digging into things, then turn on GC_VERBOSE to
+ * see warning messages for stuff that might, or might not, be a
+ * problem. (See dod.h) This is disabled by default because the
+ * warning messages cause many tests to fail. */
+#define GC_VERBOSE 0
+
 #include "parrot/platform.h"
 #include "parrot/global_setup.h"
 #include "parrot/interpreter.h"



[perl #16852] [PATCH] Eliminate empty extension

2002-08-29 Thread via RT

# New Ticket Created by  Steve Fink 
# Please include the string:  [perl #16852]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16852 >


This patch trims off the period at the end of executable filenames for
C-based tests on unix. (It compiled "t/src/basic_1.c" ->
"t/src/basic_1."; this patch makes that "t/src/basic_1")



-- attachment  1 --
url: http://rt.perl.org/rt2/attach/36036/29153/edd568/extensions.patch



Index: lib/Parrot/Test.pm
===
RCS file: /cvs/public/parrot/lib/Parrot/Test.pm,v
retrieving revision 1.25
diff -p -u -r1.25 Test.pm
--- lib/Parrot/Test.pm  28 Aug 2002 05:10:54 -  1.25
+++ lib/Parrot/Test.pm  29 Aug 2002 18:00:38 -
@@ -48,17 +48,16 @@ sub _run_command {
 
 sub per_test {
   my ($ext,$count) = @_;
-  $ext =~ s/^\.//;
   my $t = $0;
-  $t =~ s/\.t$/_$count\.$ext/;
+  $t =~ s/\.t$/_$count$ext/;
   return $t;
 }
 
 sub generate_pbc_for {
   my ($assembly,$directory,$count) = @_;
   local( *ASSEMBLY, *OUTPUT );
-  my $as_f = per_test('pasm',$count);
-  my $by_f = per_test('pbc',$count);
+  my $as_f = per_test('.pasm',$count);
+  my $by_f = per_test('.pbc',$count);
 
   my $can_skip_compile = $ENV{PARROT_QUICKTEST};
   if ($can_skip_compile)
@@ -112,8 +111,8 @@ sub generate_functions {
   #generate pbc for this test (may be overriden)
   $pbc_generator->( $assembly, $directory, $count );
 
-  my $by_f = per_test('pbc',$count);
-  my $out_f = per_test('out',$count);
+  my $by_f = per_test('.pbc',$count);
+  my $out_f = per_test('.out',$count);
 
   $TEST_PROG_ARGS = "" unless defined $TEST_PROG_ARGS;
   _run_command( "${directory}$PConfig{test_prog} ${TEST_PROG_ARGS} $by_f", 
'STDOUT' => $out_f, 'STDERR' => $out_f);
@@ -153,11 +152,11 @@ sub generate_functions {
 
   $output =~ s/\cM\cJ/\n/g;
   local( *SOURCE );
-  my $source_f = per_test('c',$count);
+  my $source_f = per_test('.c',$count);
   my $obj_f = per_test($PConfig{o},$count);
   my $exe_f = per_test($PConfig{exe},$count);
   $exe_f =~ s@[\\/:]@$PConfig{slash}@g;
-  my $out_f = per_test('out',$count);
+  my $out_f = per_test('.out',$count);
 
   open SOURCE, "> $source_f" or die "Unable to open '$source_f'";
   binmode SOURCE;



Re: [perl #16842] Solaris8/gcc warnings/errors

2002-08-29 Thread Andy Dougherty

On Thu, 29 Aug 2002, Andy Bussey wrote:

> I am compiling Parrot under Solaris 8 using gcc.
> 
> - I get lots of warnings about
>   "padding struct to align 'whatever'"
>   "padding struct size to alignment boundary" etc

Yes, there are lots of warnings.  It's probably the case that some are
harmless while others are not.  You need to look at each individual one
carefully.

> perldoc -u ../packfile.c > packfile-c.pod
> Unknown option: u

This sounds like it's picking up a very old version of perldoc somewhere
else in your $PATH.  It's not a serious problem, but you might want to
track down which version of perldoc is getting called.

-- 
Andy Dougherty  [EMAIL PROTECTED]
Dept. of Physics
Lafayette College, Easton PA 18042




[perl #16853] [PATCH] avoid touching files

2002-08-29 Thread via RT

# New Ticket Created by  Steve Fink 
# Please include the string:  [perl #16853]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16853 >


This patch makes re-running Configure.pl avoid updating the timestamps
on the generated .h (and many other) files iff the files did not
actually change. This is really only helpful to people who are working
on the Configure system and are sick of having to rebuild everything
to test their changes. It should be safe to apply for everyone, but I
don't know if it's a good idea.


-- attachment  1 --
url: http://rt.perl.org/rt2/attach/36039/29157/a85e11/config-ifdiff.patch



Index: config/gen/config_h.pl
===
RCS file: /cvs/public/parrot/config/gen/config_h.pl,v
retrieving revision 1.2
diff -p -u -r1.2 config_h.pl
--- config/gen/config_h.pl  7 Jun 2002 01:12:39 -   1.2
+++ config/gen/config_h.pl  29 Aug 2002 17:31:22 -
@@ -9,9 +9,12 @@ $description="Generating config.h...";
 @args=();
 
 sub runstep {
-  genfile('config/gen/config_h/config_h.in', 'include/parrot/config.h');
+  genfile('config/gen/config_h/config_h.in', 'include/parrot/config.h',
+  ignorePattern => 'PARROT_CONFIG_DATE');
 
-  open(HH, ">include/parrot/has_header.h") or die "Can't open has_header.h: $!";
+  my $hh = "include/parrot/has_header.h";
+  open(HH, ">$hh.tmp")
+or die "Can't open has_header.h: $!";
 
   print HH qq(
 /*
@@ -32,6 +35,8 @@ sub runstep {
   }
   
   close HH;
+
+  copy_if_diff("$hh.tmp", $hh);
 }
 
 1;
Index: config/gen/platform.pl
===
RCS file: /cvs/public/parrot/config/gen/platform.pl,v
retrieving revision 1.2
diff -p -u -r1.2 platform.pl
--- config/gen/platform.pl  8 Jun 2002 04:13:28 -   1.2
+++ config/gen/platform.pl  29 Aug 2002 17:31:22 -
@@ -2,8 +2,7 @@ package Configure::Step;
 
 use strict;
 use vars qw($description @args);
-use Parrot::Configure::Step;
-use File::Copy 'copy';
+use Parrot::Configure::Step qw(copy_if_diff);
 
 $description="Moving platform files into place...";
 
@@ -16,11 +15,8 @@ sub runstep {
   $platform="ansi" if defined($_[0]);
   $platform="generic" unless -e "config/gen/platform/$platform.c";
   
-  copy("config/gen/platform/$platform.c", "platform.c");
-  copy("config/gen/platform/$platform.h", "include/parrot/platform.h");
-  
-  my $now=time;
-  utime $now, $now, "platform.c", "include/parrot/platform.h";
+  copy_if_diff("config/gen/platform/$platform.c", "platform.c");
+  copy_if_diff("config/gen/platform/$platform.h", "include/parrot/platform.h");
 }
 
 1;



[perl #16854] [PATCH] another string test

2002-08-29 Thread via RT

# New Ticket Created by  Steve Fink 
# Please include the string:  [perl #16854]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16854 >


I forget what this was testing, but it uncovered a problem at some
point in the past.



-- attachment  1 --
url: http://rt.perl.org/rt2/attach/36042/29163/5c7f19/string-test.patch



Index: t/op/string.t
===
RCS file: /cvs/public/parrot/t/op/string.t,v
retrieving revision 1.30
diff -p -u -r1.30 string.t
--- t/op/string.t   21 Aug 2002 08:02:56 -  1.30
+++ t/op/string.t   29 Aug 2002 19:44:27 -
@@ -1,6 +1,6 @@
 #! perl -w
 
-use Parrot::Test tests => 90;
+use Parrot::Test tests => 91;
 use Test::More;
 
 output_is( <<'CODE', <<', "concat_s_s|sc, null onto null" );
  print "<>"



[perl #16855] [PATCH] uselessly optimize print()

2002-08-29 Thread via RT

# New Ticket Created by  Steve Fink 
# Please include the string:  [perl #16855]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16855 >


In tracking down a gc bug, I realized that the current throwaway
implementation of the print op could be replaced with a faster
throwaway implementation that avoids doing a string_to_cstring.

Note that both the original and new implementations are still buggy
with respect to supporting different encodings. I don't know if
printf("%s") is any better than fwrite in terms of at least vaguely
paying attention to your locale or whatever. If so, don't apply it.

(all tests pass)

This patch, like the preceding several, are really just the detritus
resulting from me trying to clean up my local copy wrt to CVS. I will
now revert this change in my local code, and get the change back later
if someone bothers to apply the patch.


-- attachment  1 --
url: http://rt.perl.org/rt2/attach/36044/29166/2d4445/fwrite-print.patch



Index: core.ops
===
RCS file: /cvs/public/parrot/core.ops,v
retrieving revision 1.203
diff -p -u -r1.203 core.ops
--- core.ops23 Aug 2002 17:21:38 -  1.203
+++ core.ops29 Aug 2002 19:51:34 -
@@ -240,7 +240,7 @@ inline op print(in NUM) {
 op print(in STR) {
   STRING *s = $1;
   if (s && string_length(s)) {
-printf("%s", string_to_cstring(interpreter, (s)));
+fwrite(s->strstart, s->strlen, 1, stdout);
   }
   goto NEXT();
 }
@@ -249,7 +249,7 @@ op print(in PMC) {
   PMC *p = $1;
   STRING *s = (p->vtable->get_string(interpreter, p));
   if (s) {
-printf("%s", string_to_cstring(interpreter, (s)));
+fwrite(s->strstart, s->strlen, 1, stdout);
   }
   goto NEXT();
 }
@@ -298,7 +298,7 @@ op print(in INT, in STR) {
 default: file = OPCODE_T2PTR(FILE *, $1);
   }
   if (s && string_length(s)) {
-fprintf(file, "%s", string_to_cstring(interpreter, (s)));
+fwrite(s->strstart, s->strlen, 1, stdout);
   }
   goto NEXT();
 }
@@ -317,7 +317,7 @@ op print(in INT, in PMC) {
 default: file = OPCODE_T2PTR(FILE *, $1);
   }
   if (s) {
-fprintf(file, "%s", string_to_cstring(interpreter, (s)));
+fwrite(s->strstart, s->strlen, 1, stdout);
   }
   goto NEXT();
 }



Re: [PATCH?] File deletion

2002-08-29 Thread Robert Spier

Bryan C. Warnock writes:
>How does one patch a file to delete?
>
>docs/a5_draft.html can go away now, thank you for playing.

rm 
cvs delete 
cvs commit




[perl #16856] [PATCH] various changes to imcc

2002-08-29 Thread via RT

# New Ticket Created by  Steve Fink 
# Please include the string:  [perl #16856]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16856 >


I was once idly toying with imcc while awaiting a phone call. This is
the completely untested result.

 - Adds the CONSERVATIVE_POINTER_CHASING definition to anyop.c, because
   anyop includes the parrot .h files and at one point didn't seem to
   be linking with libparrot, so I couldn't compile it if GC_DEBUG was
   on. However, t/src at one point was behaving the same way and isn't
   anymore, so I don't know if this is needed now.

 - Adds %option nounput to imcc.l. This avoids a warning when
   compiling the output file. This one is correct, at least.

 - An attempt to improve the speed and correctness of set_make_full,
   set_copy, and set_equal in sets.c. A good idea, but wholly
   untested.


-- attachment  1 --
url: http://rt.perl.org/rt2/attach/36046/29169/7ccbfb/imcc-various.patch



? languages/imcc/Makefile.tmp
Index: languages/imcc/anyop.c
===
RCS file: /cvs/public/parrot/languages/imcc/anyop.c,v
retrieving revision 1.3
diff -p -u -r1.3 anyop.c
--- languages/imcc/anyop.c  27 Aug 2002 06:48:44 -  1.3
+++ languages/imcc/anyop.c  29 Aug 2002 20:05:25 -
@@ -9,6 +9,10 @@ static int lastdl_handle = 1;
 static struct Oplib oplibs[16];
 static int lastlib = 0;
 
+#if GC_DEBUG
+int CONSERVATIVE_POINTER_CHASING = 0;
+#endif
+
 op_t NULLOP = { -1, -1 };
 
 int
Index: languages/imcc/imcc.l
===
RCS file: /cvs/public/parrot/languages/imcc/imcc.l,v
retrieving revision 1.10
diff -p -u -r1.10 imcc.l
--- languages/imcc/imcc.l   27 Aug 2002 14:09:00 -  1.10
+++ languages/imcc/imcc.l   29 Aug 2002 20:05:25 -
@@ -22,6 +22,7 @@ int yyerror(char *);
 %}
 
 %option outfile="imclexer.c"
+%option nounput
 
 LETTER  [a-zA-Z_]
 DIGIT   [0-9]
Index: languages/imcc/sets.c
===
RCS file: /cvs/public/parrot/languages/imcc/sets.c,v
retrieving revision 1.2
diff -p -u -r1.2 sets.c
--- languages/imcc/sets.c   7 Aug 2002 03:23:42 -   1.2
+++ languages/imcc/sets.c   29 Aug 2002 20:05:32 -
@@ -12,14 +12,10 @@ Set* set_make (int length) {
 
 Set* set_make_full (int length) {
Set *s = malloc(sizeof(Set));
-   int i;
 
s->length = length;
s->bmp = malloc(sizeof(char) * (length/8 + 1));
-
-   for (i=0; i < (length/8) + 1; i++) {
-   s->bmp[i] = 255;
-   }
+memset(s->bmp, 0xff, length/8 + 1);
 
return s;
 }
@@ -30,33 +26,35 @@ void set_free (Set *s) {
 }
 
 Set* set_copy (Set *s1) {
-   int i;
Set *s = malloc(sizeof(Set));
+
s->length = s1->length;
s->bmp = malloc( sizeof(char) * (s->length/8 + 1));
-
-   for (i=0; i < (s->length/8); i++) {
-   s->bmp[i] = s1->bmp[i];
-   }
+memcpy(s->bmp, s1->bmp, (s->length+1)/8);
 
return s;
 }
 
 
 int set_equal (Set *s1, Set *s2) {
-   int i;
+int mask;

-   if (s1->length != s2->length) {
-   fprintf(stderr, "INTERNAL ERROR: Sets don't have the same length in 
set_equal!\n");
-   }
-
-   for (i=0; i < (s1->length/8); i++) {
-   if (s1->bmp[i] != s2->bmp[i]) { return 0; };
-   }
-
-   /* bug here: the tail of the bitmap is not compared */
+if (s1->length != s2->length) {
+fprintf(stderr, "INTERNAL ERROR: Sets don't have the same length in 
+set_equal!\n");
+}
+
+if (memcmp(s1->bmp, s2->bmp, s1->length / 8) != 0)
+return 0;
+
+if (s1->length % 8 == 0)
+return 1;
+
+/* Have a partial tail. */
+mask = (1 << (s1->length % 8)) - 1;
+if ((s1->bmp[s1->length / 8] & mask) != (s2->bmp[s1->length / 8] & mask))
+return 0;
 
-   return 1;
+return 1;
 }
 
 void set_add (Set *s, int element) {



Re: [PATCH?] File deletion

2002-08-29 Thread Steve Fink

On Thu, Aug 29, 2002 at 01:05:33PM -0700, Robert Spier wrote:
> Bryan C. Warnock writes:
> >How does one patch a file to delete?
> >
> >docs/a5_draft.html can go away now, thank you for playing.
> 
> rm 
> cvs delete 
> cvs commit

Not if you don't have commit access! :-)

You can diff against /dev/null. I think that's what would happen if
you did a cvs remove and then generated the patch with cvs diff -N.

Anyway, I just committed the removal. My favored flavor is:

  cvs remove -f 
  cvs commit

But remember to fix up MANIFEST too...



[perl #16857] [PATCH] minor refactoring in dod.c

2002-08-29 Thread via RT

# New Ticket Created by  Steve Fink 
# Please include the string:  [perl #16857]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16857 >


Small cleanups, but also a piece of my attempted fixes to the
BUFFER_external_FLAG. (The CVS version currently doesn't work anyway,
so don't worry about only getting parts of my fixes in; nothing
depends on it.)


-- attachment  1 --
url: http://rt.perl.org/rt2/attach/36048/29172/84a80b/dod-nits.patch



Index: dod.c
===
RCS file: /cvs/public/parrot/dod.c,v
retrieving revision 1.21
diff -p -u -r1.21 dod.c
--- dod.c   23 Aug 2002 07:53:35 -  1.21
+++ dod.c   29 Aug 2002 20:16:20 -
@@ -274,6 +274,13 @@ trace_active_buffers(struct Parrot_Inter
 }
 }
 
+static int
+pmc_freeable(UINTVAL flags)
+{
+UINTVAL mask = PMC_live_FLAG | PMC_on_free_list_FLAG | PMC_constant_FLAG;
+return !(flags & mask);
+}
+
 /* Free up any PMCs that aren't in use */
 static void
 free_unused_PMCs(struct Parrot_Interp *interpreter)
@@ -291,11 +298,10 @@ free_unused_PMCs(struct Parrot_Interp *i
  * Note that it is technically possible to have a PMC be both
  * on_free_list and live, because of our conservative stack-walk
  * collection. We must be wary of this case. */
-if (!(pmc_array[i].flags & (PMC_live_FLAG | PMC_on_free_list_FLAG |
-   PMC_constant_FLAG))) {
+if (pmc_freeable(pmc_array[i].flags)) {
 add_free_pmc(interpreter,
-interpreter->arena_base->pmc_pool,
-&pmc_array[i]);
+ interpreter->arena_base->pmc_pool,
+ &pmc_array[i]);
 } else if(!(pmc_array[i].flags & PMC_on_free_list_FLAG)) {
 total_used++;
 pmc_array[i].flags &= ~PMC_live_FLAG;
@@ -308,6 +314,16 @@ free_unused_PMCs(struct Parrot_Interp *i
 interpreter->arena_base->pmc_pool->total_objects - total_used;
 }
 
+static int
+buffer_freeable(UINTVAL flags)
+{
+UINTVAL mask = BUFFER_on_free_list_FLAG
+ | BUFFER_constant_FLAG
+ | BUFFER_live_FLAG
+ | BUFFER_external_FLAG;
+return !(flags & mask);
+}
+
 /* Put any buffers that are now unused, on to the free list
  * Avoid buffers that are immune from collection (ie, constant) */
 static void
@@ -328,10 +344,7 @@ free_unused_buffers(struct Parrot_Interp
  * Note that it is technically possible to have a Buffer be both
  * on_free_list and live, because of our conservative stack-walk
  * collection. We must be wary of this case. */
-if (!(b->flags & ( BUFFER_on_free_list_FLAG
- | BUFFER_constant_FLAG
- | BUFFER_live_FLAG )))
-{
+if (buffer_freeable(b->flags)) {
 if (pool->mem_pool) {
 if (!(b->flags & BUFFER_COW_FLAG)) {
 ((struct Memory_Pool *)



[perl #16858] [PATCH] minor resources.c refactoring

2002-08-29 Thread via RT

# New Ticket Created by  Steve Fink 
# Please include the string:  [perl #16858]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16858 >


Oops, this should have been combined with the previous dod.c patch.
It's the same thing -- minor refactoring for clarity, plus fixing
BUFFER_external_FLAG. But applying either individually won't break
anything that's not already broken.


-- attachment  1 --
url: http://rt.perl.org/rt2/attach/36050/29175/342e17/resources-nits.patch



Index: resources.c
===
RCS file: /cvs/public/parrot/resources.c,v
retrieving revision 1.84
diff -p -u -r1.84 resources.c
--- resources.c 24 Aug 2002 05:31:20 -  1.84
+++ resources.c 29 Aug 2002 20:20:32 -
@@ -143,6 +143,16 @@ mem_allocate(struct Parrot_Interp *inter
 
 /** Compaction Code **/
 
+static int
+buffer_movable(UINTVAL flags)
+{
+UINTVAL mask = BUFFER_on_free_list_FLAG
+ | BUFFER_constant_FLAG
+ | BUFFER_immobile_FLAG
+ | BUFFER_external_FLAG;
+return !(flags & mask);
+}
+
 /* Compact the buffer pool */
 static void compact_pool(struct Parrot_Interp *interpreter,
  struct Memory_Pool *pool)
@@ -203,12 +213,7 @@ static void compact_pool(struct Parrot_I
 Buffer *b = cur_buffer_arena->start_objects;
 UINTVAL i;
 for (i = 0; i < cur_buffer_arena->used; i++) {
-if (b->bufstart && 
-!(b->flags & ( BUFFER_on_free_list_FLAG
- | BUFFER_constant_FLAG
- | BUFFER_immobile_FLAG
- | BUFFER_external_FLAG
- ))) {
+if (b->bufstart && buffer_movable(b->flags)) {
 struct Buffer_Tail *tail = 
 (struct Buffer_Tail *)((char *)b->bufstart +b->buflen);
 ptrdiff_t offset = 0;
@@ -285,10 +290,7 @@ static void compact_pool(struct Parrot_I
 interpreter->arena_base->extra_buffer_headers.bufstart;
 Buffer* b = buffers[j];
 if (b->bufstart) {
-if (!(b->flags & (BUFFER_on_free_list_FLAG | 
-  BUFFER_constant_FLAG | 
-  BUFFER_immobile_FLAG)))
-{
+if (buffer_movable(b->flags)) {
 struct Buffer_Tail *new_tail = 
(struct Buffer_Tail *)((char *)cur_spot + b->buflen);
 /* we can't perform the math all the time, 



Re: Mode a la mode

2002-08-29 Thread Robert Spier

Bryan C. Warnock writes:
>There is a general inconsistency about file permissions throughout the
>parrot tree.
>
>Of the 80+ *.pl scripts, only 8 are 0755 - and Configure.pl isn't one of
>them. Some tests are, some aren't; and even some docs are.  A list
>follows.

These have to be fixed in the repository.

If someone makes a decision as to what they should be, let me know,
and I'll tweak.

-R




[perl #16859] [PATCH] Fix BUFFER_external_FLAG for strings

2002-08-29 Thread via RT

# New Ticket Created by  Steve Fink 
# Please include the string:  [perl #16859]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16859 >


This patch is the real fix for strings with the BUFFER_external_FLAG.
It requires the previous dod.c and resources.c patches to be applied.

Strings marked with the BUFFER_external_FLAG point to the external
memory rather than making a copy for themselves. Side effects of this
are (1) less memory usage, (2) external updates to the string are
reflected in the Parrot STRING (except for length changes!), and (3)
these strings are skipped over when memory is getting moved around
during a compaction.


-- attachment  1 --
url: http://rt.perl.org/rt2/attach/36052/29178/90822c/external-strings.patch



Index: string.c
===
RCS file: /cvs/public/parrot/string.c,v
retrieving revision 1.90
diff -p -u -r1.90 string.c
--- string.c23 Aug 2002 07:53:35 -  1.90
+++ string.c29 Aug 2002 20:27:23 -
@@ -182,13 +182,25 @@ string_make(struct Parrot_Interp *interp
 }
 
 s = new_string_header(interpreter, flags);
-Parrot_allocate_string(interpreter, s, buflen);
+if (flags & BUFFER_external_FLAG) {
+s->bufstart = buffer;
+s->buflen = buflen;
+}
+else {
+Parrot_allocate_string(interpreter, s, buflen);
+}
 s->encoding = encoding;
 s->type = type;
 
 if (buffer) {
-mem_sys_memcopy(s->strstart, buffer, buflen);
-s->bufused = buflen;
+if (flags & BUFFER_external_FLAG) {
+s->strstart = s->bufstart;
+s->bufused = buflen;
+}
+else {
+mem_sys_memcopy(s->strstart, buffer, buflen);
+s->bufused = buflen;
+}
 (void)string_compute_strlen(s);
 }
 else {



[perl #16860] [PATCH] segfault in pdb's p command

2002-08-29 Thread via RT

# New Ticket Created by  Steve Fink 
# Please include the string:  [perl #16860]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=16860 >


As a result of my recent changes to debug.c, a plain 'p' (or 'print')
in pdb now seg faults. This patch prints out all four register files
instead, which seems somewhat more helpful.


-- attachment  1 --
url: http://rt.perl.org/rt2/attach/36054/29181/c0591c/pdb-printall.patch



Index: debug.c
===
RCS file: /cvs/public/parrot/debug.c,v
retrieving revision 1.36
diff -p -u -r1.36 debug.c
--- debug.c 27 Aug 2002 05:26:15 -  1.36
+++ debug.c 29 Aug 2002 20:28:54 -
@@ -1790,6 +1790,14 @@ PDB_print(struct Parrot_Interp *interpre
   
 command = skip_ws(command);
 command = parse_command(command, &c);
+if (command == NULL) {
+PDB_print_int(&interpreter->ctx.int_reg, -1);
+PDB_print_num(&interpreter->ctx.num_reg, -1);
+PDB_print_string(interpreter,&interpreter->ctx.string_reg, -1);
+PDB_print_pmc(interpreter,&interpreter->ctx.pmc_reg, -1, NULL);
+return;
+}
+
 command = skip_ws(command);
 
 if (isdigit((int) *command)) {



GC speeds for hashes

2002-08-29 Thread Dan Sugalski

I ran some quick time tests on the GC, and hashes are relatively 
expensive to GC, relative to other things. (They're an order of 
magnitude slower than perlstrings, and two orders of magitude slower 
than perlints) They're slow enough that I'd like to take a look at 
them to see if perhaps there's a way to have less GC overhead...
-- 
 Dan

--"it's like this"---
Dan Sugalski  even samurai
[EMAIL PROTECTED] have teddy bears and even
   teddy bears get drunk



Re: Mode a la mode

2002-08-29 Thread Andy Dougherty

On Thu, 29 Aug 2002, Robert Spier wrote:

> Bryan C. Warnock writes:
> >There is a general inconsistency about file permissions throughout the
> >parrot tree.
> >
> >Of the 80+ *.pl scripts, only 8 are 0755 - and Configure.pl isn't one of
> >them. Some tests are, some aren't; and even some docs are.  A list
> >follows.
> 
> These have to be fixed in the repository.
> 
> If someone makes a decision as to what they should be, let me know,
> and I'll tweak.

Apart from Configure.pl, I'd tend to favor leaving the ones that are
invoked as part of the build/test process without execute permission.  
That way, folks are forced to write $(PERL) script.pl in makefiles instead
of just ./script.pl.  There's no guarantee that #!/usr/bin/perl (or any
variation) is the correct perl version to invoke. It's quite possible
(indeed probably reasonably common) for Parrot developers to have more
than one version of perl available.  It's important that all parts of
parrot be built with the same version, otherwise chaos can ensue.  Just
yesterday, I submitted a bunch of makefile patches addressing this very
issue.

-- 
Andy Dougherty  [EMAIL PROTECTED]
Dept. of Physics
Lafayette College, Easton PA 18042




Re: [perl #16856] [PATCH] various changes to imcc

2002-08-29 Thread Andy Dougherty

On Thu, 29 Aug 2002, Steve Fink wrote:

>  - Adds %option nounput to imcc.l. This avoids a warning when
>compiling the output file. This one is correct, at least.

Hmm.  Sun's lex(1) doesn't understand that line.  Is there another easy
way around the problem?  If not, I'll try to think of some other way
around it.

-- 
Andy Dougherty  [EMAIL PROTECTED]
Dept. of Physics
Lafayette College, Easton PA 18042




Re: GC speeds for hashes

2002-08-29 Thread Steve Fink

On Thu, Aug 29, 2002 at 04:31:14PM -0400, Dan Sugalski wrote:
> I ran some quick time tests on the GC, and hashes are relatively 
> expensive to GC, relative to other things. (They're an order of 
> magnitude slower than perlstrings, and two orders of magitude slower 
> than perlints) They're slow enough that I'd like to take a look at 
> them to see if perhaps there's a way to have less GC overhead...
> -- 

PerlStrings are scanned using the PMC_is_buffer_ptr_FLAG; PerlInts
don't need to get scanned at all. Neither of them has any possibility
of containing other PMCs or Buffers, so it's not really a fair
comparison.

Arrays or PerlArrays would be a slightly better comparison, because at
least they contain other stuff. But still, they get scanned via
PMC_is_buffer_ptr_FLAG and PMC_is_PMC_ptr_FLAG. PerlHash fundamentally
needs a custom mark routine. So at the very least, I think you need to
compare against something with a custom mark(). Then we'll know how
much improvement is possible. I would recommend the Key PMC for now,
since its mark() routine is about as simple as you'll be able to get.

One way to get a speedup, though, is to discard the value union and
only allow hashes to contain PMCs. I don't think anything is really
using the other possibilities anyway, though I might be wrong. (And I
have no idea whether anything would actually speed up...)



Re: [perl #16856] [PATCH] various changes to imcc

2002-08-29 Thread Steve Fink

On Thu, Aug 29, 2002 at 04:48:20PM -0400, Andy Dougherty wrote:
> On Thu, 29 Aug 2002, Steve Fink wrote:
> 
> >  - Adds %option nounput to imcc.l. This avoids a warning when
> >compiling the output file. This one is correct, at least.
> 
> Hmm.  Sun's lex(1) doesn't understand that line.  Is there another easy
> way around the problem?  If not, I'll try to think of some other way
> around it.

Ugh. Well, I suppose we could always post-process the output to remove
the offending routine, but I don't know if that's going to have enough
in common. Does Sun's lex result in the same warning? If not, I guess
we only need to cut out flex's unput() definition.




Re: Hypothetical synonyms

2002-08-29 Thread Larry Wall

Don't forget you can parameterize rules with subrules.  I don't see
any reason you couldn't write a



kind of rule and do whatever you like with the submatched bits.

Larry




Re: declaring if and while (was: rule, rx and sub)

2002-08-29 Thread Larry Wall

On Thu, 29 Aug 2002, Thomas A. Boyer wrote:
: Am I getting this straight?

As straight as any of us are getting it thus far.  :-)

The process is intended to be convergent.  That doesn't guarantee it
will converge, but that's the intention.

When I'm playing golf, I always expect to knock the ball into the hole.
And I'm happy if the ball ends up closer to the hole than it was.

Larry




Re: [perl #16856] [PATCH] various changes to imcc

2002-08-29 Thread Melvin Smith

At 02:06 PM 8/29/2002 -0700, Steve Fink wrote:
>On Thu, Aug 29, 2002 at 04:48:20PM -0400, Andy Dougherty wrote:
> > On Thu, 29 Aug 2002, Steve Fink wrote:
> >
> > >  - Adds %option nounput to imcc.l. This avoids a warning when
> > >compiling the output file. This one is correct, at least.
> >
> > Hmm.  Sun's lex(1) doesn't understand that line.  Is there another easy
> > way around the problem?  If not, I'll try to think of some other way
> > around it.
>
>Ugh. Well, I suppose we could always post-process the output to remove
>the offending routine, but I don't know if that's going to have enough
>in common. Does Sun's lex result in the same warning? If not, I guess
>we only need to cut out flex's unput() definition.

I can live with the warning, as long as it compiles under traditional
lex and flex. Don't waste too much effort polishing imcc since it will be
getting a new interface eventually and might even be rewritten to self-host
on Parrot at some point. (Hey I'm dreaming BIG)

The same goes for the bison vs. yacc question. IMCC doesn't even require
LR/LALR. The grammar is simple and isn't ambiguous so we can easily
convert it to other tools or even hand-write it, but that would probably be
counter-productive, so we probably should keep it as traditional yacc as 
possible.

-Melvin





Re: [perl #16852] [PATCH] Eliminate empty extension

2002-08-29 Thread Leopold Toetsch

Steve Fink (via RT) wrote:


> This patch trims off the period at the end of executable filenames for
> C-based tests on unix. 


Nice, but I'm a little bit Warnocked.

1) I did post a script (testnative), which runs _all_ tests as 
executables, _all_ not one, and --shared too.


2) Im my tree (~20 lines diff to CVS)

$ perl6 --test-parrot ../../t/*/*.t

Failed Test  Status Wstat Total Fail  Failed  List of failed
---
.../../t/src/bas   22 100,00%  1-2
5 subtests skipped.
Failed 1/26 test scripts, 96.15% okay. 2/433 subtests failed, 99.54% okay.

e.g.
$ perl6 --parrot-test ../../t/pmc/p*.t
Test details:
.../../t/pmc/perlarray.t..15/15
.../../t/pmc/perlhash.t...15/15

$ perl6 --parrot-test ../../t/pmc/p*.t -C  ## as C executable
Test details:
.../../t/pmc/perlarray.t..15/15

$ perl6 --parrot-test ../../t/pmc/p*.t -C --shared ## shared exe
Test details:
.../../t/pmc/perlarray.t...7/15
^C

Rational:

This saves the rather longish startup times for loading the perl6 
parser. Testing parrot (or imc is a side effect). Perl6 test times are 
cut to 40%.

BTW, perl6 deletes the 2MB exe after test (433 * 2 MB = boom ;-)
leo




Re: [perl #16852] [PATCH] Eliminate empty extension

2002-08-29 Thread Steve Fink

On Thu, Aug 29, 2002 at 11:56:42PM +0200, Leopold Toetsch wrote:
> Steve Fink (via RT) wrote:
> 
> >This patch trims off the period at the end of executable filenames for
> >C-based tests on unix. 
> 
> Nice, but I'm a little bit Warnocked.
> 
> 1) I did post a script (testnative), which runs _all_ tests as 
> executables, _all_ not one, and --shared too.

Umm... sounds good, but I'm not sure how that relates to my patch. My
patch was a silly cleanup patch that renamed an intermediate file for
a test from "t/src/basic_1." to "t/src/basic_1". I only did it because
it bothered my sense of aesthetics. Or maybe I was stuck on something
else; I forget.

The script you're referring to sounds like it actually does something
meaningful, like run ops2c.pl on all the tests and execute them that
way. Which is utterly unrelated to what I did; I was only messing with
the tests that are actually written in C in the first place, and I
didn't change anything but a filename that nobody sees unless they're
debugging them. Or are you saying there's no point in doing this
because we should be running through your script instead? I'm still
confused about the relationship between your comments and the message
you're commenting on.

> Rational:
> 
> This saves the rather longish startup times for loading the perl6 
> parser. Testing parrot (or imc is a side effect). Perl6 test times are 
> cut to 40%.

Sounds good to me; the tests take an annoyingly long time right now.

> BTW, perl6 deletes the 2MB exe after test (433 * 2 MB = boom ;-)

I hope there's some way of keeping the executable around for
dissecting with gdb. $ENV{POSTMORTEM} or something?



Re: rule, rx and sub

2002-08-29 Thread Damian Conway

Larry wrote:

>  sub while (&test is rx//, &body);
> 
> or some such.  That probably isn't sufficient to pick  out of Perl's
> grammar rather than the current lexical scope.


I love the idea, but the property name needs to be more expressive
(and Huffmanly longer). Maybe:

sub while (&test is specified(//), &body);


C is not ideal because it would also be very useful to
be able to select between variants of a multimethod by matching a
pattern against the *value* of an argument. That is:

sub repeat is multi ($count is valued(/\d+/),  &body) {
body($_) for 1..$count;
}

rule et_cetera :w { forever | ad nauseum | etc | et cetera }
sub repeat is multi ($desc is valued(//),  &body) {
body($_) for 1..Inf;
}

# and then...

repeat 2 { print "cha" }
repeat 'forever' { print "ha" }
repeat $count { print "ha" }

And, of course, the C property would smart-match its value
against the corrresponding argument, so one could also code optimized
variants like:

sub repeat is multi ($desc is valued(1),  &body) {
body(1);
}

sub repeat is multi ($desc is valued(0),  &body) {
}

sub repeat is multi ($desc is valued(['A'..'F']),  &body) {
die "Can't repeat hexadecimally";
}

Come to think of it, maybe the property name probably should be C.


> I don't particularly like the old map and grep syntax.

Recently someone suggested to me (sorry, whoever it was, my memory
is still in anyother timezone) that, since C returns a value:

$val = given $digit {
case [0..9] { $_ }
case ['A'..'F'] { 10+ord($_)-ord('A') }
default { undef }
};

then maybe the other control structues should as well:

@squares = map { $_**2 } @nums;

@squares = for @nums { $_**2 };

Of course, this example is trivially done with a hyperoperation:

@ squares = @nums ^** 2;

But more complex examples could easily be constructed where even C
looks clunky and a list context C would be a nice solution.

It would also solve the problem of early escape:

@smallsquares = for @nums { last if $_ > 10; $_**2 };


Damian





Re: backtracking into { code }

2002-08-29 Thread Damian Conway

Ken Fox wrote:

> A question: Do rules matched in a { code } block set backtrack points for
> the outer rule? 

I don't believe so. From A5:

A pattern nested within a closure is classified as its own rule,
however, so it never gets the chance to pass out of a {...} closure.

Indeed, to get a rule in a closure to even continue matching from the same
point in the string, you would need to write:


rule expr1 {
 { m:cont/@operators/ or fail } 
}

Backtracking would just step back over the rule as if it were atomic
(or followed by a colon).

Damian