diff --git a/lib/MAST/Ops.nqp b/lib/MAST/Ops.nqp index c00deb705a..102edaad7f 100644 --- a/lib/MAST/Ops.nqp +++ b/lib/MAST/Ops.nqp @@ -747,16 +747,20 @@ BEGIN { 1854, 1857, 1860, - 1861, 1863, - 1865, - 1867, - 1867, - 1867, - 1868, + 1866, 1869, - 1869, - 1870); + 1872, + 1873, + 1875, + 1877, + 1879, + 1879, + 1879, + 1880, + 1881, + 1881, + 1882); MAST::Ops.WHO<@counts> := nqp::list_i(0, 2, 2, @@ -1500,6 +1504,10 @@ BEGIN { 3, 3, 3, + 3, + 3, + 3, + 3, 1, 2, 2, @@ -3371,6 +3379,18 @@ BEGIN { 65, 16, 57, + 34, + 65, + 16, + 50, + 65, + 16, + 65, + 33, + 16, + 65, + 49, + 16, 66, 34, 65, @@ -4126,17 +4146,21 @@ BEGIN { 'sp_p6obind_i', 740, 'sp_p6obind_n', 741, 'sp_p6obind_s', 742, - 'sp_jit_enter', 743, - 'sp_boolify_iter', 744, - 'sp_boolify_iter_arr', 745, - 'sp_boolify_iter_hash', 746, - 'prof_enter', 747, - 'prof_enterspesh', 748, - 'prof_enterinline', 749, - 'prof_enternative', 750, - 'prof_exit', 751, - 'prof_allocated', 752, - 'ctw_check', 753); + 'sp_deref_get_i64', 743, + 'sp_deref_get_n', 744, + 'sp_deref_bind_i64', 745, + 'sp_deref_bind_n', 746, + 'sp_jit_enter', 747, + 'sp_boolify_iter', 748, + 'sp_boolify_iter_arr', 749, + 'sp_boolify_iter_hash', 750, + 'prof_enter', 751, + 'prof_enterspesh', 752, + 'prof_enterinline', 753, + 'prof_enternative', 754, + 'prof_exit', 755, + 'prof_allocated', 756, + 'ctw_check', 757); MAST::Ops.WHO<@names> := nqp::list_s('no_op', 'const_i8', 'const_i16', @@ -4880,6 +4904,10 @@ BEGIN { 'sp_p6obind_i', 'sp_p6obind_n', 'sp_p6obind_s', + 'sp_deref_get_i64', + 'sp_deref_get_n', + 'sp_deref_bind_i64', + 'sp_deref_bind_n', 'sp_jit_enter', 'sp_boolify_iter', 'sp_boolify_iter_arr', diff --git a/src/core/interp.c b/src/core/interp.c index 2f787fbc35..8083e09586 100644 --- a/src/core/interp.c +++ b/src/core/interp.c @@ -5116,6 +5116,34 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex cur_op += 6; goto NEXT; } + OP(sp_deref_get_i64): { + MVMObject *o = GET_REG(cur_op, 2).o; + MVMint64 **target = ((MVMint64 **)((char *)o + GET_UI16(cur_op, 4))); + GET_REG(cur_op, 0).i64 = **target; + cur_op += 6; + goto NEXT; + } + OP(sp_deref_get_n): { + MVMObject *o = GET_REG(cur_op, 2).o; + MVMnum64 **target = ((MVMnum64 **)((char *)o + GET_UI16(cur_op, 4))); + GET_REG(cur_op, 0).n64 = **target; + cur_op += 6; + goto NEXT; + } + OP(sp_deref_bind_i64): { + MVMObject *o = GET_REG(cur_op, 0).o; + MVMint64 **target = ((MVMint64 **)((char *)o + GET_UI16(cur_op, 4))); + **target = GET_REG(cur_op, 2).i64; + cur_op += 6; + goto NEXT; + } + OP(sp_deref_bind_n): { + MVMObject *o = GET_REG(cur_op, 0).o; + MVMnum64 **target = ((MVMnum64 **)((char *)o + GET_UI16(cur_op, 4))); + **target = GET_REG(cur_op, 2).n64; + cur_op += 6; + goto NEXT; + } OP(sp_jit_enter): { if (tc->cur_frame->spesh_cand->jitcode == NULL) { MVM_exception_throw_adhoc(tc, "Try to enter NULL jitcode"); diff --git a/src/core/oplabels.h b/src/core/oplabels.h index 27c7c1f20e..938366b5ab 100644 --- a/src/core/oplabels.h +++ b/src/core/oplabels.h @@ -744,6 +744,10 @@ static const void * const LABELS[] = { &&OP_sp_p6obind_i, &&OP_sp_p6obind_n, &&OP_sp_p6obind_s, + &&OP_sp_deref_get_i64, + &&OP_sp_deref_get_n, + &&OP_sp_deref_bind_i64, + &&OP_sp_deref_bind_n, &&OP_sp_jit_enter, &&OP_sp_boolify_iter, &&OP_sp_boolify_iter_arr, @@ -1021,10 +1025,6 @@ static const void * const LABELS[] = { NULL, NULL, NULL, - NULL, - NULL, - NULL, - NULL, &&OP_CALL_EXTOP, &&OP_CALL_EXTOP, &&OP_CALL_EXTOP, diff --git a/src/core/oplist b/src/core/oplist index 83811cb55d..cb7f9f6c4d 100644 --- a/src/core/oplist +++ b/src/core/oplist @@ -824,6 +824,12 @@ sp_p6obind_i .s r(obj) int16 r(int64) sp_p6obind_n .s r(obj) int16 r(num64) sp_p6obind_s .s r(obj) int16 r(str) +# Follow a pointer at an offset to an object and get/store a value there. +sp_deref_get_i64 .s w(int64) r(obj) int16 :pure +sp_deref_get_n .s w(num64) r(obj) int16 :pure +sp_deref_bind_i64 .s r(obj) r(int64) int16 +sp_deref_bind_n .s r(obj) r(num64) int16 + # Enter the JIT sp_jit_enter .s w(obj) diff --git a/src/core/ops.c b/src/core/ops.c index 66f6f19733..183712a205 100644 --- a/src/core/ops.c +++ b/src/core/ops.c @@ -8165,6 +8165,50 @@ static const MVMOpInfo MVM_op_infos[] = { 0, { MVM_operand_read_reg | MVM_operand_obj, MVM_operand_int16, MVM_operand_read_reg | MVM_operand_str } }, + { + MVM_OP_sp_deref_get_i64, + "sp_deref_get_i64", + ".s", + 3, + 1, + 0, + 0, + 0, + { MVM_operand_write_reg | MVM_operand_int64, MVM_operand_read_reg | MVM_operand_obj, MVM_operand_int16 } + }, + { + MVM_OP_sp_deref_get_n, + "sp_deref_get_n", + ".s", + 3, + 1, + 0, + 0, + 0, + { MVM_operand_write_reg | MVM_operand_num64, MVM_operand_read_reg | MVM_operand_obj, MVM_operand_int16 } + }, + { + MVM_OP_sp_deref_bind_i64, + "sp_deref_bind_i64", + ".s", + 3, + 0, + 0, + 0, + 0, + { MVM_operand_read_reg | MVM_operand_obj, MVM_operand_read_reg | MVM_operand_int64, MVM_operand_int16 } + }, + { + MVM_OP_sp_deref_bind_n, + "sp_deref_bind_n", + ".s", + 3, + 0, + 0, + 0, + 0, + { MVM_operand_read_reg | MVM_operand_obj, MVM_operand_read_reg | MVM_operand_num64, MVM_operand_int16 } + }, { MVM_OP_sp_jit_enter, "sp_jit_enter", @@ -8285,7 +8329,7 @@ static const MVMOpInfo MVM_op_infos[] = { }, }; -static const unsigned short MVM_op_counts = 754; +static const unsigned short MVM_op_counts = 758; MVM_PUBLIC const MVMOpInfo * MVM_op_get_op(unsigned short op) { if (op >= MVM_op_counts) diff --git a/src/core/ops.h b/src/core/ops.h index e04603ff1f..871edb6571 100644 --- a/src/core/ops.h +++ b/src/core/ops.h @@ -744,17 +744,21 @@ #define MVM_OP_sp_p6obind_i 740 #define MVM_OP_sp_p6obind_n 741 #define MVM_OP_sp_p6obind_s 742 -#define MVM_OP_sp_jit_enter 743 -#define MVM_OP_sp_boolify_iter 744 -#define MVM_OP_sp_boolify_iter_arr 745 -#define MVM_OP_sp_boolify_iter_hash 746 -#define MVM_OP_prof_enter 747 -#define MVM_OP_prof_enterspesh 748 -#define MVM_OP_prof_enterinline 749 -#define MVM_OP_prof_enternative 750 -#define MVM_OP_prof_exit 751 -#define MVM_OP_prof_allocated 752 -#define MVM_OP_ctw_check 753 +#define MVM_OP_sp_deref_get_i64 743 +#define MVM_OP_sp_deref_get_n 744 +#define MVM_OP_sp_deref_bind_i64 745 +#define MVM_OP_sp_deref_bind_n 746 +#define MVM_OP_sp_jit_enter 747 +#define MVM_OP_sp_boolify_iter 748 +#define MVM_OP_sp_boolify_iter_arr 749 +#define MVM_OP_sp_boolify_iter_hash 750 +#define MVM_OP_prof_enter 751 +#define MVM_OP_prof_enterspesh 752 +#define MVM_OP_prof_enterinline 753 +#define MVM_OP_prof_enternative 754 +#define MVM_OP_prof_exit 755 +#define MVM_OP_prof_allocated 756 +#define MVM_OP_ctw_check 757 #define MVM_OP_EXT_BASE 1024 #define MVM_OP_EXT_CU_LIMIT 1024