Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

'is cached' routines break when precompiled #3539

Open p6rt opened 9 years ago

p6rt commented 9 years ago

Migrated from rt.perl.org#122896 (status was 'open')

Searchable as RT122896$

p6rt commented 9 years ago

From @raydiak

Create a module M containing "module M { sub f () is cached is export { } }". When precompiled, the following error occurs when f() is called​:

Cannot invoke null object   in block at src/gen/m-CORE.setting​:3604   in any enter at src/gen/m-Metamodel.nqp​:3110   in method invoke at src/gen/m-CORE.setting​:3548

This is perl6 version 2014.09-81-g89abcf2 built on MoarVM version 2014.09-12-gb9e24ee

p6rt commented 9 years ago

From @dwarring

Test case has been added to S10-packages/precompilation.t. Fudged for jvm and moar.

On Fri Oct 03 17​:41​:15 2014, raydiak@​cyberuniverses.com wrote​:

Create a module M containing "module M { sub f () is cached is export { } }". When precompiled, the following error occurs when f() is called​:

Cannot invoke null object in block at src/gen/m-CORE.setting​:3604 in any enter at src/gen/m-Metamodel.nqp​:3110 in method invoke at src/gen/m-CORE.setting​:3548

This is perl6 version 2014.09-81-g89abcf2 built on MoarVM version 2014.09-12-gb9e24ee

p6rt commented 9 years ago

The RT System itself - Status changed from 'new' to 'open'

p6rt commented 9 years ago

From @lizmat

On 04 Oct 2014, at 02​:41, (via RT) \perl6\-bugs\-followup@​perl\.org wrote​:

# New Ticket Created by
# Please include the string​: [perl #​122896] # in the subject line of all future correspondence about this issue. # \<URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=122896 >

Create a module M containing "module M { sub f () is cached is export { } }". When precompiled, the following error occurs when f() is called​:

Cannot invoke null object in block at src/gen/m-CORE.setting​:3604 in any enter at src/gen/m-Metamodel.nqp​:3110 in method invoke at src/gen/m-CORE.setting​:3548

This is perl6 version 2014.09-81-g89abcf2 built on MoarVM version 2014.09-12-gb9e24ee

At least on OS X, this has now changed to a segfault on Moar, easily reproducible thus​:

$ perl6 -e 'CompUnit.new("t/spec/packages/Example/C.pm").precomp’ $ perl6 -It/spec/packages -e ‘use Example​::C; f()’ Segmentation fault​: 11

Liz

p6rt commented 9 years ago

From @bdw

Which backend is that? I'm assuming moar.

2015-01-08 10​:14 GMT+01​:00 Elizabeth Mattijsen \liz@&#8203;dijkmat\.nl​:

On 04 Oct 2014, at 02​:41, (via RT) \perl6\-bugs\-followup@&#8203;perl\.org wrote​:

# New Ticket Created by # Please include the string​: [perl #​122896] # in the subject line of all future correspondence about this issue. # \<URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=122896 >

Create a module M containing "module M { sub f () is cached is export { } }". When precompiled, the following error occurs when f() is called​:

Cannot invoke null object in block at src/gen/m-CORE.setting​:3604 in any enter at src/gen/m-Metamodel.nqp​:3110 in method invoke at src/gen/m-CORE.setting​:3548

This is perl6 version 2014.09-81-g89abcf2 built on MoarVM version 2014.09-12-gb9e24ee

At least on OS X, this has now changed to a segfault on Moar, easily reproducible thus​:

$ perl6 -e 'CompUnit.new("t/spec/packages/Example/C.pm").precomp’ $ perl6 -It/spec/packages -e ‘use Example​::C; f()’ Segmentation fault​: 11

Liz

p6rt commented 9 years ago

From @lizmat

Moar :-)

On 08 Jan 2015, at 10​:16, Bart Wiegmans \bartwiegmans@&#8203;gmail\.com wrote​:

