Skip to content

Commit

Permalink
Provide hllboxtype_* ops on JVM backend
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jul 11, 2018
1 parent 2b12cad commit 668be5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/vm/jvm/QAST/Compiler.nqp
Expand Up @@ -2630,6 +2630,9 @@ QAST::OperationsJAST.map_classlib_core_op('unbox_s', $TYPE_OPS, 'unbox_s', [$RT_
QAST::OperationsJAST.map_classlib_core_op('box_i', $TYPE_OPS, 'box_i', [$RT_INT, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('box_n', $TYPE_OPS, 'box_n', [$RT_NUM, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('box_s', $TYPE_OPS, 'box_s', [$RT_STR, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('hllboxtype_i', $TYPE_OPS, 'hllboxtype_i', [], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('hllboxtype_n', $TYPE_OPS, 'hllboxtype_n', [], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('hllboxtype_s', $TYPE_OPS, 'hllboxtype_s', [], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('can', $TYPE_OPS, 'can', [$RT_OBJ, $RT_STR], $RT_INT, :tc);
QAST::OperationsJAST.map_classlib_core_op('reprname', $TYPE_OPS, 'reprname', [$RT_OBJ], $RT_STR, :tc);
QAST::OperationsJAST.map_classlib_core_op('newtype', $TYPE_OPS, 'newtype', [$RT_OBJ, $RT_STR], $RT_OBJ, :tc);
Expand Down
9 changes: 9 additions & 0 deletions src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -2760,18 +2760,27 @@ public static long isstr(SixModelObject obj, ThreadContext tc) {
}

/* HLL aware boxing operations */
public static SixModelObject hllboxtype_i(ThreadContext tc) {
return tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.intBoxType;
}
public static SixModelObject hllboxtype_i(long value, ThreadContext tc) {
SixModelObject type = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.intBoxType;
SixModelObject res = type.st.REPR.allocate(tc, type.st);
res.set_int(tc, value);
return res;
}
public static SixModelObject hllboxtype_n(ThreadContext tc) {
return tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.numBoxType;
}
public static SixModelObject hllboxtype_n(double value, ThreadContext tc) {
SixModelObject type = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.numBoxType;
SixModelObject res = type.st.REPR.allocate(tc, type.st);
res.set_num(tc, value);
return res;
}
public static SixModelObject hllboxtype_s(ThreadContext tc) {
return tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.strBoxType;
}
public static SixModelObject hllboxtype_s(String value, ThreadContext tc) {
SixModelObject type = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.strBoxType;
SixModelObject res = type.st.REPR.allocate(tc, type.st);
Expand Down

0 comments on commit 668be5c

Please sign in to comment.