Skip to content

Commit

Permalink
Don't re-link already compiled blocks.
Browse files Browse the repository at this point in the history
This loses lexical chain information they are carrying. A test for
traits/wrapping/multi interaction (yes, we have one :-)) seems to have
been somehow magically working before, for mysterious reasons. This
change makes it work for a better understood reason, and with the NQP
based multi-dispatcher. Fixes the remaining regression in this branch,
and introduces no more spectest regressions.
  • Loading branch information
jnthn committed Mar 16, 2013
1 parent fdc0c2f commit c57f0d5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Perl6/World.pm
Expand Up @@ -190,6 +190,11 @@ class Perl6::World is HLL::World {
# Mapping of sub IDs to SC indexes of code stubs. # Mapping of sub IDs to SC indexes of code stubs.
has %!sub_id_to_sc_idx; has %!sub_id_to_sc_idx;


# Mapping of QAST::Stmts node containing fixups, keyed by sub ID. If
# we do dynamic compilation then we do the fixups immediately and
# then clear this list.
has %!code_object_fixup_list;

# Array of stubs to check and the end of compilation. # Array of stubs to check and the end of compilation.
has @!stub_check; has @!stub_check;


Expand All @@ -212,6 +217,7 @@ class Perl6::World is HLL::World {
%!sub_id_to_code_object := {}; %!sub_id_to_code_object := {};
%!sub_id_to_static_lexpad := {}; %!sub_id_to_static_lexpad := {};
%!sub_id_to_sc_idx := {}; %!sub_id_to_sc_idx := {};
%!code_object_fixup_list := {};
%!const_cache := {}; %!const_cache := {};
} }


Expand Down Expand Up @@ -984,6 +990,10 @@ class Perl6::World is HLL::World {
QAST::WVal.new( :value($clone) ) QAST::WVal.new( :value($clone) )
))); )));
}); });

# Also stash fixups so we can know not to do them if we
# do dynamic compilation.
%!code_object_fixup_list{$code_past.cuid} := $fixups;
} }


# Attach the QAST block to the stub. # Attach the QAST block to the stub.
Expand Down Expand Up @@ -1247,6 +1257,10 @@ class Perl6::World is HLL::World {
nqp::markcodestatic($precomp[$i]); nqp::markcodestatic($precomp[$i]);
self.update_root_code_ref(%!sub_id_to_sc_idx{$subid}, $precomp[$i]); self.update_root_code_ref(%!sub_id_to_sc_idx{$subid}, $precomp[$i]);
} }
if nqp::existskey(%!code_object_fixup_list, $subid) {
my $fixups := %!code_object_fixup_list{$subid};
$fixups.pop() while $fixups.list;
}
$i := $i + 1; $i := $i + 1;
} }


Expand Down

0 comments on commit c57f0d5

Please sign in to comment.