Re: [perl #44291] [PATCH] Fix for suncc
Attached patch should fix computed goto on Solaris with the Sun C compiler. All tests successful (7 subtests UNEXPECTEDLY SUCCEEDED), 11 tests and 621 subtests skipped. Passed TODO Stat Wstat TODOs Pass List of Passed --- t/src/intlist.t44 1-4 t/src/io.t 33 16-17 19 Files=349, Tests=7904, 1398 wallclock secs (668.38 cusr + 455.97 csys = 1124.35 CPU) Could someone please review the patch if I got it right, and maybe test it on other computed goto platforms? Ron Index: lib/Parrot/Ops2c/Utils.pm === --- lib/Parrot/Ops2c/Utils.pm (revision 22065) +++ lib/Parrot/Ops2c/Utils.pm (working copy) @@ -588,7 +588,7 @@ # endif #endif _reg_base = (char*)interp->ctx.bp.regs_i; -goto **cur_opcode; +goto **(void **)cur_opcode; END_C } Index: lib/Parrot/OpTrans/CGP.pm === --- lib/Parrot/OpTrans/CGP.pm (revision 22065) +++ lib/Parrot/OpTrans/CGP.pm (working copy) @@ -91,7 +91,7 @@ return "if ($addr == 0) return 0; _reg_base = (char*)interp->ctx.bp.regs_i; - goto **(cur_opcode = opcode_to_prederef(interp, $addr))"; + goto **(void **)(cur_opcode = opcode_to_prederef(interp, $addr))"; } } @@ -105,7 +105,7 @@ sub goto_offset { my ( $self, $offset ) = @_; -return "goto **(cur_opcode += $offset)"; +return "goto **(void **)(cur_opcode += $offset)"; } =item C Index: PLATFORMS === --- PLATFORMS (revision 22065) +++ PLATFORMS (working copy) @@ -30,8 +30,8 @@ sol8-sparc-ccB--- - - -Y/412 ? 20070917 sol10-sparc-cc_5.8 BY-- Y Y YY/9 ? 20060807 sol10-sparc-gcc_4.0.2BY-- Y Y YY/9 ? 20060807 -sol10-x86-cc_5.9 4 --- - - YY*4 ? 20070914 -sol11-x86-cc_5.8 --- - - - Y/121*4 ? 20070821 +sol10-x86-cc_5.9 4 --- - - YY ? 20071010 +sol11-x86-cc_5.8 --- - - - Y/121 ? 20070821 opensolaris-x86-gcc_4.0.3 4 YY? ? ? YY/3 ? 20070417 tru64-alpha-compaq_c6.5 8 ??? Y ? YY/2 ? 20060203 win32-x86-cygwin_1.5.21 --- - - -- - 20070221 @@ -71,7 +71,6 @@ *2 some tests fail intermittently when building x86 on xeon processor *3 t/stm/basic_mt.t occasionally hangs. kill it for tests to complete. 1 other test fails. 7 unexpected todos succeed. -*4 You must run Configure.pl with --cgoto=0, see RT#44291 The following configurations are also working on x86/linux (and possibly other platforms):
Call for Release Managers
For 2008, I'd like to add a few more people into the rotation for doing releases. You need to have already gotten commit privs for parrot, be willing to steer things a bit around the release deadline, and be able to release things to CPAN (Not as scary as it might sound.) Ping me if you're interested. -- Will "Coke" Coleda [EMAIL PROTECTED]
[perl #46403] [TODO] Implement locking around list access in Parrot_on_exit()
# New Ticket Created by Paul Cochrane # Please include the string: [perl #46403] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=46403 > In src/exit.c:Parrot_on_exit() there is the todo item: /* XXX we might want locking around the list access. I'm sure this * will be the least of the threading issues. */
[perl #46405] [TODO] Reset stacktop or disable GC in Parrot_exit()
# New Ticket Created by Paul Cochrane # Please include the string: [perl #46405] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=46405 > In src/exit.c:Parrot_exit() there is the todo item (with some context): /* call all the exit handlers */ TODO reset stacktop or better disable GC Make a decision as to which is better to do; reset stacktop or disable GC and then implement as appropriate.
[perl #39760] [CAGE] make warnings (r13197 - x86-msvc-7.1)
On Sat Jul 15 14:47:48 2006, rblasch wrote: > Jerry Gay (via RT) wrote: > > # New Ticket Created by Jerry Gay > > # Please include the string: [perl #39760] > > # in the subject line of all future correspondence about this issue. > > # http://rt.perl.org/rt3/Ticket/Display.html?id=39760 > > > > > compilers\ast\astparser.c > > astparser.c > > compilers\ast\astparser.c(1298) : warning C4102: 'yyerrlab1' : > > unreferenced label > > compilers/ast/astparser.c is generated by GNU Bison 1.875. I have GNU > Bison 2.1 installed, which generates code that doesn't yield any warning. > > bison -v -y compilers\ast\ast.y -d -o compilers\ast\astparser.c > -p AST > C:\Perl\bin\perl.exe -MExtUtils::Command -e touch > compilers\ast\ast.y.flag compilers\ast\astparser.c > compilers\ast\astparser.h > bison -v -y compilers\ast\ast.y -d -o compilers\ast\astparser.c > -p AST > C:\Perl\bin\perl.exe -MExtUtils::Command -e touch > compilers\ast\ast.y.flag compilers\ast\astparser.c > compilers\ast\astparser.h > compilers\ast\astparser.c > astparser.c > > > Is that sufficient to close this issue, or should I provide a patch to > disable the C4102 warning? Is this ticket still relevant? Are we still seeing these warnings with msvc? Paul
Re: [perl #44291] [PATCH] Fix for suncc
On Oct 13, 2007, at 7:20 AM, Ron Blaschke wrote: Attached patch should fix computed goto on Solaris with the Sun C compiler. All tests successful (7 subtests UNEXPECTEDLY SUCCEEDED), 11 tests and 621 subtests skipped. Passed TODO Stat Wstat TODOs Pass List of Passed --- t/src/intlist.t44 1-4 t/src/io.t 33 16-17 19 Files=349, Tests=7904, 1398 wallclock secs (668.38 cusr + 455.97 csys = 1124.35 CPU) Could someone please review the patch if I got it right, and maybe test it on other computed goto platforms? Ron Index: lib/Parrot/Ops2c/Utils.pm === --- lib/Parrot/Ops2c/Utils.pm (revision 22065) +++ lib/Parrot/Ops2c/Utils.pm (working copy) @@ -588,7 +588,7 @@ # endif #endif _reg_base = (char*)interp->ctx.bp.regs_i; -goto **cur_opcode; +goto **(void **)cur_opcode; END_C } Index: lib/Parrot/OpTrans/CGP.pm === --- lib/Parrot/OpTrans/CGP.pm (revision 22065) +++ lib/Parrot/OpTrans/CGP.pm (working copy) @@ -91,7 +91,7 @@ return "if ($addr == 0) return 0; _reg_base = (char*)interp->ctx.bp.regs_i; - goto **(cur_opcode = opcode_to_prederef(interp, $addr))"; + goto **(void **)(cur_opcode = opcode_to_prederef(interp, $addr))"; } } @@ -105,7 +105,7 @@ sub goto_offset { my ( $self, $offset ) = @_; -return "goto **(cur_opcode += $offset)"; +return "goto **(void **)(cur_opcode += $offset)"; } =item C Index: PLATFORMS === --- PLATFORMS (revision 22065) +++ PLATFORMS (working copy) @@ -30,8 +30,8 @@ sol8-sparc-ccB--- - - -Y/412 ? 20070917 sol10-sparc-cc_5.8 BY-- Y Y YY/9 ? 20060807 sol10-sparc-gcc_4.0.2BY-- Y Y YY/9 ? 20060807 -sol10-x86-cc_5.9 4 --- - - YY*4 ? 20070914 -sol11-x86-cc_5.8 --- - - - Y/121*4 ? 20070821 +sol10-x86-cc_5.9 4 --- - - YY ? 20071010 +sol11-x86-cc_5.8 --- - - - Y/121 ? 20070821 opensolaris-x86-gcc_4.0.3 4 YY? ? ? YY/3 ? 20070417 tru64-alpha-compaq_c6.5 8 ??? Y ? YY/2 ? 20060203 win32-x86-cygwin_1.5.21 --- - - -- - 20070221 @@ -71,7 +71,6 @@ *2 some tests fail intermittently when building x86 on xeon processor *3 t/stm/basic_mt.t occasionally hangs. kill it for tests to complete. 1 other test fails. 7 unexpected todos succeed. -*4 You must run Configure.pl with --cgoto=0, see RT#44291 The following configurations are also working on x86/linux (and possibly other platforms): Just to clarify, you did reenable CGP in compilers/imcc/main.c, correct? It's been disabled for a while.
[perl #46407] [TODO] Remove assumption that fstat exists?
# New Ticket Created by Paul Cochrane # Please include the string: [perl #46407] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=46407 > In src/io/io_mmap.c:PIO_mmap_open() there is the todo item: /* XXX assume fstat exists too My guess is that instead of assuming that fstat exists, it should be tested for, and used if found, and an exception thrown if not.
[perl #46409] [TODO] Verify flags in PIO_mmap_open()
# New Ticket Created by Paul Cochrane # Please include the string: [perl #46409] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=46409 > In src/io/io_mmap.c:PIO_mmap_open() there is the todo item: /* TODO verify flags */ io->b.startb = (unsigned char *)mmap(0, file_size, PROT_READ, MAP_SHARED, io->fd, 0); This needs to be implemented.
[perl #46411] [TODO] Create string_free API for reusing string headers
# New Ticket Created by Paul Cochrane # Please include the string: [perl #46411] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=46411 > In src/io/io_mmap.c:PIO_mmap_read() there is the todo item: /* TODO create string_free API for reusing string headers */ This needs implementing
[perl #46413] [TODO] Does the amount read in PIO_utf8_read() need to be checked?
# New Ticket Created by Paul Cochrane # Please include the string: [perl #46413] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=46413 > In src/io/io_utf8.c:PIO_utf8_read() there is the todo item: /* XXX need to check the amount read here? */ read = PIO_read_down(interp, layer->down, io, &s2); At present this variable is marked UNUSED(read). However, it might be a good idea to actually check the amount read in this function call. After which the UNUSED() needs to disappear.
[perl #44307] PIR tutorial
A good place to start is by adding POD to the tutorial files already in the directory. I added POD to many, but not to all. In r22071, I added a one sentence descriptions "this illustrates X" to the files that had no POD, which could be expanded into full descriptions.
Re: [perl #44291] [PATCH] Fix for suncc
On Saturday 13 October 2007 05:20:34 Ron Blaschke wrote: > Attached patch should fix computed goto on Solaris with the Sun C compiler. > > All tests successful (7 subtests UNEXPECTEDLY SUCCEEDED), 11 tests and > 621 subtests skipped. > Passed TODO Stat Wstat TODOs Pass List of Passed > --- > t/src/intlist.t44 1-4 > t/src/io.t 33 16-17 19 > Files=349, Tests=7904, 1398 wallclock secs (668.38 cusr + 455.97 csys = > 1124.35 CPU) > > Could someone please review the patch if I got it right, and maybe test > it on other computed goto platforms? After re-enabling CGP in IMCC and after r22073, all tests pass for me on x86 Linux. -- c
[perl #43422] test names do not match tested in object-meths.t for callmethod/callmethodcc
Thanks! Applied to the pdd15oo branch in r22075, to be rolled into trunk along with the rest of the branch.
Re: [perl #44291] [PATCH] Fix for suncc
Joshua Isom wrote: > On Oct 13, 2007, at 7:20 AM, Ron Blaschke wrote: >> Attached patch should fix computed goto on Solaris with the Sun C >> compiler. [snip] >> Could someone please review the patch if I got it right, and maybe test >> it on other computed goto platforms? > > Just to clarify, you did reenable CGP in compilers/imcc/main.c, > correct? It's been disabled for a while. Bummer, no I did not. I thought everything was connected to Configure's --cgoto. Thanks for noticing, Joshua. chromatic, thanks for giving it a spin. Since it's working for you I guess it'll work on Solaris as well, but I'll verify on Monday. This time, the right way. Thanks, Ron
Re: [perl #41894] segfault happens when invoking poll op
On Saturday 14 April 2007 12:13:32 Joshua Isom wrote: > Wouldn't it be preferable to add a check to ops2c for all 'in' pmc's to > make sure they are not null? That would help prevent errors like this > from popping up easily, and just require that all C code using the > functions must check for it being valid before calling the function. Agreed. Here's a patch which sort of enables this. It doesn't quite work completely, because it's not clear where to put the assertions so as not to annoy C90 compilers, but it's part of the way there. -- c
Re: [perl #41894] segfault happens when invoking poll op
ENOPATCH On Oct 13, 2007, at 5:11 PM, chromatic wrote: On Saturday 14 April 2007 12:13:32 Joshua Isom wrote: Wouldn't it be preferable to add a check to ops2c for all 'in' pmc's to make sure they are not null? That would help prevent errors like this from popping up easily, and just require that all C code using the functions must check for it being valid before calling the function. Agreed. Here's a patch which sort of enables this. It doesn't quite work completely, because it's not clear where to put the assertions so as not to annoy C90 compilers, but it's part of the way there. -- c -- Will "Coke" Coleda [EMAIL PROTECTED]
Re: [perl #41894] segfault happens when invoking poll op
On Saturday 13 October 2007 17:03:56 Will Coleda wrote: > ENOPATCH === lib/Parrot/Op.pm == --- lib/Parrot/Op.pm (revision 6305) +++ lib/Parrot/Op.pm (local) @@ -67,6 +67,8 @@ use strict; use warnings; +use Scalar::Util 'blessed'; + =item C Allocates a new bodyless op. A body must be provided eventually for the @@ -220,6 +222,36 @@ return @{ $self->{ARGDIRS} }; } +=item C + +Asserts that any in PMCs are not NULL. + +=cut + +sub assertions { +my ($self, $trans) = @_; +my @dirs = $self->arg_dirs(); +my @types = $self->arg_types(); + +my @assertions; + +my $count = 0; + +while (@dirs && @types) { +my $dir = shift @dirs; +my $type = shift @types; + +$count++; +next unless $type eq 'p' && $dir =~ /^i/; + +my $access = $trans->access_arg($type, $count, $self); + +push @assertions, "PARROT_ASSERT(!PMC_IS_NULL($access));"; +} + +return join("\n", @assertions, "\n" ); +} + =item C Returns the labels. @@ -375,6 +407,11 @@ $body = $new_body; } +if (blessed( $self )) { +my $assertions = $self->assertions($trans); +$body =~ s/(^.+return)/$assertions\n$1/m if $assertions; +} + return $body; }
Lua GC Problems
I've been digging into the Lua on Parrot source code to try to find out why there are GC problems (partly to fix them, partly so I can profile Lua programs and speed up the system). I ran into something suspicious in the LuaTable PMC. It uses a custom function to mark all contained keys and values as live, if they're GC-able PObjs: static void lua_mark_table(PARROT_INTERP, Hash *t, STRING *mode) { Node *v = t->node; int i; int mark_key = 1; int mark_val = 1; if (mode) { mark_key = string_str_index(interp, mode, const_string(interp, "k"), 0) < 0; mark_val = string_str_index(interp, mode, const_string(interp, "v"), 0) < 0; } for (i = 0; i < t->size; i++) { if (v[i].val != NULL) { if (mark_key) pobject_lives(interp, (PObj *)v[i].key); if (mark_val) pobject_lives(interp, (PObj *)v[i].val); } } } However, the node member of a Hash isn't an array: typedef struct Node { PMC *key; PMC *val; struct Node *next; /* for chaining */ } Node; typedef struct Hash { Node *node; int size; Node *firstfree; /* this position is free; all positions after it are full */ PMC *container; } Hash; Now it may indeed be that the linked list happens to be the right size that this pointer math might work... but I'm not convinced. Instead, I expect the correct approach to look something more like: static void lua_mark_table(PARROT_INTERP, Hash *t, STRING *mode) { Node *v = t->node; int mark_key = 1; int mark_val = 1; if (mode) { mark_key = string_str_index(interp, mode, const_string(interp, "k"), 0) < 0; mark_val = string_str_index(interp, mode, const_string(interp, "v"), 0) < 0; } while (v) { if (v->val) { if (mark_key) pobject_lives(interp, (PObj *)v->key); if (mark_val) pobject_lives(interp, (PObj *)v->val); } v = v->next; } } Of course, that makes segfaults elsewhere, which may mean that it's wrong, or it may mean that there's more hash cleanup necessary in that PMC. At least when I run individual Lua files without --no-gc, they no longer segfault in DOD after saying "Method 'setfenv' not found". Patch (for experimentation, not commit) attached. -- c === pmc/luatable.pmc == --- pmc/luatable.pmc (revision 6305) +++ pmc/luatable.pmc (local) @@ -270,21 +270,22 @@ static void lua_mark_table(PARROT_INTERP, Hash *t, STRING *mode) { -Node *v = t->node; -int i; +Node *v = t->node; int mark_key = 1; int mark_val = 1; if (mode) { mark_key = string_str_index(interp, mode, const_string(interp, "k"), 0) < 0; mark_val = string_str_index(interp, mode, const_string(interp, "v"), 0) < 0; } -for (i = 0; i < t->size; i++) { -if (v[i].val != NULL) { + +while (v) { +if (v->val) { if (mark_key) -pobject_lives(interp, (PObj *)v[i].key); +pobject_lives(interp, (PObj *)v->key); if (mark_val) -pobject_lives(interp, (PObj *)v[i].val); +pobject_lives(interp, (PObj *)v->val); } +v = v->next; } }
Re: Lua GC Problems
On Saturday 13 October 2007 18:18:30 chromatic wrote: > However, the node member of a Hash isn't an array: > > typedef struct Node { > PMC *key; > PMC *val; > struct Node *next; /* for chaining */ > } Node; > > typedef struct Hash { > Node *node; > int size; > Node *firstfree; /* this position is free; all positions after it are > full */ > PMC *container; > } Hash; Of course, if it uses the same array/buckets approach that Parrot's hash implementation does, that Node *node might ought to be Node **node instead -- c
[svn:parrot-pdd] r22076 - trunk/docs/pdds/draft
Author: allison Date: Sat Oct 13 21:02:34 2007 New Revision: 22076 Modified: trunk/docs/pdds/draft/pdd24_events.pod Log: [pdd] The core conceptual description of the event system. Modified: trunk/docs/pdds/draft/pdd24_events.pod == --- trunk/docs/pdds/draft/pdd24_events.pod (original) +++ trunk/docs/pdds/draft/pdd24_events.pod Sat Oct 13 21:02:34 2007 @@ -16,78 +16,109 @@ =head1 DESCRIPTION -Description of the subject. +=over 4 -=head1 DEFINITIONS +=item - Events are objects -Definitions of important terms. (optional) +=item - Events are typed -=head1 IMPLEMENTATION +=item - Events can be fatal or non-fatal + +=item - Event handlers are code objects -[Excerpt from Perl 6 and Parrot Essentials to seed discussion.] +=item - Event handlers can be final or non-final + +=back + +=head1 DEFINITIONS An event is a notification that something has happened: the user has manipulated a GUI element, an I/O request has completed, a signal has been triggered, or a timer has expired. Most systems these days have an event handler (often two or three, which is something of a problem), because handling events is so fundamental to modern GUI programming. -Unfortunately, the event handling system is not integrated, or poorly -integrated, with the I/O system, leading to nasty code and unpleasant -workarounds to try and make a program responsive to network, file, and -GUI events simultaneously. Parrot presents a unified event handling -system, integrated with its I/O system, which makes it possible to write -cross-platform programs that work well in a complex environment. - -Parrot's events are fairly simple. An event has an event type, some -event data, an event handler, and a priority. Each thread has an event -queue, and when an event happens it's put into the right thread's -queue (or the default thread queue in those cases where we can't tell -which thread an event was destined for) to wait for something to -process it. - -Any operation that would potentially block drains the event queue -while it waits, as do a number of the cleanup opcodes that Parrot uses -to tidy up on scope exit. Parrot doesn't check each opcode for an -outstanding event for pure performance reasons, as that check gets -expensive quickly. Still, Parrot generally ensures timely event -handling, and events shouldn't sit in a queue for more than a few -milliseconds unless event handling has been explicitly disabled. - -When Parrot does extract an event from the event queue, it calls that -event's event handler, if it has one. If an event doesn't have a -handler, Parrot instead looks for a generic handler for the event type -and calls it instead. If for some reason there's no handler for the -event type, Parrot falls back to the generic event handler, which -throws an exception when it gets an event it doesn't know how to -handle. You can override the generic event handler if you want Parrot -to do something else with unhandled events, perhaps silently -discarding them instead. - -Because events are handled in mainline code, they don't have the -restrictions commonly associated with interrupt-level code. It's safe -and acceptable for an event handler to throw an exception, allocate -memory, or manipulate thread or global state safely. Event handlers -can even acquire locks if they need to, though it's not a good idea to -have an event handler blocking on lock acquisition. - -Parrot uses the priority on events for two purposes. First, the -priority is used to order the events in the event queue. Events for a -particular priority are handled in a FIFO manner, but higher-priority -events are always handled before lower-priority events. Parrot also -allows a user program or event handler to set a minimum event priority -that it will handle. If an event with a priority lower than the -current minimum arrives, it won't be handled, instead sitting in the -queue until the minimum priority level is dropped. This allows an -event handler that's dealing with a high-priority event to ignore -lower-priority events. - -User code generally doesn't need to deal with prioritized events, so -programmers should adjust event priorities with care. Adjusting the -default priority of an event, or adjusting the current minimum -priority level, is a rare occurrence. It's almost always a mistake to -change them, but the capability is there for those rare occasions -where it's the correct thing to -do. + +=head1 IMPLEMENTATION + +Parrot's event handling system is integrated with the central concurrency +scheduler. When an event is created (by a GUI element, etc), it is added to +concurrency task list. By default, events have a higher priority in the task +list than asynchronous I/O operations or threaded code operations. At +predetermined points in the execution cycle (between low-level discrete +operations for safety, behind the scenes during "blocking" operations, at
More Lua GC Debugging
On my system, allowing Parrot GC to run during the Lua tests makes a lot of segfaults during DOD, specifically when trying to destroy PMCs which already have their vtable pointers invalidated. (This invalidation occurs when freeing a PMC.) The main culprit seems to be a PMC of type 82, which corresponds to the LuaTable PMC. With the attached patch (for troubleshooting, not for application) disabling freeing LuaTable PMCs, most of the Lua tests pass. This makes me wonder if there's a LuaTable PMC somewhere not getting marked properly. Of course, tracking it down is more work. Note also that the -t flag doesn't work with the command line: ../../parrot -t lua.pbc t/some_lua_test_number.lua It would be super nice if it did. -- c === src/gc/dod.c == --- src/gc/dod.c (revision 6305) +++ src/gc/dod.c (local) @@ -304,6 +304,8 @@ /* mark the root_namespace */ pobject_lives(interp, (PObj *)interp->root_namespace); +pobject_lives(interp, (PObj *)interp->HLL_namespace); + /* s. packfile.c */ mark_const_subs(interp); @@ -646,9 +648,10 @@ } assert(dod_object); -dod_object(interp, pool, b); - -pool->add_free_object(interp, pool, b); +if (PObj_is_PMC_TEST(b) && ((PMC *)b)->vtable->base_type != 82){ +dod_object(interp, pool, b); +pool->add_free_object(interp, pool, b); +} } next: b = (Buffer *)((char *)b + object_size);