Skip to content

Commit

Permalink
Add box_u to both JITs and unbox_i to the template JIT.
Browse files Browse the repository at this point in the history
  • Loading branch information
nwc10 committed Nov 8, 2020
1 parent c2f3e04 commit 01c0950
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/jit/core_templates.expr
Expand Up @@ -892,6 +892,13 @@
(carg $2 ptr)
(carg $1 int)) ptr_sz))

(template: box_u
(call (^func &MVM_repr_box_uint)
(arglist
(carg (tc) ptr)
(carg $2 ptr)
(carg $1 int)) ptr_sz))

(template: box_s
(call (^func &MVM_repr_box_str)
(arglist
Expand All @@ -905,6 +912,14 @@
(carg (tc) ptr)
(carg $1 ptr)) ptr_sz))

(template: unbox_i
(call (^getf (^repr $1) MVMREPROps box_funcs.get_int)
(arglist
(carg (tc) ptr)
(carg (^stable $1) ptr)
(carg $1 ptr)
(carg (^body $1) ptr)) int_sz))

(template: unbox_u
(call (^getf (^repr $1) MVMREPROps box_funcs.get_uint)
(arglist
Expand Down
5 changes: 4 additions & 1 deletion src/jit/graph.c
Expand Up @@ -152,6 +152,7 @@ static void * op_to_func(MVMThreadContext *tc, MVMint16 opcode) {
case MVM_OP_smrt_strify: return MVM_coerce_smart_stringify;
case MVM_OP_gethow: return MVM_6model_get_how_obj;
case MVM_OP_box_i: return MVM_repr_box_int;
case MVM_OP_box_u: return MVM_repr_box_uint;
case MVM_OP_box_s: return MVM_repr_box_str;
case MVM_OP_box_n: return MVM_repr_box_num;
case MVM_OP_unbox_i: return MVM_repr_get_int;
Expand Down Expand Up @@ -862,6 +863,7 @@ static MVMint32 consume_reprop(MVMThreadContext *tc, MVMJitGraph *jg,
type_operand = ins->operands[1];
break;
case MVM_OP_box_i:
case MVM_OP_box_u:
case MVM_OP_box_n:
case MVM_OP_box_s:
type_operand = ins->operands[2];
Expand Down Expand Up @@ -2939,7 +2941,8 @@ static MVMint32 consume_ins(MVMThreadContext *tc, MVMJitGraph *jg,
break;
}
case MVM_OP_box_s:
case MVM_OP_box_i: {
case MVM_OP_box_i:
case MVM_OP_box_u: {
MVMint16 dst = ins->operands[0].reg.orig;
MVMint16 val = ins->operands[1].reg.orig;
MVMint16 type = ins->operands[2].reg.orig;
Expand Down

0 comments on commit 01c0950

Please sign in to comment.