Permalink
Browse files

nqp::gethllsym and nqp::bindhllsym

Like getcurhllsym/bindcurhllsym, but with the HLL specified.
  • Loading branch information...
jnthn committed Mar 14, 2013
1 parent 6bd6a25 commit 47effd6b48d5ab958a05c87f0759af29b59f4e44
Showing with 21 additions and 0 deletions.
  1. +21 −0 src/QAST/Operations.nqp
View
@@ -1978,6 +1978,27 @@ QAST::Operations.add_core_pirop_mapping('bindcomp', 'compreg', '1sP');
QAST::Operations.add_core_pirop_mapping('getcurhllsym', 'get_hll_global', 'Ps');
QAST::Operations.add_core_pirop_mapping('bindcurhllsym', 'set_hll_global', '1sP');
QAST::Operations.add_core_pirop_mapping('loadbytecode', 'load_bytecode', '0s');
+QAST::Operations.add_core_op('gethllsym', -> $qastcomp, $op {
+ if +@($op) != 2 {
+ nqp::die('gethllsym requires two operands');
+ }
+ $qastcomp.as_post(QAST::VM.new(
+ :pirop('get_root_global__PPs'),
+ QAST::Op.new( :op('list_s'), $op[0] ),
+ $op[1]
+ ))
+});
+QAST::Operations.add_core_op('bindhllsym', -> $qastcomp, $op {
+ if +@($op) != 3 {
+ nqp::die('bindhllsym requires three operands');
+ }
+ $qastcomp.as_post(QAST::VM.new(
+ :pirop('set_root_global__2PsP'),
+ QAST::Op.new( :op('list_s'), $op[0] ),
+ $op[1],
+ $op[2]
+ ))
+});
QAST::Operations.add_core_op('sethllconfig', -> $qastcomp, $op {
# XXX Not really implemented here.
my $ops := PIRT::Ops.new();

0 comments on commit 47effd6

Please sign in to comment.