Skip to content

Commit

Permalink
Fix for broken EVAL at compile time
Browse files Browse the repository at this point in the history
Intended to fix #3096 but wouldn't work without
Raku/nqp#569.

The point is that a lot of code in World.nqp expects %?OPTIONS key on
%*COMPILING but CompUnit::Loader didn't set it.
  • Loading branch information
vrurg committed Aug 5, 2019
1 parent bc45af3 commit e22909d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/CompUnit/Loader.pm6
Expand Up @@ -34,15 +34,16 @@ class CompUnit::Loader is repr('Uninstantiable') {
multi method load-precompilation-file(IO::Path $path --> CompUnit::Handle:D) {
my $handle := CompUnit::Handle.new;
my $*CTXSAVE := $handle;
my %*COMPILING := nqp::hash();
# '%?OPTIONS' is expected by some code; mainly by the World object
my %*COMPILING := nqp::hash('%?OPTIONS', nqp::hash());
nqp::loadbytecode($path.Str);
$handle
}

multi method load-precompilation-file(IO::Handle $file --> CompUnit::Handle:D) {
my $handle := CompUnit::Handle.new;
my $*CTXSAVE := $handle;
my %*COMPILING := nqp::hash();
my %*COMPILING := nqp::hash('%?OPTIONS', nqp::hash());
#?if !jvm
# Switch file handle to binary mode before passing it off to the VM,
# so we don't lose things hanging around in the decoder.
Expand All @@ -57,7 +58,7 @@ class CompUnit::Loader is repr('Uninstantiable') {
method load-precompilation(Blob:D $bytes --> CompUnit::Handle:D) {
my $handle := CompUnit::Handle.new;
my $*CTXSAVE := $handle;
my %*COMPILING := nqp::hash();
my %*COMPILING := nqp::hash('%?OPTIONS', nqp::hash());
nqp::loadbytecodebuffer($bytes);
$handle
}
Expand Down

0 comments on commit e22909d

Please sign in to comment.