Permalink
Browse files

Refactor nqp::list_b to create an nqp::list instead of an RPA.

  • Loading branch information...
1 parent 0b76d55 commit 47e8feea39ae00ad38e50bce5ada5f43ca7a8c6f @arnsholt arnsholt committed Mar 15, 2013
Showing with 5 additions and 7 deletions.
  1. +5 −7 src/QAST/Operations.nqp
View
@@ -337,19 +337,17 @@ QAST::Operations.add_core_op('list_s', :inlinable(1), -> $qastcomp, $op {
});
QAST::Operations.add_core_op('list_b', :inlinable(1), -> $qastcomp, $op {
- # Create register for the resulting list and make an empty one.
- my $list_reg := $*REGALLOC.fresh_p();
- my $ops := PIRT::Ops.new(:result($list_reg));
- $ops.push_pirop('new', $list_reg, "'ResizablePMCArray'");
-
- # Push all the things.
+ my $list := $qastcomp.as_post(QAST::Op.new(:op('list')));
+ my $list_reg := $*REGALLOC.fresh_p();
my $block_reg := $*REGALLOC.fresh_p();
+ my $ops := PIRT::Ops.new(:result($list_reg));
+ $ops.push_pirop('assign', $list_reg, $list);
for $op.list {
my $cuid := $_.cuid;
$ops.push_pirop(".const 'Sub' $block_reg = \"$cuid\"");
$ops.push_pirop('push', $list_reg, $block_reg);
}
-
+
$ops
});

0 comments on commit 47e8fee

Please sign in to comment.