[perl #55590] [PATCH] [CAGE] Fix unix socket problems and warnings, some const issues, and avoid generating some empty code.
# New Ticket Created by NotFound # Please include the string: [perl #55590] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=55590 > This patch solves the casting problems that breaks or generates warnings in src/io/io_unix.c allowing clean compiling with C or C++, with or without --optimize. Also drops the const in argv in several main and main-alike functions, that can generate warnings or force const castings. And also changes lib/Parrot/Pmc2c/PMCEmitter.pm to avoid generating an empty class init block and to add a block around a mro initialization that declares a variable. -- Salu2 Index: src/pdb.c === --- src/pdb.c (revisión: 28225) +++ src/pdb.c (copia de trabajo) @@ -111,7 +111,7 @@ #include "parrot/embed.h" static void PDB_printwelcome(void); -static void PDB_run_code(Parrot_Interp interp, int argc, const char *argv[]); +static void PDB_run_code(Parrot_Interp interp, int argc, char *argv[]); /* @@ -127,7 +127,7 @@ extern void imcc_init(Parrot_Interp interp); int -main(int argc, const char *argv[]) +main(int argc, char *argv[]) { Parrot_Interp debugger = Parrot_new(NULL); Parrot_Interp interp = Parrot_new(debugger); @@ -214,7 +214,7 @@ */ static void -PDB_run_code(Parrot_Interp interp, int argc, const char *argv[]) +PDB_run_code(Parrot_Interp interp, int argc, char *argv[]) { Parrot_exception exp; Index: src/embed.c === --- src/embed.c (revisión: 28225) +++ src/embed.c (copia de trabajo) @@ -49,7 +49,7 @@ __attribute__nonnull__(1); PARROT_CANNOT_RETURN_NULL -static PMC* setup_argv(PARROT_INTERP, int argc, ARGIN(const char **argv)) +static PMC* setup_argv(PARROT_INTERP, int argc, ARGIN(char **argv)) __attribute__nonnull__(1) __attribute__nonnull__(3); @@ -563,7 +563,7 @@ PARROT_CANNOT_RETURN_NULL static PMC* -setup_argv(PARROT_INTERP, int argc, ARGIN(const char **argv)) +setup_argv(PARROT_INTERP, int argc, ARGIN(char **argv)) { INTVAL i; PMC *userargv; @@ -860,7 +860,7 @@ PARROT_API void -Parrot_runcode(PARROT_INTERP, int argc, ARGIN(const char **argv)) +Parrot_runcode(PARROT_INTERP, int argc, ARGIN(char **argv)) { PMC *userargv, *main_sub; Index: src/main.c === --- src/main.c (revisión: 28225) +++ src/main.c (copia de trabajo) @@ -36,7 +36,7 @@ */ int -main(int argc, const char * argv[]) +main(int argc, char * argv[]) { const char *sourcefile; Interp *interp; Index: src/io/io_unix.c === --- src/io/io_unix.c (revisión: 28225) +++ src/io/io_unix.c (copia de trabajo) @@ -825,12 +825,13 @@ PIO_unix_connect(SHIM_INTERP, SHIM(ParrotIOLayer *layer), ARGMOD(ParrotIO *io), ARGIN_NULLOK(STRING *r)) { +struct sockaddr_in * saddr = & io->remote; if (r) { memcpy(&io->remote, PObj_bufstart(r), sizeof (struct sockaddr_in)); } AGAIN: -if ((connect(io->fd, (const struct sockaddr_in *)&io->remote, -sizeof (struct sockaddr_in))) != 0) { +if ((connect(io->fd, (struct sockaddr *) saddr, +sizeof (struct sockaddr_in))) != 0) { switch (errno) { case EINTR: goto AGAIN; @@ -860,12 +861,13 @@ PIO_unix_bind(SHIM_INTERP, SHIM(ParrotIOLayer *layer), ARGMOD(ParrotIO *io), ARGMOD(STRING *l)) { +struct sockaddr_in * saddr = & io->local; if (!l) return -1; memcpy(&io->local, PObj_bufstart(l), sizeof (struct sockaddr_in)); -if ((bind(io->fd, (const struct sockaddr_in *)&io->local, +if ((bind(io->fd, (struct sockaddr *) saddr, sizeof (struct sockaddr_in))) == -1) { return -1; } @@ -912,8 +914,9 @@ ParrotIO * const newio = PIO_new(interp, PIO_F_SOCKET, 0, PIO_F_READ|PIO_F_WRITE); Parrot_Socklen_t addrlen = sizeof (struct sockaddr_in); +struct sockaddr_in * saddr = & newio->remote; const intnewsock = accept(io->fd, -(struct sockaddr_in *)&newio->remote, &addrlen); +(struct sockaddr *)saddr, &addrlen); if (newsock == -1) { mem_sys_free(newio); Index: tools/dev/pbc_to_exe_gen.pl === --- tools/dev/pbc_to_exe_gen.pl (revisión: 28225) +++ tools/dev/pbc_to_exe_gen.pl (copia de trabajo) @@ -194,7 +194,7 @@ .sub 'body' $S0 = <<'END_BODY' -int main(int argc, const char *argv[]) +int main(int argc, char *argv[]) { PackFile *pf; Parrot_Interp interp; Index: lib/Parrot/Pmc2c/PMCEmitter.pm === --- lib/Parrot/Pmc2c/PMCEmitter.pm (revisión: 28225) +++ lib/Parrot/Pmc2c/PMCEmitter.pm (cop
Re: [perl #52894] [CAGE] use more File::Temp to avoid permission issues
> Well, if I had RTFM 'perldoc File::Temp' correctly, I wouldn't have > gotten the arguments wrong. > > Sorry for the confusion. > Sometimes, you just have to explain it to the bear before you understand. :-)* -- Email and shopping with the feelgood factor! 55% of income to good causes. http://www.ippimail.com
Re: [perl #55566] [BUG] Configure.pl dies on gnu/hurd
On Tue, Jun 10, 2008 at 06:00:39AM -0700, Will Coleda via RT wrote: > Interesting. I tried to duplicate this error by removing my platform's > hints file and re-running. I get the message you describe, but then > Configure.pl completes, and at the -end-, gracefully says: > > During configuration the following steps failed: > 01: init::manifest > 05: init::hints > You should diagnose and fix these errors before calling 'make' > > Did you get this far, or did Configure.pl just stop completely for you > where your log cuts off? That was the end. The next line was a prompt. > Now, the desired behavior here IMO should be that if we can't find a > hints file for your platform... the build should continue with no > problems or warnings, except that perhaps in verbose mode we say > something like "no hints file, assuming defaults.". That sounds reasonable. > The offending line is in config/init/hints.pm, where we say: > > eval "use $hints"; > die $@ if $@; > > We should probably first check to see if the file exists before running > the use statement; then the die is only because of invalid perl, not > "file not found." > > Your workaround, btw, is probably: > > touch config/init/hints/hurd.pm I'll try this when I get home. > Thanks for the report, I'm interested to see how we do here once we get > past this small config bump. Well, that's what I thought: "Hmm, I've got this new Hurd install, I wonder if parrot will run on it." This is definitely just an experiment. Kind of uber-geek if we get it working, though. -kolibrie signature.asc Description: Digital signature
[perl #55594] Modify parser to allow empty semicolon ';' terminated statement
# New Ticket Created by Ron Schmidt # Please include the string: [perl #55594] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=55594 > Perl 5 allows empty semicolon terminated statements. perl6 currently allows for empty closures but treats a semicolon that follows nothing or whitespace as a syntax error. The attached patch to grammar.pg provides a fix for this discrepancy between perl 5 and perl 6. Also attached is an attempt at a test suite for some statement termination cases. The patch is small and passes "make fulltest" under ubuntu and "make spectest", as well as the parts of "make test" in the perl6 directory, under cygwin. Modifying statementlist this way does not appear to be the most elegant solution to the problem but approaches like [?<.eat_terminator> ]* seemed to fail with relatively serious errors. The terminator.t test file is vaguely intended for the t/spec/S04-statements/ directory. Index: t/spectest_regression.data === --- t/spectest_regression.data (revision 28227) +++ t/spectest_regression.data (working copy) @@ -15,6 +15,7 @@ S03-operators/not.t # pure S03-operators/relational.t # pure S03-operators/true.t# pure +S04-statements/terminator.t # pure S04-statements/try.t S04-statements/until.t # pure S04-statements/while.t Index: src/parser/grammar.pg === --- src/parser/grammar.pg (revision 28227) +++ src/parser/grammar.pg (working copy) @@ -151,8 +151,10 @@ rule statementlist { -[<.eat_terminator> ]* -{*} +| [ +|| ';' +|| <.eat_terminator> +]*{*} } ## The eat_terminator detects when we're at a valid use v6; use Test; plan 9; # L # the 'empty statement' case responsible for the creation of this test file eval_lives_ok(';', 'empty statement'); eval_lives_ok('my $x = 2', 'simple statement no semi'); eval_lives_ok('my $x = 9', 'simple statement on two lines no semi'); eval_lives_ok('my $x = 2;', 'simple statement with semi'); eval_lives_ok('{my $x = 2}', 'end of closure terminator'); eval_lives_ok('{my $x = 2;}', 'double terminator'); eval_lives_ok(';my $x = 2;{my $x = 2;;};', 'extra terminators'); eval_dies_ok('{my $x = 2;', 'open closure'); eval_dies_ok('my $x = ', 'incomplete expression');
Re: [perl #55566] [BUG] Configure.pl dies on gnu/hurd
On Tue, Jun 10, 2008 at 06:00:39AM -0700, Will Coleda via RT wrote: > Your workaround, btw, is probably: > > touch config/init/hints/hurd.pm That actually complained about a non-true value. The correct incantation turned out to be: echo '1;' > config/init/hints/gnu.pm The Configure.pl step was successful after that. The make step was also successful, though it stopped a few times for errors like: make[1]: Entering directory `/home/kolibrie/src/parrot/src/dynpmc' perl /home/kolibrie/src/parrot/tools/build/pmc2c.pl --dump dynlexpad.pmc Writing src/pmc/default.dump: No such file or directory pmc2c dump failed (512) make[1]: *** [all] Error 2 make[1]: Leaving directory `/home/kolibrie/src/parrot/src/dynpmc' make: *** [dynpmc.dummy] Error 2 Each time I just started make again, and eventually it finished (this is on a very slow box). Right now I'm running make test, and it seems to be doing okay. It might finish by the time I get home from work. I'll try out the patch from James Keenan after the make test finishes. -kolibrie signature.asc Description: Digital signature
Re: [perl #55594] Modify parser to allow empty semicolon ';' terminated statement
On Tue, Jun 10, 2008 at 01:07:45PM -0700, Ron Schmidt wrote: > Perl 5 allows empty semicolon terminated statements. perl6 currently > allows for empty closures but treats a semicolon that follows nothing or > whitespace as a syntax error. The attached patch to grammar.pg provides > a fix for this discrepancy between perl 5 and perl 6. Also attached is > an attempt at a test suite for some statement termination cases. > > The patch is small and passes "make fulltest" under ubuntu and "make > spectest", as well as the parts of "make test" in the perl6 directory, > under cygwin. Modifying statementlist this way does not appear to be > the most elegant solution to the problem but approaches like > [?<.eat_terminator> ]* seemed to fail with relatively serious > errors. Thanks for the patch. In cases of changes to the grammar, however, we're trying to keep Rakudo's grammar as closely aligned to STD.pm as we can -- here's STD.pm's definition for statementlist (line ~570): rule statementlist { :my StrPos $endstmt is context = -1; [<.eat_terminator> ]* {*} } So, since Rakudo's current grammar pretty much matches what STD.pm has here, I'd prefer that we figure out how STD.pm is handling empty statements and do that. Thanks again! Pm
[svn:perl6-synopsis] r14547 - doc/trunk/design/syn
Author: larry Date: Wed Jun 11 14:09:40 2008 New Revision: 14547 Modified: doc/trunk/design/syn/S03.pod Log: change most left-associative short-circuit ops to list-associative x and xx are now left associative define what associativity means for unary ops Modified: doc/trunk/design/syn/S03.pod == --- doc/trunk/design/syn/S03.pod(original) +++ doc/trunk/design/syn/S03.podWed Jun 11 14:09:40 2008 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 8 Mar 2004 - Last Modified: 2 Apr 2008 + Last Modified: 11 Jun 2008 Number: 3 - Version: 135 + Version: 136 =head1 Overview @@ -36,36 +36,46 @@ L Symbolic unary! + - ~ ? | +^ ~^ ?^ \ ^ = L Multiplicative* / % +& +< +> ~& ~< ~> ?& div mod L Additive + - +| +^ ~| ~^ ?| ?^ -N Replication x xx -L Concatenation ~ +L Replication x xx +X Concatenation ~ X Junctive and & X Junctive or | ^ L Named unary sleep abs sin N Nonchaining infix but does <=> leg cmp .. ..^ ^.. ^..^ C Chaining infix!= == < <= > >= eq ne lt le gt ge ~~ === eqv !eqv -L Tight and && -L Tight or || ^^ // min max +X Tight and && +X Tight or || ^^ // min max L Conditional ?? !! ff fff R Item assignment = := ::= => += -= **= xx= .= L Loose unary true not X Comma operator, p5=> X List infixZ minmax X X~X X*X XeqvX R List prefix : print push say die map substr ... [+] [*] any $ @ -L Loose and and andthen -L Loose or or xor orelse +X Loose and and andthen +X Loose or or xor orelse N Terminator; <==, ==>, <<==, ==>>, {...}, unless, extra ), ], } -The associativities specified above are: +Using two C symbols below generically to represent any pair of operators +that have the same precedence, the associativities specified above +for binary operators are interpreted as follows: -Assoc Meaning of $a op $b op $c +Assoc Meaning of $a ! $b ! $c = = -L left ($a op $b) op $c -R right $a op ($b op $c) +L left ($a ! $b) ! $c +R right $a ! ($b ! $c) N non ILLEGAL -C chain ($a op $b) and ($b op $c) -X list op($a, $b, $c) or op($a; $b; $c) +C chain ($a ! $b) and ($b ! $c) +X list infix:($a; $b; $c) -Note that list associativity only works between identical operators. +For unaries this is interpreted as: + +Assoc Meaning of !$a! += = +L left (!$a)! +R right !($a!) +N non ILLEGAL + +Note that list associativity (X) only works between identical operators. If two different list-associative operators have the same precedence, they are assumed to be left-associative with respect to each other. For example, the C cross operator and the C zip operator both @@ -77,6 +87,9 @@ (@a X @b) Z @c +Similarly, if the only implementation of a list-associative operator +is binary, it will be treated as left associative. + If you don't see your favorite operator above, the following sections cover all the operators in precedence order. Basic operator descriptions are here; special topics are covered afterwards. @@ -659,7 +672,7 @@ ^$limit -Constructs a range of C<0..^$limit> or locates a metaclass as a shortcut +Constructs a range of C<0 ..^ $limit> or locates a metaclass as a shortcut for C<$limit.HOW>. See L. =item * @@ -932,7 +945,7 @@ C<< infix:<&> >>, all() operator -$x & $y +$a & $b & $c ... =back @@ -944,13 +957,13 @@ C<< infix:<|> >>, any() operator -$x | $y +$a | $b | $c ... =item * C<< infix:<^> >>, one() operator -$x ^ $y +$a ^ $b ^ $c ... =back @@ -1042,6 +1055,11 @@ Constructs Range objects, optionally excluding one or both endpoints. See L. +Note that these differ: + +$min ..^ $max $ min .. $max-1 +$min .. ^$max # $min .. (0..$max-1) + =back =head2 Chaining binary precedence @@ -1145,10 +1163,10 @@ C<< infix:<&&> >>, short-circuit and -$condition && $whentrue +$a && $b && $c ... -Returns the left argument if the left argument is false, otherwise -evaluates and returns the right argument. In list context forces +Returns the first argument that evaluates to false, otherwise +returns the result of the last argument. In list context forces a false return to mean C<()>. See C below for low-precedence version. @@ -1160,13 +1178,14 @@ =item * -C<< infix:<||> >>, short-circuiting inclusive-or +C<< infix:<||> >>, short-circuit inclusive-or -$condition || $whenfalse +$a || $b || $c ... -Returns the left argu
#parrotsketch next week...
... is cancelled, too many of us are going to be at YAPC::NA. See everyone there, or at #parrotsketch in two weeks. -- Will "Coke" Coleda
Re: [svn:perl6-synopsis] r14547 - doc/trunk/design/syn
On Wed, Jun 11, 2008 at 02:09:41PM -0700, [EMAIL PROTECTED] wrote: > +Note that these differ: > + > +$min ..^ $max$ min .. $max-1 > +$min .. ^$max# $min .. (0..$max-1) The punctuation looks a little funny on the first line. Also, are $min ..^ $max and $min .. $max-1 really the same range? I'm a little curious about the second line, is that even legal? It seems to me a Range should only allow itself to be constructed from endpoints with a well-defined ordering, so a Range of Ranges should be illegal. Or does the .. end up pulling a num out of the ^$max range iterator for its endpoint somehow via MMD? -ryan
[perl #55620] [PATCH] Fix crash in src/ops/object.ops
# New Ticket Created by Vasily Chekalkin # Please include the string: [perl #55620] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=55620 > Hello. Trivial reproducible bug: in rakudo 'say 1 ~~ Perl6Scalar'. There is patch for src/ops/object.ops -- Bacek. diff --git a/src/ops/object.ops b/src/ops/object.ops index e70b454..8f07a12 100644 --- a/src/ops/object.ops +++ b/src/ops/object.ops @@ -106,9 +106,15 @@ if (PMC_IS_NULL(method_pmc)) { -real_exception(interp, next, METH_NOT_FOUND, -"Method '%Ss' not found for invocant of class '%Ss'", meth, -VTABLE_get_string(interp, VTABLE_get_class(interp, object))); +PMC * const _class = VTABLE_get_class(interp, object); + +if (PMC_IS_NULL(_class)) +real_exception(interp, next, METH_NOT_FOUND, +"Method '%Ss' not found for non-object", meth); +else +real_exception(interp, next, METH_NOT_FOUND, +"Method '%Ss' not found for invocant of class '%Ss'", meth, +VTABLE_get_string(interp, _class)); } interp->current_object = object; interp->current_cont = $3; @@ -138,9 +144,15 @@ opcode_t *dest; if (PMC_IS_NULL(method_pmc)) { -real_exception(interp, next, METH_NOT_FOUND, -"Method '%Ss' not found for invocant of class '%Ss'", meth, -VTABLE_get_string(interp, VTABLE_get_class(interp, object))); +PMC * const _class = VTABLE_get_class(interp, object); + +if (PMC_IS_NULL(_class)) +real_exception(interp, next, METH_NOT_FOUND, +"Method '%Ss' not found for non-object", meth); +else +real_exception(interp, next, METH_NOT_FOUND, +"Method '%Ss' not found for invocant of class '%Ss'", meth, +VTABLE_get_string(interp, _class)); } interp->current_cont = CONTEXT(interp)->current_cont; PObj_get_FLAGS(interp->current_cont) |= SUB_FLAG_TAILCALL;
S12 Patch for metacalls, Representation API (Was: Re: Foo.HOW.metamethod vs Foo.^metamethod)
Seg, 2008-06-09 às 17:51 -0700, Larry Wall escreveu: > On Sat, Jun 07, 2008 at 09:49:03PM +0100, Daniel Ruoso wrote: > : 2) Assume the capture-translation and define that > : $foo.HOW.can($foo,'bar') keeps the $how as the invocant and must receive > : the referring object as first argument. > I prefer this approach, I think. I took the liberty to write a patch to S12 with this new context. The extended format $foo.HOW.methods($foo) becomes a little awkward, specially for Class based OO. Maybe there should be a more extended modification to promote the .^methods syntax, since $foo.HOW is then more usefull for prototype-based OO, where $foo.HOW might be, for instance, Prototype::Delegation::C3 or Prototype::Concatenation. This actually brings me to another issue, which is how much do we expect for this prototype-based meta implementations to be exchangeable between Perl 6 implementations? The point is that they *must* be representation independent, so that you can use it with whatever low-level object metainstance (in the Moose jargon) you like, and for that to be possible, we need a representation API. SMOP is already pointing in that direction, take a look at: * http://www.perlfoundation.org/perl6/index.cgi?smop_oo_api * http://svn.pugscode.org/pugs/v6/smop/src-s1p/P6Meta.pm daniel __DATA__ Index: S12.pod === --- S12.pod (revision 14546) +++ S12.pod (working copy) @@ -123,11 +123,15 @@ C method. A "class" object is just considered an "empty" instance in Perl 6, more properly called a "prototype" object, or just "protoobject". -The actual class object is the metaclass object pointed to by the -C syntax. So when you say "C", you're referring to both a -package and a protoobject, that latter of which points to the -actual object representing the class via C. The protoobject -differs from an instance object not by having a different + +In a class-based OO implementation, the actual class object is the +metaclass object pointed to by the C syntax. So when you say +"C", you're referring to both a package and a protoobject, that +latter of which points to the actual object representing the class via +C. In a prototype-based OO implementation, on the other hand, the +metaclass object is probably going to be shared by several types and +the methods are most likely going to be stored in the prototypes. The +protoobject differs from an instance object not by having a different type but rather in the extent to which it is defined. Some objects may tell you that they are defined, while others may tell you that they are undefined. That's up to the object, and depends on how the @@ -1892,23 +1896,29 @@ $x === $y $obj.bless(%args) -Every class has a C function/method that lets you get at the -class's metaobject, which lets you get at all the metadata properties -for the class (or other metaobject protocol) implementing the objects -of the class: +Every object, defined or not, has a C function/method that lets +you get at the metaobject, which lets you get at all the metadata +properties for the type (or other metaobject protocol) implementing +the objects of the type: -MyClass.methods() # call MyClass's .methods method (error?) -MyClass.HOW.methods() # get the method list of MyClass +MyClass.methods()# call MyClass's .methods method (error?) +MyClass.HOW.methods(MyClass) # get the method list of MyClass The C<^> metasyntax is equivalent to C<.HOW>: -MyClass.HOW.methods() # get the method list of MyClass -^MyClass.methods() # get the method list of MyClass -MyClass.^methods() # get the method list of MyClass +MyClass.HOW.methods(MyClass) # get the method list of MyClass +^MyClass.methods(MyClass) -Each object of the class also has a C<.HOW> or C<.^> method: +When using the C<^> metasyntax in the method invocation, it also +implies a translation in the capture, passing the invocant as first +argument: -$obj.HOW.methods(); +MyClass.HOW.methods(MyClass) # get the method list of MyClass +MyClass.^methods() # equivalent shorter syntax + +Each object of the type also has a C<.HOW> or C<.^> method: + +$obj.HOW.methods($obj); $obj.^methods(); Class traits may include: @@ -1964,9 +1974,9 @@ Strictly speaking, metamethods like C<.isa()>, C<.does()>, and C<.can()> should be called through the meta object: -$obj.HOW.can("bark") -$obj.HOW.does(Dog) -$obj.HOW.isa(Mammal) +$obj.HOW.can($obj, "bark") +$obj.HOW.does($obj, Dog) +$obj.HOW.isa($obj, Mammal) or @@ -1992,7 +2002,7 @@ actually calls: -$obj.HOW.does(Dog) +$obj.HOW.does($obj, Dog) which is true if C<$obj> either "does" or "isa" C (or "isa" something that "does" C). If C is a subset, any additional
[perl #55620] [PATCH] Fix crash in src/ops/object.ops
Another attempt: this is a minimalistic change that does not broke any test in parrot nor in rakudo, and can avoid segfaulting in other related usages. Index: src/pmc/namespace.pmc === --- src/pmc/namespace.pmc (revisión: 28239) +++ src/pmc/namespace.pmc (copia de trabajo) @@ -74,6 +74,7 @@ PMC_data(SELF) = mem_allocate_zeroed_typed(Parrot_NameSpace); PARROT_NAMESPACE(SELF)->vtable = PMCNULL; +PARROT_NAMESPACE(SELF)->_class = PMCNULL; } /*
[perl #55640] [BUG] [PATCH] oo_get_class segfaults
# New Ticket Created by NotFound # Please include the string: [perl #55640] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=55640 > I've found a bug in oo_get_class, it segfaults when calling pmc_type with a NULL STIRNG * This short pir code shows the problem: .sub main $P0= get_root_namespace $P1= get_class $P0 .end The attached patch fixes it. -- Salu2 Index: src/oo.c === --- src/oo.c (revisión: 28239) +++ src/oo.c (copia de trabajo) @@ -236,15 +236,21 @@ if (PMC_IS_NULL(classobj)) { /* Look up a low-level class and create a proxy */ -const INTVAL type = pmc_type(interp, VTABLE_get_string(interp, key)); - -/* Reject invalid type numbers */ -if (type > interp->n_vtable_max || type <= 0) +STRING * tname = VTABLE_get_string(interp, key); +if (! tname) { return PMCNULL; +} else { - PMC * const type_num = pmc_new(interp, enum_class_Integer); - VTABLE_set_integer_native(interp, type_num, type); - classobj = pmc_new_init(interp, enum_class_PMCProxy, type_num); +const INTVAL type = pmc_type(interp, tname); + +/* Reject invalid type numbers */ +if (type > interp->n_vtable_max || type <= 0) +return PMCNULL; +else { + PMC * const type_num = pmc_new(interp, enum_class_Integer); + VTABLE_set_integer_native(interp, type_num, type); + classobj = pmc_new_init(interp, enum_class_PMCProxy, type_num); +} } }
[perl #55620] [PATCH] Fix crash in src/ops/object.ops
On Mie. Jun. 11 06:48:06 2008, bacek wrote: > Trivial reproducible bug: in rakudo 'say 1 ~~ Perl6Scalar'. > > There is patch for src/ops/object.ops I tried another way: less checks, not more. See attached patch. $ ./perl6 -e'say 1 ~~ Perl6Scalar' Null PMC access in invoke() current instr.: 'infix:~~' pc 8890 (src/gen_builtins.pir:5982) called from Sub '_block11' pc 44 (EVAL_12:21) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 783 (src/PCT/HLLCompiler.pir:458) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1282 (src/PCT/HLLCompiler.pir:685) called from Sub 'parrot;Perl6::Compiler;main' pc 11068 (perl6.pir:186) Index: src/ops/object.ops === --- src/ops/object.ops (revisión: 28239) +++ src/ops/object.ops (copia de trabajo) @@ -61,18 +61,6 @@ opcode_t *dest = NULL; interp->current_args= current_args; - if (PMC_IS_NULL(method_pmc)) { -PMC * const _class = VTABLE_get_class(interp, object); - -if (PMC_IS_NULL(_class)) -real_exception(interp, next, METH_NOT_FOUND, -"Method '%Ss' not found for non-object", meth); -else -real_exception(interp, next, METH_NOT_FOUND, -"Method '%Ss' not found for invocant of class '%Ss'", meth, -VTABLE_get_string(interp, _class)); - } - interp->current_object = object; interp->current_cont = NEED_CONTINUATION; dest = VTABLE_invoke(interp, method_pmc, next); @@ -104,12 +92,6 @@ opcode_t *dest = NULL; interp->current_args= current_args; - - if (PMC_IS_NULL(method_pmc)) { -real_exception(interp, next, METH_NOT_FOUND, -"Method '%Ss' not found for invocant of class '%Ss'", meth, -VTABLE_get_string(interp, VTABLE_get_class(interp, object))); - } interp->current_object = object; interp->current_cont = $3; dest = (opcode_t *)VTABLE_invoke(interp, method_pmc, next); @@ -137,11 +119,6 @@ opcode_t *dest; - if (PMC_IS_NULL(method_pmc)) { -real_exception(interp, next, METH_NOT_FOUND, -"Method '%Ss' not found for invocant of class '%Ss'", meth, -VTABLE_get_string(interp, VTABLE_get_class(interp, object))); - } interp->current_cont = CONTEXT(interp)->current_cont; PObj_get_FLAGS(interp->current_cont) |= SUB_FLAG_TAILCALL; interp->current_object = object;
Re: [perl #55620] [PATCH] Fix crash in src/ops/object.ops
On Wednesday 11 June 2008 12:48:51 NotFound via RT wrote: > Another attempt: this is a minimalistic change that does not broke any > test in parrot nor in rakudo, and can avoid segfaulting in other related > usages. This one is my favorite too. -- c
Re: [perl #55640] [BUG] [PATCH] oo_get_class segfaults
On Wednesday 11 June 2008 14:44:34 NotFound wrote: > I've found a bug in oo_get_class, it segfaults when calling pmc_type > with a NULL STIRNG * > > This short pir code shows the problem: > > .sub main > $P0= get_root_namespace > $P1= get_class $P0 > .end > > The attached patch fixes it. What's it look like when patching pmc_type to deal with NULL STRING *? I'm not saying that's the best option; I'm just looking at the alternatives. -- c
[svn:perl6-synopsis] r14548 - doc/trunk/design/syn
Author: larry Date: Wed Jun 11 16:26:27 2008 New Revision: 14548 Modified: doc/trunk/design/syn/S03.pod Log: clarification of reduced short-circuit ops Modified: doc/trunk/design/syn/S03.pod == --- doc/trunk/design/syn/S03.pod(original) +++ doc/trunk/design/syn/S03.podWed Jun 11 16:26:27 2008 @@ -1203,8 +1203,15 @@ is true. In list context forces a false return to mean C<()>. See C below for low-precedence version. -Similar to the C<[^^]> reduce operator, but short-circuits in the sense -that it does not evaluate any arguments after a 2nd true result. +This operator short-circuits in the sense that it does not evaluate +any arguments after a 2nd true result. Closely related is the reduce +operator: + +[^^] a(), b(), c() ... + +but note that reduce operators are not macros but ordinary list +operators, so c() is always called before the reduce is done. + =item * @@ -1704,7 +1711,7 @@ [+] [*] [<] [\+] [\*] etc. -See L. +See L below. =item * @@ -3486,7 +3493,7 @@ [-] 4, 3, 2; # 4-3-2 = (4-3)-2 = -1 [**] 4, 3, 2; # 4**3**2 = 4**(3**2) = 262144 -For list-associating operators (like C<< < >>), all arguments are taken +For chain-associative operators (like C<< < >>), all arguments are taken together, just as if you had written it out explicitly: [<] 1, 3, 5; # 1 < 3 < 5 @@ -3635,6 +3642,15 @@ (And, in fact, the latter are already easy to express anyway, and more obviously nonsensical.) +Similarly, list-associative operators that have the thunk-izing characteristics of +macros (such as short-circuit operators) lose those macro-like characteristics. +You can say + +[||] a(), b(), c(), d() + +to return the first true result, but the evaluation of the list is controlled +by the semantics of the list, not the semantics of C<||>. + Most reduce operators return a simple scalar value, and hence do not care whether they are evaluated in item or list context. However, as with other list operators and functions, a reduce operator may return a list
[svn:perl6-synopsis] r14549 - doc/trunk/design/syn
Author: larry Date: Wed Jun 11 16:49:17 2008 New Revision: 14549 Modified: doc/trunk/design/syn/S03.pod Log: Fixes suggested by Ryan++ Modified: doc/trunk/design/syn/S03.pod == --- doc/trunk/design/syn/S03.pod(original) +++ doc/trunk/design/syn/S03.podWed Jun 11 16:49:17 2008 @@ -1057,8 +1057,11 @@ Note that these differ: -$min ..^ $max $ min .. $max-1 -$min .. ^$max # $min .. (0..$max-1) +0 ..^ 10 # 0 .. 9 +0 .. ^10 # 0 .. (0..9) + +(It's not yet clear what the second one should mean, but whether it +succeeds or fails, it won't do what you want.) =back
Re: [perl #55640] [BUG] [PATCH] oo_get_class segfaults
On Thu, Jun 12, 2008 at 1:23 AM, chromatic <[EMAIL PROTECTED]> wrote: > What's it look like when patching pmc_type to deal with NULL STRING *? I'm > not saying that's the best option; I'm just looking at the alternatives. We must change his signature to do that. I tried the mininal change. -- Salu2
Re: [svn:perl6-synopsis] r14549 - doc/trunk/design/syn
On Wed, Jun 11, 2008 at 04:49:18PM -0700, [EMAIL PROTECTED] wrote: > -$min ..^ $max$ min .. $max-1 > -$min .. ^$max# $min .. (0..$max-1) > +0 ..^ 10 # 0 .. 9 > +0 .. ^10 # 0 .. (0..9) Ah, I should have been more specific - I meant that, since ~~ treats Ranges as continuous intervals, 0 ..^ 10 isn't the same as 0 .. 9. Although I guess there's no way to unabbreviate 0 ..^ 10... -ryan
Re: [svn:perl6-synopsis] r14549 - doc/trunk/design/syn
On Wed, Jun 11, 2008 at 08:20:41PM -0400, Ryan Richter wrote: : On Wed, Jun 11, 2008 at 04:49:18PM -0700, [EMAIL PROTECTED] wrote: : > -$min ..^ $max $ min .. $max-1 : > -$min .. ^$max # $min .. (0..$max-1) : > +0 ..^ 10 # 0 .. 9 : > +0 .. ^10 # 0 .. (0..9) : : Ah, I should have been more specific - I meant that, since ~~ treats : Ranges as continuous intervals, 0 ..^ 10 isn't the same as 0 .. 9. : Although I guess there's no way to unabbreviate 0 ..^ 10... Well, maybe 0 .. 10-ε or some such. Larry
[svn:perl6-synopsis] r14550 - doc/trunk/design/syn
Author: larry Date: Wed Jun 11 17:34:50 2008 New Revision: 14550 Modified: doc/trunk/design/syn/S05.pod Log: fixed "samebase" illogic pointed out by moritz++ Modified: doc/trunk/design/syn/S05.pod == --- doc/trunk/design/syn/S05.pod(original) +++ doc/trunk/design/syn/S05.podWed Jun 11 17:34:50 2008 @@ -14,9 +14,9 @@ Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and Larry Wall <[EMAIL PROTECTED]> Date: 24 Jun 2002 - Last Modified: 18 May 2008 + Last Modified: 11 Jun 2008 Number: 5 - Version: 79 + Version: 80 This document summarizes Apocalypse 5, which is about the new regex syntax. We now try to call them I rather than "regular @@ -181,7 +181,7 @@ The single-character modifiers also have longer versions: :i:ignorecase - :b:basechar + :a:ignoreaccent :g:global =item * @@ -227,7 +227,7 @@ =item * -The C<:b> (or C<:basechar>) modifier scopes exactly like C<:ignorecase> +The C<:a> (or C<:ignoreaccent>) modifier scopes exactly like C<:ignorecase> except that it ignores accents instead of case. It is equivalent to taking each grapheme (in both target and pattern), converting both to NFD (maximally decomposed) and then comparing the two base @@ -237,7 +237,7 @@ includes all ignored characters, including any that follow the final base character. -The C<:bb> (or C<:samebase>) variant may be used on a substitution to change the +The C<:aa> (or C<:sameaccent>) variant may be used on a substitution to change the substituted string to the same accent pattern as the matched string. Accent info is carried across on a character by character basis. If the right string is longer than the left one, the remaining characters @@ -968,8 +968,8 @@ unless it happens to be a C object, in which case it is matched as a subrule. As with scalar subrules, a tainted subrule always fails. All string values pay attention to the current C<:ignorecase> -and C<:basechar> settings, while C values use their own -C<:ignorecase> and C<:basechar> settings. +and C<:ignoreaccent> settings, while C values use their own +C<:ignorecase> and C<:ignoreaccent> settings. When you get tired of writing: @@ -1069,7 +1069,7 @@ =back All hash keys, and values that are strings, pay attention to the -C<:ignorecase> and C<:basechar> settings. (Subrules maintain their +C<:ignorecase> and C<:ignoreaccent> settings. (Subrules maintain their own case settings.) You may combine multiple hashes under the same longest-token
[svn:perl6-synopsis] r14551 - doc/trunk/design/syn
Author: larry Date: Wed Jun 11 17:53:27 2008 New Revision: 14551 Modified: doc/trunk/design/syn/S05.pod Log: added <...> et al. as suggested by ruoso++ Modified: doc/trunk/design/syn/S05.pod == --- doc/trunk/design/syn/S05.pod(original) +++ doc/trunk/design/syn/S05.podWed Jun 11 17:53:27 2008 @@ -16,7 +16,7 @@ Date: 24 Jun 2002 Last Modified: 11 Jun 2008 Number: 5 - Version: 80 + Version: 81 This document summarizes Apocalypse 5, which is about the new regex syntax. We now try to call them I rather than "regular @@ -1410,6 +1410,15 @@ =item * +The C<< <...> >>, C<< >>, and C<< >> special tokens +have the same "not-defined-yet" meanings within regexes that the bare +elipses have in ordinary code. (However, by the recursive rules above, +C<< >> is equivalent to C<< >>, which matches the null string. +Likewise C<< >> is just like C<< >>, except +that it is ignored by the longest-token matcher.) + +=item * + A leading C<*> indicates that the following pattern allows a partial match. It always succeeds after matching as many characters as possible. (It is not zero-width unless 0 characters match.)
[perl #43857] [TODO] Refactor config probes that are used only by language implementation
On Fri Jul 13 09:58:33 2007, bernhard wrote: > There are several config probes that are only used for language > implementations. > Examples are config/auto/m4.pm and config/auto/python.pm. > > In order to improve the seperation of concerns, these probes should be > moved to a > separate directory. > The Python part of this ticket was completed in r53600. kid51
[perl #43148] [TODO] Rename rpath hash element to be more general (config/init/hints/darwin.pm)
It appears that this ticket was re-opened after some RT bookkeeping problems, but there doesn't appear to be any reason to keep it open. Am resolving it once again.
Re: [perl #55590] [PATCH] [CAGE] Fix unix socket problems and warnings, some const issues, and avoid generating some empty code.
On Tuesday 10 June 2008 12:05:18 NotFound wrote: > This patch solves the casting problems that breaks or generates > warnings in src/io/io_unix.c allowing clean compiling with C or C++, > with or without --optimize. Applied in r28251. > Also drops the const in argv in several main and main-alike functions, > that can generate warnings or force const castings. Applied in r28252. > And also changes lib/Parrot/Pmc2c/PMCEmitter.pm to avoid generating an > empty class init block and to add a block around a mro initialization > that declares a variable. Applied in r28249. (Patches are easier to apply when they only do one thing at a time, but I'm not complaining -- at all -- for getting these three things fixed.) -- c