On Sat, Jul 05, 2008 at 01:03:20PM -0700, chromatic wrote:
> On Saturday 05 July 2008 09:42:33 Jeff Horwitz wrote:
> 
> > In r29081, the following code segfaults:
> >
> >    module Foo::Bar;
> >    sub foo() { say "bar"; }
> >    foo(); # segfaults here
> >
> > The script works if the modules declaration is omitted.  I also tried
> > running with -G, and it still segfaults at the same place.  pmichaud was
> > able to reproduce as well.
> >
> > Backtrace follows:
> >
> > #0  0x402cc6df in Parrot_Closure_invoke (interp=0x804f048, pmc=0x4161e700,
> >      in_next=0x868e23c) at closure.pmc:103
> > 103             else if ((PObj_get_FLAGS(outer_sub) & SUB_FLAG_IS_OUTER)
> > &&
> 
> Random guess: foo() is a Closure PMC, but it doesn't have an outer.  Aren't 
> all Subs generated from Rakudo Closures at the moment?

Good guess -- you're likely correct.  This is a convergence of issues --
first, Rakudo is now tagging all of its subs with an :instanceof attribute,
which automatically makes every sub into a subclass of the Closure PMC.
However, as noted in RT #47956 subs with :load cannot be the target of :outer,
and so we end up with a Closure PMC that has no :outer flag (bad), and thus
the segfault (also bad).

Allison has said that RT #47956 is fixed in the pdd25cx branch, so that may
be one solution.  However, I also know that we need a better solution to
:instanceof than we have implemented now, so that may be another.  Beyond that,
I'm not sure what we can do for the very short term.  My guess is that we
may need to avoid :instanceof in Rakudo for the time being, since it's more 
important that we get modules and classes to work than it is to have imcc 
create subs of the appropriate type.

Thanks!

Pm

Reply via email to