Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Start using the nqp:: ops for SC handling.
  • Loading branch information
jnthn committed Jan 14, 2013
1 parent aa64ea7 commit ff51c75
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/HLL/World.pm
Expand Up @@ -58,7 +58,7 @@ class HLL::World {
$!precomp_mode := %*COMPILING<%?OPTIONS><target> eq 'pir';
$!num_code_refs := 0;
$!code_ref_blocks := [];
$!sc.set_description($description);
nqp::scsetdesc($!sc, $description);

# Add to currently compiling SC stack.
pir::nqp_push_compiling_sc__vP($!sc);
Expand All @@ -75,9 +75,9 @@ class HLL::World {

# Adds an object to the root set, along with a mapping.
method add_object($obj) {
pir::nqp_set_sc_for_object__vPP($obj, $!sc);
my $idx := $!sc.elems();
$!sc[$idx] := $obj;
nqp::setobjsc($obj, $!sc);
my $idx := nqp::scobjcount($!sc);
nqp::scsetobj($!sc, $idx, $obj);
%!addr_to_slot{nqp::where($obj)} := $idx;
$idx
}
Expand All @@ -87,13 +87,13 @@ class HLL::World {
my $code_ref_idx := $!num_code_refs;
$!num_code_refs := $!num_code_refs + 1;
$!code_ref_blocks.push($past_block);
pir::nqp_add_code_ref_to_sc__vPiP($!sc, $code_ref_idx, $code_ref);
nqp::scsetcode($!sc, $code_ref_idx, $code_ref);
$code_ref_idx
}

# Updates a code reference in the root set.
method update_root_code_ref($idx, $new_code_ref) {
pir::nqp_add_code_ref_to_sc__vPiP($!sc, $idx, $new_code_ref);
nqp::scsetcode($!sc, $idx, $new_code_ref);
}

# Checks if we are in pre-compilation mode.
Expand Down
12 changes: 6 additions & 6 deletions src/QAST/Compiler.nqp
Expand Up @@ -309,8 +309,8 @@ class QAST::Compiler is HLL::Compiler {

method deserialization_code($sc, @code_ref_blocks, $repo_conf_res) {
# Serialize it.
my $sh := pir::new__Ps('ResizableStringArray');
my $serialized := pir::nqp_serialize_sc__SPP($sc, $sh);
my $sh := nqp::list_s();
my $serialized := nqp::serialize($sc, $sh);

# Now it's serialized, pop this SC off the compiling SC stack.
pir::nqp_pop_compiling_sc__v();
Expand Down Expand Up @@ -348,7 +348,7 @@ class QAST::Compiler is HLL::Compiler {
QAST::Op.new( :op('createsc'), QAST::SVal.new( :value($sc.handle()) ) )
),
QAST::Op.new(
:op('callmethod'), :name('set_description'),
:op('scsetdesc'),
QAST::Var.new( :name('cur_sc'), :scope('local') ),
QAST::SVal.new( :value($sc.description) )
),
Expand Down Expand Up @@ -945,9 +945,9 @@ class QAST::Compiler is HLL::Compiler {

multi method as_post(QAST::WVal $node, :$want) {
my $val := $node.value;
my $sc := pir::nqp_get_sc_for_object__PP($val);
my $handle := $sc.handle;
my $idx := $sc.slot_index_for($val);
my $sc := nqp::getobjsc($val);
my $handle := nqp::scgethandle($sc);
my $idx := nqp::scgetobjidx($sc, $val);
my $reg := $*REGALLOC.fresh_p();
my $ops := PIRT::Ops.new(:result($reg));
$ops.push_pirop('nqp_get_sc_object', $reg, self.escape($handle), ~$idx);
Expand Down

0 comments on commit ff51c75

Please sign in to comment.