Skip to content

Commit

Permalink
Support --vmlibs on MoarVM.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Oct 24, 2013
1 parent 94b174b commit ad5b106
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/NQP/Compiler.nqp
Expand Up @@ -36,6 +36,7 @@ my @clo := $nqpcomp.commandline_options();
$nqpcomp.addstage('classname', :after<start>);
#?endif
#?if moar
@clo.push('vmlibs=s');
@clo.push('bootstrap');
#?endif

Expand Down
30 changes: 25 additions & 5 deletions src/NQP/World.nqp
Expand Up @@ -489,18 +489,38 @@ class NQP::World is HLL::World {

# Adds libraries that NQP code depends on.
method libs() {
#?if parrot
# Need to load the NQP dynops/dympmcs, plus any extras requested.
my @loadlibs := ['nqp_group', 'nqp_ops', 'nqp_bigint_ops', 'trans_ops', 'io_ops'];
if %*COMPILING<%?OPTIONS><vmlibs> {
for nqp::split(',', %*COMPILING<%?OPTIONS><vmlibs>) {
@loadlibs.push($_);
}
}
QAST::VM.new(
loadlibs => @loadlibs,
jvm => QAST::Op.new( :op('null') ),
moar => QAST::Op.new( :op('null') )
);
QAST::VM.new( :@loadlibs );
#?endif
#?if jvm
QAST::Op.new( :op('null') )
#?endif
#?if moar
my $libs := QAST::Stmts.new();
if %*COMPILING<%?OPTIONS><vmlibs> {
for nqp::split(',', %*COMPILING<%?OPTIONS><vmlibs>) {
my @bits := nqp::split('=', $_);
$libs.push(QAST::VM.new(
:moarop('loadlib'),
QAST::SVal.new( :value(@bits[0]) ),
QAST::SVal.new( :value(@bits[0]) )
));
$libs.push(QAST::VM.new(
:moarop('loadext'),
QAST::SVal.new( :value(@bits[0]) ),
QAST::SVal.new( :value(@bits[1]) )
));
}
}
$libs
#?endif
}

# Adds some initial tasks.
Expand Down

0 comments on commit ad5b106

Please sign in to comment.