Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'is cached' routines break when precompiled #3539

Open
p6rt opened this issue Oct 4, 2014 · 8 comments
Open

'is cached' routines break when precompiled #3539

p6rt opened this issue Oct 4, 2014 · 8 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Oct 4, 2014

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

Searchable as RT122896$

@p6rt
Copy link
Author

p6rt commented Oct 4, 2014

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
Copy link
Author

p6rt commented Oct 6, 2014

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
Copy link
Author

p6rt commented Oct 6, 2014

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

@p6rt
Copy link
Author

p6rt commented Jan 8, 2015

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
Copy link
Author

p6rt commented Jan 8, 2015

From @bdw

Which backend is that? I'm assuming moar.

2015-01-08 10​:14 GMT+01​:00 Elizabeth Mattijsen <liz@​dijkmat.nl>​:

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
Copy link
Author

p6rt commented Jan 8, 2015

From @lizmat

Moar :-)

On 08 Jan 2015, at 10​:16, Bart Wiegmans <bartwiegmans@​gmail.com> wrote​:

Which backend is that? I'm assuming moar.

2015-01-08 10​:14 GMT+01​:00 Elizabeth Mattijsen <liz@​dijkmat.nl>​:

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
Copy link
Author

p6rt commented Jan 8, 2015

From @lizmat

On 08 Jan 2015, at 10​:16, Bart Wiegmans <bartwiegmans@​gmail.com> wrote​:

Which backend is that? I'm assuming moar.

2015-01-08 10​:14 GMT+01​:00 Elizabeth Mattijsen <liz@​dijkmat.nl>​:

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

I further golfed this down to​:

multi sub trait_mod​:<is>(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
Copy link
Author

p6rt commented Jan 8, 2015

From @lizmat

On 08 Jan 2015, at 13​:36, Elizabeth Mattijsen <liz@​dijkmat.nl> wrote​:
I further golfed this down to​:

multi sub trait_mod​:<is>(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

@p6rt p6rt added the precomp label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant