Skip to content

Commit

Permalink
RakuAST: ensure that repossessions during BEGIN time are recorded
Browse files Browse the repository at this point in the history
The VM only records repossessions if an SC is on the stack of current
compilations as doing so costs a bit of performance and is only required
if we're actually producing a precomp file. We pushed the SC too late,
missing BEGIN time effects like module loading which can lead to
modified and repossessed Stashes. So follow the old frontend in pushing
the SC at the very start of compilation.
  • Loading branch information
niner committed Nov 3, 2022
1 parent e92e3c5 commit 4fbe897
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Raku/ast/compunit.rakumod
Expand Up @@ -27,6 +27,7 @@ class RakuAST::CompUnit is RakuAST::LexicalScope is RakuAST::SinkBoundary
nqp::bindattr($obj, RakuAST::CompUnit, '$!comp-unit-name', $comp-unit-name);
nqp::bindattr($obj, RakuAST::CompUnit, '$!setting-name', $setting-name // Str);
my $sc := nqp::createsc($comp-unit-name);
nqp::pushcompsc($sc);
nqp::bindattr($obj, RakuAST::CompUnit, '$!sc', $sc);
my $file := nqp::getlexdyn('$?FILES');
nqp::scsetdesc($sc, $file) unless nqp::isnull($file);
Expand Down Expand Up @@ -170,7 +171,6 @@ class RakuAST::CompUnit is RakuAST::LexicalScope is RakuAST::SinkBoundary
method IMPL-TO-QAST-COMP-UNIT(*%options) {
# Create compilation context.
my $context := $!context;
nqp::pushcompsc($!sc);
my $top-level := QAST::Block.new;
self.IMPL-ADD-SETTING-LOADING($context, $top-level, $!setting-name) if $!setting-name;

Expand Down

0 comments on commit 4fbe897

Please sign in to comment.