Skip to content

Commit

Permalink
No need to load ModuleLoader multiple times
Browse files Browse the repository at this point in the history
When loading a setting we can just check if the ModuleLoader is already
loaded. When loading a module we have already loaded a setting and thus
the ModuleLoader must be available already.
  • Loading branch information
niner committed Jan 25, 2018
1 parent b88de49 commit b930e35
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/NQP/World.nqp
Expand Up @@ -91,13 +91,21 @@ class NQP::World is HLL::World {
if self.is_precompilation_mode() {
self.add_load_dependency_task(:deserialize_ast(QAST::Stmts.new(
QAST::Op.new(
:op('loadbytecode'),
QAST::VM.new(
:jvm(QAST::SVal.new( :value('ModuleLoader.class') )),
:moar(QAST::SVal.new( :value('ModuleLoader.moarvm') )),
:js(QAST::SVal.new( :value('ModuleLoader') ))
)),
$set_outer
:op('ifnull'),
QAST::Op.new(
:op('getcurhllsym'),
QAST::SVal.new( :value('ModuleLoader') ),
),
QAST::Op.new(
:op('loadbytecode'),
QAST::VM.new(
:jvm(QAST::SVal.new( :value('ModuleLoader.class') )),
:moar(QAST::SVal.new( :value('ModuleLoader.moarvm') )),
:js(QAST::SVal.new( :value('ModuleLoader') ))
)
),
),
$set_outer,
)));
}
else {
Expand All @@ -117,13 +125,6 @@ class NQP::World is HLL::World {
# Make sure we do the loading during deserialization.
if self.is_precompilation_mode() {
self.add_load_dependency_task(:deserialize_ast(QAST::Stmts.new(
QAST::Op.new(
:op('loadbytecode'),
QAST::VM.new(
:jvm(QAST::SVal.new( :value('ModuleLoader.class') )),
:moar(QAST::SVal.new( :value('ModuleLoader.moarvm') )),
:js(QAST::SVal.new( :value('ModuleLoader') ))
)),
QAST::Op.new(
:op('callmethod'), :name('load_module'),
QAST::Op.new(
Expand Down

0 comments on commit b930e35

Please sign in to comment.