Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Eliminate epic hack in JVM ModuleLoader.
The optimizer now got clever enough to see through the hack.
  • Loading branch information
jnthn committed Apr 4, 2014
1 parent 4dd7814 commit d317008
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions src/vm/jvm/ModuleLoader.nqp
Expand Up @@ -8,7 +8,15 @@ knowhow ModuleLoader {
# Put any explicitly specified path on the start of the list.
my $explicit;
if !nqp::isnull($explicit_path) {
try { my $hack; $explicit := %*COMPILING<%?OPTIONS>{$explicit_path}; }
try {
my $compiling := %*COMPILING;
unless nqp::isnull(%*COMPILING) {
my $options := $compiling<%?OPTIONS>;
unless nqp::isnull($options) {
$explicit := $options{$explicit_path};
}
}
}
}
if !nqp::isnull($explicit) && nqp::defined($explicit) {
nqp::push(@search_paths, $explicit);
Expand Down Expand Up @@ -55,7 +63,15 @@ knowhow ModuleLoader {
my $*CTXSAVE := self;
my $*MAIN_CTX := ModuleLoader;
my $boot_mode;
try { my $hack; $boot_mode := %*COMPILING<%?OPTIONS><bootstrap>; }
try {
my $compiling := %*COMPILING;
unless nqp::isnull(%*COMPILING) {
my $options := $compiling<%?OPTIONS>;
unless nqp::isnull($options) {
$boot_mode := $options<bootstrap>;
}
}
}
$boot_mode := !nqp::isnull($boot_mode) && $boot_mode;
my $preserve_global := nqp::getcurhllsym('GLOBAL');
nqp::usecompileehllconfig() if $boot_mode;
Expand Down Expand Up @@ -166,7 +182,15 @@ knowhow ModuleLoader {
my $*CTXSAVE := self;
my $*MAIN_CTX := ModuleLoader;
my $boot_mode;
try { my $hack; $boot_mode := %*COMPILING<%?OPTIONS><bootstrap>; }
try {
my $compiling := %*COMPILING;
unless nqp::isnull(%*COMPILING) {
my $options := $compiling<%?OPTIONS>;
unless nqp::isnull($options) {
$boot_mode := $options<bootstrap>;
}
}
}
$boot_mode := !nqp::isnull($boot_mode) && $boot_mode;
my $preserve_global := nqp::getcurhllsym('GLOBAL');
nqp::usecompileehllconfig() if $boot_mode;
Expand Down

0 comments on commit d317008

Please sign in to comment.