Which backend is that? I'm assuming moar.

2015-01-08 10​:14 GMT+01​:00 Elizabeth Mattijsen \liz@&#8203;dijkmat\.nl​:

On 04 Oct 2014, at 02​:41, (via RT) \perl6\-bugs\-followup@&#8203;perl\.org wrote​:

# New Ticket Created by # Please include the string​: [perl #​122896] # in the subject line of all future correspondence about this issue. # \<URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=122896 >

Create a module M containing "module M { sub f () is cached is export { } }". When precompiled, the following error occurs when f() is called​:

Cannot invoke null object in block at src/gen/m-CORE.setting​:3604 in any enter at src/gen/m-Metamodel.nqp​:3110 in method invoke at src/gen/m-CORE.setting​:3548

This is perl6 version 2014.09-81-g89abcf2 built on MoarVM version 2014.09-12-gb9e24ee

At least on OS X, this has now changed to a segfault on Moar, easily reproducible thus​:

$ perl6 -e 'CompUnit.new("t/spec/packages/Example/C.pm").precomp’ $ perl6 -It/spec/packages -e ‘use Example​::C; f()’ Segmentation fault​: 11

Liz

p6rt commented 9 years ago

From @lizmat

On 08 Jan 2015, at 10​:16, Bart Wiegmans \bartwiegmans@&#8203;gmail\.com wrote​:

Which backend is that? I'm assuming moar.

2015-01-08 10​:14 GMT+01​:00 Elizabeth Mattijsen \liz@&#8203;dijkmat\.nl​:

On 04 Oct 2014, at 02​:41, (via RT) \perl6\-bugs\-followup@&#8203;perl\.org wrote​:

# New Ticket Created by # Please include the string​: [perl #​122896] # in the subject line of all future correspondence about this issue. # \<URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=122896 >

Create a module M containing "module M { sub f () is cached is export { } }". When precompiled, the following error occurs when f() is called​:

Cannot invoke null object in block at src/gen/m-CORE.setting​:3604 in any enter at src/gen/m-Metamodel.nqp​:3110 in method invoke at src/gen/m-CORE.setting​:3548

This is perl6 version 2014.09-81-g89abcf2 built on MoarVM version 2014.09-12-gb9e24ee

At least on OS X, this has now changed to a segfault on Moar, easily reproducible thus​:

$ perl6 -e 'CompUnit.new("t/spec/packages/Example/C.pm").precomp’ $ perl6 -It/spec/packages -e ‘use Example​::C; f()’ Segmentation fault​: 11

I further golfed this down to​:

multi sub trait_mod​:\(Routine $r, :$foo!) {   $r.wrap(-> |c {   }); } sub a is foo { say "a" }; a

Put this in a file with a .pm extension, precomp it like above, and try to load it.

Liz

p6rt commented 9 years ago

From @lizmat

On 08 Jan 2015, at 13​:36, Elizabeth Mattijsen \liz@&#8203;dijkmat\.nl wrote​: I further golfed this down to​:

multi sub trait_mod​:\(Routine $r, :$foo!) { $r.wrap(-> |c { }); } sub a is foo { say "a" }; a

Put this in a file with a .pm extension, precomp it like above, and try to load it.

By making the block completely parameterless, it gives a stack trace

Cannot invoke null object   at A.pm​:2 (/Users/liz/Github/rakudo.moar/A.pm.moarvm​::17) from src/gen/m-Metamodel.nqp​:3185 (blib/Perl6/Metamodel.moarvm​:enter​:28)

that brings us to​:

  src/Perl6/Metamodel/Dispatchers.nqp

line 101​:

  method enter(*@​pos, *%named) {   my $fresh := nqp​::clone(self);   my $first := self.candidates[0];   nqp​::setdispatcher($fresh);   $first(|@​pos, |%named) # \<— $first is not set   }

So it would appear that we cannot find a candidate to be dispatched to. Perhaps the original sub is not serialized???

Liz