Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Properly handle --bootstrap on MoarVM backend.
  • Loading branch information
jnthn committed Oct 6, 2013
1 parent c847d0e commit 431c3b1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/vm/moar/HLL/Backend.nqp
Expand Up @@ -55,7 +55,11 @@ class HLL::Backend::MoarVM {
nqp::null()
}
else {
$assmblr.assemble_and_load($mast);
my $boot_mode := %adverbs<bootstrap> ?? 1 !! 0;
__MVM__usecompileehllconfig() if $boot_mode;
my $result := $assmblr.assemble_and_load($mast);
__MVM__usecompilerhllconfig() if $boot_mode;
$result
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/vm/moar/ModuleLoader.nqp
Expand Up @@ -42,8 +42,13 @@ knowhow ModuleLoader {
else {
my $*CTXSAVE := self;
my $*MAIN_CTX := ModuleLoader;
my $boot_mode;
try { $boot_mode := nqp::ifnull(nqp::ifnull(%*COMPILING, {})<%?OPTIONS>, {})<bootstrap>; }
$boot_mode := !nqp::isnull($boot_mode) && $boot_mode;
my $preserve_global := nqp::getcurhllsym('GLOBAL');
nqp::usecompileehllconfig() if $boot_mode;
nqp::loadbytecode($path);
nqp::usecompilerhllconfig() if $boot_mode;
nqp::bindcurhllsym('GLOBAL', $preserve_global);
%modules_loaded{$path} := $module_ctx := $*MAIN_CTX;
}
Expand Down Expand Up @@ -139,8 +144,13 @@ knowhow ModuleLoader {
unless nqp::existskey(%settings_loaded, $path) {
my $*CTXSAVE := self;
my $*MAIN_CTX := ModuleLoader;
my $boot_mode;
try { $boot_mode := nqp::ifnull(nqp::ifnull(%*COMPILING, {})<%?OPTIONS>, {})<bootstrap>; }
$boot_mode := !nqp::isnull($boot_mode) && $boot_mode;
my $preserve_global := nqp::getcurhllsym('GLOBAL');
nqp::usecompileehllconfig() if $boot_mode;
nqp::loadbytecode($path);
nqp::usecompilerhllconfig() if $boot_mode;
nqp::bindcurhllsym('GLOBAL', $preserve_global);
unless nqp::defined($*MAIN_CTX) {
nqp::die("Unable to load setting $setting_name; maybe it is missing a YOU_ARE_HERE?");
Expand Down
2 changes: 2 additions & 0 deletions src/vm/moar/QAST/QASTOperationsMAST.nqp
Expand Up @@ -1852,6 +1852,8 @@ QAST::MASTOperations.add_core_moarop_mapping('sethllconfig', 'sethllconfig');
QAST::MASTOperations.add_core_moarop_mapping('loadbytecode', 'loadbytecode');
QAST::MASTOperations.add_core_moarop_mapping('settypehll', 'settypehll', 0);
QAST::MASTOperations.add_core_moarop_mapping('settypehllrole', 'settypehllrole', 0);
QAST::MASTOperations.add_core_moarop_mapping('usecompileehllconfig', 'usecompileehllconfig');
QAST::MASTOperations.add_core_moarop_mapping('usecompilerhllconfig', 'usecompilerhllconfig');

# regex engine related opcodes
QAST::MASTOperations.add_core_moarop_mapping('nfafromstatelist', 'nfafromstatelist');
Expand Down

0 comments on commit 431c3b1

Please sign in to comment.