Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
And so we no longer need list_b.
  • Loading branch information
sorear committed Jun 21, 2013
1 parent 2d3a93c commit f18cb70
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 42 deletions.
39 changes: 1 addition & 38 deletions src/vm/jvm/QAST/Compiler.nqp
Expand Up @@ -646,37 +646,6 @@ QAST::OperationsJAST.add_core_op('list_s', -> $qastcomp, $op {
$arr
}
});
QAST::OperationsJAST.add_core_op('list_b', -> $qastcomp, $op {
# Just desugar to create the empty list.
my $arr := $qastcomp.as_jast(QAST::Op.new(
:op('create'),
QAST::Op.new( :op('hlllist') )
));
if +$op.list {
my $il := JAST::InstructionList.new();
$il.append($arr.jast);
$*STACK.obtain($il, $arr);

for $op.list {
nqp::die("list_b must have a list of blocks")
unless nqp::istype($_, QAST::Block);
$il.append($DUP);
$il.append($ALOAD_0);
$il.append(JAST::PushIndex.new( :value($qastcomp.cuid_to_qbid($_.cuid)) ));
$il.append(JAST::Instruction.new( :op('invokevirtual'),
$TYPE_CU, 'lookupCodeRef', $TYPE_CR, 'I' ));
$il.append($ALOAD_1);
$il.append(JAST::Instruction.new( :op('invokestatic'), $TYPE_OPS, 'push',
$TYPE_SMO, $TYPE_SMO, $TYPE_SMO, $TYPE_TC ));
$il.append($POP);
}

result($il, $RT_OBJ);
}
else {
$arr
}
});
QAST::OperationsJAST.add_core_op('qlist', -> $qastcomp, $op {
$qastcomp.as_jast(QAST::Op.new( :op('list'), |@($op) ))
});
Expand Down Expand Up @@ -2988,12 +2957,6 @@ class QAST::CompilerJAST {
}
$sh_ast := QAST::Block.new( :blocktype('immediate'), $sh_ast );

# Code references.
my $cr_past := QAST::Block.new(
:blocktype('immediate'),
QAST::Op.new( :op('list_b'), |@code_ref_blocks )
);

# Handle repossession conflict resolution code, if any.
if $repo_conf_res {
$repo_conf_res.push(QAST::Var.new( :name('conflicts'), :scope('local') ));
Expand Down Expand Up @@ -3027,7 +2990,7 @@ class QAST::CompilerJAST {
QAST::SVal.new( :value($serialized) ),
QAST::Var.new( :name('cur_sc'), :scope('local') ),
$sh_ast,
QAST::Block.new( :blocktype('immediate'), $cr_past ),
QAST::Op.new( :op('null') ),
QAST::Var.new( :name('conflicts'), :scope('local') )
),
QAST::Op.new(
Expand Down
Expand Up @@ -26,7 +26,7 @@ public abstract class CompilationUnit {
/**
* Mapping of local integer IDs to matching code reference.
*/
private CodeRef[] qbidToCodeRef;
public CodeRef[] qbidToCodeRef;

/**
* Array of all code references.
Expand Down
11 changes: 8 additions & 3 deletions src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -3067,9 +3067,14 @@ public static String deserialize(String blob, SixModelObject scRef, SixModelObje
shArray[i] = tc.native_s;
}

CodeRef[] crArray = new CodeRef[(int)cr.elems(tc)];
for (int i = 0; i < crArray.length; i++)
crArray[i] = (CodeRef)cr.at_pos_boxed(tc, i);
CodeRef[] crArray;
if (cr == null) {
crArray = tc.curFrame.codeRef.staticInfo.compUnit.qbidToCodeRef;
} else {
crArray = new CodeRef[(int)cr.elems(tc)];
for (int i = 0; i < crArray.length; i++)
crArray[i] = (CodeRef)cr.at_pos_boxed(tc, i);
}

SerializationReader sr = new SerializationReader(
tc, sc, shArray, crArray,
Expand Down
Expand Up @@ -89,6 +89,7 @@ public void deserialize() {

// Put code refs in place.
for (int i = 0; i < cr.length; i++) {
if (cr[i] == null) break;
cr[i].isStaticCodeRef = true;
cr[i].sc = sc;
sc.root_codes.add(cr[i]);
Expand Down

0 comments on commit f18cb70

Please sign in to comment.