Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement getting list of compunit coderefs.
Gets dynamic compilation unbusted, which helps towards fixing the
roles test.
  • Loading branch information
jnthn committed Feb 28, 2013
1 parent 431f8fb commit c096b92
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/QAST/JASTCompiler.nqp
Expand Up @@ -1866,6 +1866,7 @@ QAST::OperationsJAST.map_classlib_core_op('compilejast', $TYPE_OPS, 'compilejast
QAST::OperationsJAST.map_classlib_core_op('loadcompunit', $TYPE_OPS, 'loadcompunit', [$RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('iscompunit', $TYPE_OPS, 'iscompunit', [$RT_OBJ], $RT_INT, :tc);
QAST::OperationsJAST.map_classlib_core_op('compunitmainline', $TYPE_OPS, 'compunitmainline', [$RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('compunitcodes', $TYPE_OPS, 'compunitcodes', [$RT_OBJ], $RT_OBJ, :tc);

class QAST::CompilerJAST {
# Responsible for handling issues around code references, building the
Expand Down
2 changes: 1 addition & 1 deletion nqp-src/NQPHLL.pm
Expand Up @@ -930,7 +930,7 @@ class HLL::Backend::JVM {
}

method compunit_coderefs($cu) {
nqp::die("NYI");
__JVM__compunitcodes($cu)
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -3188,4 +3188,13 @@ public static SixModelObject compunitmainline(SixModelObject obj, ThreadContext
EvalResult res = (EvalResult)obj;
return res.cu.codeRefs[0];
}
public static SixModelObject compunitcodes(SixModelObject obj, ThreadContext tc) {
EvalResult res = (EvalResult)obj;
SixModelObject Array = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.listType;
SixModelObject result = Array.st.REPR.allocate(tc, Array.st);
result.initialize(tc);
for (int i = 0; i < res.cu.codeRefs.length; i++)
result.bind_pos_boxed(tc, i, res.cu.codeRefs[i]);
return result;
}
}

0 comments on commit c096b92

Please sign in to comment.