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

An anonymous sub created at compile time in a module that itself calls a sub can't be called at runtime #4962

Open
p6rt opened this issue Dec 30, 2015 · 13 comments

Comments

@p6rt
Copy link

p6rt commented Dec 30, 2015

Migrated from rt.perl.org#127089 (status was 'new')

Searchable as RT127089$

@p6rt
Copy link
Author

p6rt commented Dec 30, 2015

From @hoelzro

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.

@p6rt
Copy link
Author

p6rt commented Dec 30, 2015

From @hoelzro

TestModule.pm

@p6rt
Copy link
Author

p6rt commented Dec 30, 2015

From @hoelzro

test.pl

@p6rt
Copy link
Author

p6rt commented Dec 30, 2015

From @hoelzro

I have a feeling this is related to https://rt-archive.perl.org/perl6/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.

@p6rt
Copy link
Author

p6rt commented Jan 7, 2016

From @hoelzro

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-archive.perl.org/perl6/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.

@p6rt
Copy link
Author

p6rt commented Jan 7, 2016

From @hoelzro

ExampleModule.pm

@p6rt
Copy link
Author

p6rt commented Jan 7, 2016

From @hoelzro

test.pl

@p6rt
Copy link
Author

p6rt commented Jan 8, 2016

From @hoelzro

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-archive.perl.org/perl6/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.

@p6rt
Copy link
Author

p6rt commented Jan 8, 2016

From @hoelzro

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-archive.perl.org/perl6/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.

@p6rt
Copy link
Author

p6rt commented Jan 8, 2016

From @hoelzro

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-archive.perl.org/perl6/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.

@p6rt
Copy link
Author

p6rt commented Jan 8, 2016

From @hoelzro

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-archive.perl.org/perl6/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.

@p6rt
Copy link
Author

p6rt commented Jan 9, 2016

From @hoelzro

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-archive.perl.org/perl6/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.

@p6rt
Copy link
Author

p6rt commented Jan 13, 2016

From @hoelzro

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​:

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-archive.perl.org/perl6/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant