Skip to content
Permalink
Browse files

Fix Inline::Perl5 failing to load when installed through the Staging …

…repository

Marking the %quote_lang_cache as neverrepossess was not enough. It gets
serialized anyway and the MVM_CF_NEVER_REPOSSESS on the object doesn't survive
serialization/deserialization. This caused references to
CompUnit::Repository::Staging's serialization context to end up in the installed
Inline::Perl5::Parent when they shouldn't have. And That's why we ended up with
missing dependencies when loading Inline::Perl5 from an RPM package.

Fix by turning the lexical variable into an attribute of $*W so it won't get
serialized at all. This should also help multi threaded compilation (EVAL).

Thanks to jnthn++ for suggesting the implemented solution!
  • Loading branch information...
niner committed Jan 14, 2019
1 parent fe38bdb commit 1c101a04f92ed199eec62cc31a6b2ffba874a8cd
Showing with 8 additions and 2 deletions.
  1. +1 −2 src/Perl6/Grammar.nqp
  2. +7 −0 src/Perl6/World.nqp
@@ -61,8 +61,6 @@ role STD {
token starter { <!> }
token stopper { <!> }

my %quote_lang_cache := nqp::hash();
nqp::neverrepossess(%quote_lang_cache);
method quote_lang($l, $start, $stop, @base_tweaks?, @extra_tweaks?) {
sub lang_key() {
my $stopstr := nqp::istype($stop,VMArray) ?? nqp::join(' ',$stop) !! $stop;
@@ -110,6 +108,7 @@ role STD {

# Get language from cache or derive it.
my $key := lang_key();
my %quote_lang_cache := $*W.quote_lang_cache;
my $quote_lang := nqp::existskey(%quote_lang_cache, $key) && $key ne 'NOCACHE'
?? %quote_lang_cache{$key}
!! (%quote_lang_cache{$key} := con_lang());
@@ -509,9 +509,12 @@ class Perl6::World is HLL::World {

has $!record_precompilation_dependencies;

has %!quote_lang_cache;

method BUILD(*%adv) {
%!code_object_fixup_list := {};
$!record_precompilation_dependencies := 1;
%!quote_lang_cache := {};
}

method create_nested() {
@@ -5342,6 +5345,10 @@ class Perl6::World is HLL::World {
method resume_recording_precompilation_dependencies() {
$!record_precompilation_dependencies := 1;
}

method quote_lang_cache() {
%!quote_lang_cache
}
}

# vim: ft=perl6 expandtab sw=4

0 comments on commit 1c101a0

Please sign in to comment.
You can’t perform that action at this time.