Skip Menu |

Subject: is native(&sub) has an LTA error if sub calls a routine from CORE in a module
Download (untitled) / with headers
text/plain 634b
See attached files. When you run test.pl, you get the following error: Show quoted text
> Cannot invoke this object > in block at /tmp/TestDist/lib/TestModule.pm line 7 > in sub guess_library_name at /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 line 175 > in method setup at /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 line 253 > in method CALL-ME at /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 line 269 > in block <unit> at test.pl line 5
Moving the contents of TestModule.pm into test.pl doesn't produce the error. Issue seems to have been introduced in 8728828.
Subject: TestModule.pm
Download TestModule.pm
text/x-perl 266b
use v6; use NativeCall; my sub resource-lib(Str $libname, :%RESOURCES) returns Code is export { -> --> Str { note('here'); die 'never made it this far'; } } my sub linenoiseClearScreen is native(resource-lib('linenoise')) is export { * }
Subject: test.pl
Download test.pl
text/x-perl 50b
use v6; use TestModule; linenoiseClearScreen();
Download (untitled) / with headers
text/plain 820b
I have a feeling this is related to https://rt.perl.org/Ticket/Display.html?id=127086 On 2015-12-30 07:32:20, rob@hoelz.ro wrote: Show quoted text
> See attached files. When you run test.pl, you get the following > error: >
> > Cannot invoke this object > > in block at /tmp/TestDist/lib/TestModule.pm line 7 > > in sub guess_library_name at > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > line 175 > > in method setup at > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > line 253 > > in method CALL-ME at > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > line 269 > > in block <unit> at test.pl line 5
> > Moving the contents of TestModule.pm into test.pl doesn't produce the > error. > > Issue seems to have been introduced in 8728828.
I managed to golf this down to an example that doesn't use NativeCall. It seems like the issue is when you create an anonymous sub at compile time and call it at runtime. On 2015-12-30 09:22:46, rob@hoelz.ro wrote: Show quoted text
> I have a feeling this is related to > https://rt.perl.org/Ticket/Display.html?id=127086 > > On 2015-12-30 07:32:20, rob@hoelz.ro wrote:
> > See attached files. When you run test.pl, you get the following > > error: > >
> > > Cannot invoke this object > > > in block at /tmp/TestDist/lib/TestModule.pm line 7 > > > in sub guess_library_name at > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > line 175 > > > in method setup at > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > line 253 > > > in method CALL-ME at > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > line 269 > > > in block <unit> at test.pl line 5
> > > > Moving the contents of TestModule.pm into test.pl doesn't produce the > > error. > > > > Issue seems to have been introduced in 8728828.
Subject: ExampleModule.pm
Download ExampleModule.pm
text/x-perl 217b
my $compile-time-sub; sub call-compile-time-sub() is export { note 'before'; $compile-time-sub(); note 'after'; } BEGIN { $compile-time-sub = -> { <.so .dll .dylib>.map("lib/" ~ *); }; }
Subject: test.pl
Download test.pl
text/x-perl 45b
use ExampleModule; call-compile-time-sub();
Download (untitled) / with headers
text/plain 1.6k
Alright, here's what I've managed to uncover: - The code that creates the anonymous sub must be in a module, and the code that calls must also. They may be in the same or separate modules. - Assigning the result of map to a scalar doesn't produce the error; sink or list context is needed to produce the error. - Empty anonymous subs will not produce the error - Calling subs is the problem; for example, 1 + 1 fails (multi sub infix:<+>), but 'this'.gist does not (method gist) On 2016-01-06 19:42:03, rob@hoelz.ro wrote: Show quoted text
> I managed to golf this down to an example that doesn't use NativeCall. > It seems like the issue is when you create an anonymous sub at compile > time and call it at runtime. > > On 2015-12-30 09:22:46, rob@hoelz.ro wrote:
> > I have a feeling this is related to > > https://rt.perl.org/Ticket/Display.html?id=127086 > > > > On 2015-12-30 07:32:20, rob@hoelz.ro wrote:
> > > See attached files. When you run test.pl, you get the following > > > error: > > >
> > > > Cannot invoke this object > > > > in block at /tmp/TestDist/lib/TestModule.pm line 7 > > > > in sub guess_library_name at > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > line 175 > > > > in method setup at > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > line 253 > > > > in method CALL-ME at > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > line 269 > > > > in block <unit> at test.pl line 5
> > > > > > Moving the contents of TestModule.pm into test.pl doesn't produce > > > the > > > error. > > > > > > Issue seems to have been introduced in 8728828.
Download (untitled) / with headers
text/plain 1.9k
Bisect points to rakudo@8728828, but that's a red herring; it's likely that precomp is just exposing some problem that has existed for some time. On 2016-01-07 18:45:35, rob@hoelz.ro wrote: Show quoted text
> Alright, here's what I've managed to uncover: > > - The code that creates the anonymous sub must be in a module, and the > code that calls must also. They may be > in the same or separate modules. > - Assigning the result of map to a scalar doesn't produce the error; > sink or list context is needed to produce the error. > - Empty anonymous subs will not produce the error > - Calling subs is the problem; for example, 1 + 1 fails (multi sub > infix:<+>), but 'this'.gist does not (method gist) > > On 2016-01-06 19:42:03, rob@hoelz.ro wrote:
> > I managed to golf this down to an example that doesn't use > > NativeCall. > > It seems like the issue is when you create an anonymous sub at > > compile > > time and call it at runtime. > > > > On 2015-12-30 09:22:46, rob@hoelz.ro wrote:
> > > I have a feeling this is related to > > > https://rt.perl.org/Ticket/Display.html?id=127086 > > > > > > On 2015-12-30 07:32:20, rob@hoelz.ro wrote:
> > > > See attached files. When you run test.pl, you get the following > > > > error: > > > >
> > > > > Cannot invoke this object > > > > > in block at /tmp/TestDist/lib/TestModule.pm line 7 > > > > > in sub guess_library_name at > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > line 175 > > > > > in method setup at > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > line 253 > > > > > in method CALL-ME at > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > line 269 > > > > > in block <unit> at test.pl line 5
> > > > > > > > Moving the contents of TestModule.pm into test.pl doesn't produce > > > > the > > > > error. > > > > > > > > Issue seems to have been introduced in 8728828.
Download (untitled) / with headers
text/plain 2.1k
Ok, an adjusted bisect script to precompile the module points to rakudo@8bada16. On 2016-01-07 21:39:33, rob@hoelz.ro wrote: Show quoted text
> Bisect points to rakudo@8728828, but that's a red herring; it's likely > that precomp is just exposing some problem that has existed for some > time. > > On 2016-01-07 18:45:35, rob@hoelz.ro wrote:
> > Alright, here's what I've managed to uncover: > > > > - The code that creates the anonymous sub must be in a module, and > > the > > code that calls must also. They may be > > in the same or separate modules. > > - Assigning the result of map to a scalar doesn't produce the error; > > sink or list context is needed to produce the error. > > - Empty anonymous subs will not produce the error > > - Calling subs is the problem; for example, 1 + 1 fails (multi sub > > infix:<+>), but 'this'.gist does not (method gist) > > > > On 2016-01-06 19:42:03, rob@hoelz.ro wrote:
> > > I managed to golf this down to an example that doesn't use > > > NativeCall. > > > It seems like the issue is when you create an anonymous sub at > > > compile > > > time and call it at runtime. > > > > > > On 2015-12-30 09:22:46, rob@hoelz.ro wrote:
> > > > I have a feeling this is related to > > > > https://rt.perl.org/Ticket/Display.html?id=127086 > > > > > > > > On 2015-12-30 07:32:20, rob@hoelz.ro wrote:
> > > > > See attached files. When you run test.pl, you get the > > > > > following > > > > > error: > > > > >
> > > > > > Cannot invoke this object > > > > > > in block at /tmp/TestDist/lib/TestModule.pm line 7 > > > > > > in sub guess_library_name at > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > line 175 > > > > > > in method setup at > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > line 253 > > > > > > in method CALL-ME at > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > line 269 > > > > > > in block <unit> at test.pl line 5
> > > > > > > > > > Moving the contents of TestModule.pm into test.pl doesn't > > > > > produce > > > > > the > > > > > error. > > > > > > > > > > Issue seems to have been introduced in 8728828.
Download (untitled) / with headers
text/plain 2.4k
After looking at the commit in detail, it looks like another red herring; something that's causing precomp to be used a bit differently that triggers the behavior. On 2016-01-08 05:26:20, rob@hoelz.ro wrote: Show quoted text
> Ok, an adjusted bisect script to precompile the module points to > rakudo@8bada16. > > On 2016-01-07 21:39:33, rob@hoelz.ro wrote:
> > Bisect points to rakudo@8728828, but that's a red herring; it's > > likely > > that precomp is just exposing some problem that has existed for some > > time. > > > > On 2016-01-07 18:45:35, rob@hoelz.ro wrote:
> > > Alright, here's what I've managed to uncover: > > > > > > - The code that creates the anonymous sub must be in a module, and > > > the > > > code that calls must also. They may be > > > in the same or separate modules. > > > - Assigning the result of map to a scalar doesn't produce the > > > error; > > > sink or list context is needed to produce the error. > > > - Empty anonymous subs will not produce the error > > > - Calling subs is the problem; for example, 1 + 1 fails (multi sub > > > infix:<+>), but 'this'.gist does not (method gist) > > > > > > On 2016-01-06 19:42:03, rob@hoelz.ro wrote:
> > > > I managed to golf this down to an example that doesn't use > > > > NativeCall. > > > > It seems like the issue is when you create an anonymous sub at > > > > compile > > > > time and call it at runtime. > > > > > > > > On 2015-12-30 09:22:46, rob@hoelz.ro wrote:
> > > > > I have a feeling this is related to > > > > > https://rt.perl.org/Ticket/Display.html?id=127086 > > > > > > > > > > On 2015-12-30 07:32:20, rob@hoelz.ro wrote:
> > > > > > See attached files. When you run test.pl, you get the > > > > > > following > > > > > > error: > > > > > >
> > > > > > > Cannot invoke this object > > > > > > > in block at /tmp/TestDist/lib/TestModule.pm line 7 > > > > > > > in sub guess_library_name at > > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > > line 175 > > > > > > > in method setup at > > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > > line 253 > > > > > > > in method CALL-ME at > > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > > line 269 > > > > > > > in block <unit> at test.pl line 5
> > > > > > > > > > > > Moving the contents of TestModule.pm into test.pl doesn't > > > > > > produce > > > > > > the > > > > > > error. > > > > > > > > > > > > Issue seems to have been introduced in 8728828.
Download (untitled) / with headers
text/plain 2.8k
More notes: - Calling subs from the compunit in the anonymous sub works fine - Fully-qualified sub calls (eg. ExampleModule2::other-sub) work fine too On 2016-01-08 07:49:49, rob@hoelz.ro wrote: Show quoted text
> After looking at the commit in detail, it looks like another red > herring; something that's causing precomp to be used a bit differently > that triggers the behavior. > > On 2016-01-08 05:26:20, rob@hoelz.ro wrote:
> > Ok, an adjusted bisect script to precompile the module points to > > rakudo@8bada16. > > > > On 2016-01-07 21:39:33, rob@hoelz.ro wrote:
> > > Bisect points to rakudo@8728828, but that's a red herring; it's > > > likely > > > that precomp is just exposing some problem that has existed for > > > some > > > time. > > > > > > On 2016-01-07 18:45:35, rob@hoelz.ro wrote:
> > > > Alright, here's what I've managed to uncover: > > > > > > > > - The code that creates the anonymous sub must be in a module, > > > > and > > > > the > > > > code that calls must also. They may be > > > > in the same or separate modules. > > > > - Assigning the result of map to a scalar doesn't produce the > > > > error; > > > > sink or list context is needed to produce the error. > > > > - Empty anonymous subs will not produce the error > > > > - Calling subs is the problem; for example, 1 + 1 fails (multi > > > > sub > > > > infix:<+>), but 'this'.gist does not (method gist) > > > > > > > > On 2016-01-06 19:42:03, rob@hoelz.ro wrote:
> > > > > I managed to golf this down to an example that doesn't use > > > > > NativeCall. > > > > > It seems like the issue is when you create an anonymous sub at > > > > > compile > > > > > time and call it at runtime. > > > > > > > > > > On 2015-12-30 09:22:46, rob@hoelz.ro wrote:
> > > > > > I have a feeling this is related to > > > > > > https://rt.perl.org/Ticket/Display.html?id=127086 > > > > > > > > > > > > On 2015-12-30 07:32:20, rob@hoelz.ro wrote:
> > > > > > > See attached files. When you run test.pl, you get the > > > > > > > following > > > > > > > error: > > > > > > >
> > > > > > > > Cannot invoke this object > > > > > > > > in block at /tmp/TestDist/lib/TestModule.pm line 7 > > > > > > > > in sub guess_library_name at > > > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > > > line 175 > > > > > > > > in method setup at > > > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > > > line 253 > > > > > > > > in method CALL-ME at > > > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > > > line 269 > > > > > > > > in block <unit> at test.pl line 5
> > > > > > > > > > > > > > Moving the contents of TestModule.pm into test.pl doesn't > > > > > > > produce > > > > > > > the > > > > > > > error. > > > > > > > > > > > > > > Issue seems to have been introduced in 8728828.
Download (untitled) / with headers
text/plain 3.1k
jnthn suggested that something along the lines of the change made in rakudo@76204fa58a7 may fix this issue. On 2016-01-09 09:32:35, rob@hoelz.ro wrote: Show quoted text
> More notes: > > - Calling subs from the compunit in the anonymous sub works fine > - Fully-qualified sub calls (eg. ExampleModule2::other-sub) work fine > too > > On 2016-01-08 07:49:49, rob@hoelz.ro wrote:
> > After looking at the commit in detail, it looks like another red > > herring; something that's causing precomp to be used a bit > > differently > > that triggers the behavior. > > > > On 2016-01-08 05:26:20, rob@hoelz.ro wrote:
> > > Ok, an adjusted bisect script to precompile the module points to > > > rakudo@8bada16. > > > > > > On 2016-01-07 21:39:33, rob@hoelz.ro wrote:
> > > > Bisect points to rakudo@8728828, but that's a red herring; it's > > > > likely > > > > that precomp is just exposing some problem that has existed for > > > > some > > > > time. > > > > > > > > On 2016-01-07 18:45:35, rob@hoelz.ro wrote:
> > > > > Alright, here's what I've managed to uncover: > > > > > > > > > > - The code that creates the anonymous sub must be in a module, > > > > > and > > > > > the > > > > > code that calls must also. They may be > > > > > in the same or separate modules. > > > > > - Assigning the result of map to a scalar doesn't produce the > > > > > error; > > > > > sink or list context is needed to produce the error. > > > > > - Empty anonymous subs will not produce the error > > > > > - Calling subs is the problem; for example, 1 + 1 fails (multi > > > > > sub > > > > > infix:<+>), but 'this'.gist does not (method gist) > > > > > > > > > > On 2016-01-06 19:42:03, rob@hoelz.ro wrote:
> > > > > > I managed to golf this down to an example that doesn't use > > > > > > NativeCall. > > > > > > It seems like the issue is when you create an anonymous sub > > > > > > at > > > > > > compile > > > > > > time and call it at runtime. > > > > > > > > > > > > On 2015-12-30 09:22:46, rob@hoelz.ro wrote:
> > > > > > > I have a feeling this is related to > > > > > > > https://rt.perl.org/Ticket/Display.html?id=127086 > > > > > > > > > > > > > > On 2015-12-30 07:32:20, rob@hoelz.ro wrote:
> > > > > > > > See attached files. When you run test.pl, you get the > > > > > > > > following > > > > > > > > error: > > > > > > > >
> > > > > > > > > Cannot invoke this object > > > > > > > > > in block at /tmp/TestDist/lib/TestModule.pm line 7 > > > > > > > > > in sub guess_library_name at > > > > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > > > > line 175 > > > > > > > > > in method setup at > > > > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > > > > line 253 > > > > > > > > > in method CALL-ME at > > > > > > > > > /tmp/nom/share/perl6/sources/1EBD27B0131327E04F87F2C0D2266A67ACE97B06 > > > > > > > > > line 269 > > > > > > > > > in block <unit> at test.pl line 5
> > > > > > > > > > > > > > > > Moving the contents of TestModule.pm into test.pl doesn't > > > > > > > > produce > > > > > > > > the > > > > > > > > error. > > > > > > > > > > > > > > > > Issue seems to have been introduced in 8728828.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org