Mercurial > hg > Members > anatofuz > MoarVM
view src/core/cbc-interp.cbc @ 58:8d11db1824de
synchronize cur_op's
author | anatofuz |
---|---|
date | Fri, 18 Jan 2019 18:03:13 +0900 |
parents | 165f102e3869 |
children | 18916fa4f32c |
line wrap: on
line source
#include "moar.h" #include <math.h> #include "platform/time.h" #include "platform/sys.h" #include "strings/unicode_ops.h" #include "oplables-cbc-codes.h" /* Macros for getting things from the bytecode stream. */ #if MVM_GC_DEBUG == 2 MVM_STATIC_INLINE MVMuint16 check_reg(MVMThreadContext *tc, MVMRegister *reg_base, MVMuint16 idx) { MVMFrame *f = tc->cur_frame; MVMuint16 kind = f->spesh_cand && f->spesh_cand->local_types ? f->spesh_cand->local_types[idx] : f->static_info->body.local_types[idx]; if (kind == MVM_reg_obj || kind == MVM_reg_str) MVM_ASSERT_NOT_FROMSPACE(tc, reg_base[idx].o); return idx; } /* The bytecode stream is OPs (16 bit numbers) followed by the (16 bit numbers) of the registers * the OP needs (return register + argument registers. The pc will point to the first place after * the current op, i.e. the first 16 bit register number. We add the requested number to that and * use the result as index into the reg_base array which stores the frame's locals. */ #define GET_REG(pc, idx,i) (i.reg_base[check_reg(i.tc, i.reg_base, *((MVMuint16 *)(pc + idx)))]) #else #define GET_REG(pc, idx,i) (i.reg_base[*((MVMuint16 *)(pc + idx))]) #endif #if MVM_GC_DEBUG == 2 MVM_STATIC_INLINE MVMuint16 check_lex(MVMThreadContext *tc, MVMFrame *f, MVMuint16 idx) { MVMuint16 kind = f->spesh_cand && f->spesh_cand->lexical_types ? f->spesh_cand->lexical_types[idx] : f->static_info->body.lexical_types[idx]; if (kind == MVM_reg_obj || kind == MVM_reg_str) MVM_ASSERT_NOT_FROMSPACE(tc, f->env[idx].o); return idx; } #define GET_LEX(pc, idx, f,i) f->env[check_lex(i.tc, f, *((MVMuint16 *)(pc + idx)))] #else #define GET_LEX(pc, idx, f,i) f->env[*((MVMuint16 *)(pc + idx))] #endif #define GET_I16(pc, idx) *((MVMint16 *)(pc + idx)) #define GET_UI16(pc, idx) *((MVMuint16 *)(pc + idx)) #define GET_I32(pc, idx) *((MVMint32 *)(pc + idx)) #define GET_UI32(pc, idx) *((MVMuint32 *)(pc + idx)) #define GET_N32(pc, idx) *((MVMnum32 *)(pc + idx)) #define NEXT_OP(i) (i.op = *(MVMuint16 *)(i.cur_op), i.cur_op += 2, i.op) #if MVM_CGOTO #define DISPATCH(op) {goto (CODES[op])(i);} #define OP(name) OP_ ## name #define NEXT(i) CODES[NEXT_OP(i)](i) #else #define DISPATCH(op) switch (op) #define OP(name) case MVM_OP_ ## name #define NEXT runloop #endif static int tracing_enabled = 0; static int op_count=0; int cbc_trace=0; // #define ddd(x) printf("count=%d op=%d cur_op=%p reg[0]=%p reg[2]=%p \n", op_count++, *i.cur_op, i.cur_op, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).o) #define ddd(x) ((op_count++,cbc_trace)?printf("count=%d op=%d\n", op_count, *(MVMuint16 *)i.cur_op):0) //#define ddd(x) (op_count++) // #define ddd(x) 0 __code cbc_next(INTER i){ i.tc->interp_cur_op = &i.cur_op; i.tc->interp_bytecode_start = &i.bytecode_start; i.tc->interp_reg_base = &i.reg_base; i.tc->interp_cu = &i.cu; __code (*c)(INTER); ddd(0); c = CODES[NEXT_OP(i)]; i.tc->gc_status=0; goto c(i); } __code cbc_no_op(INTER i){ goto cbc_next(i); } __code cbc_const_i8(INTER i){ goto cbc_const_i16(i); } __code cbc_const_i16(INTER i){ goto cbc_const_i32(i); } __code cbc_const_i32(INTER i){ MVM_exception_throw_adhoc(i.tc, "const_iX NYI"); goto cbc_const_i64(i); } __code cbc_const_i64(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_BC_get_I64(i.cur_op, 2); i.cur_op += 10; goto cbc_next(i); } __code cbc_const_n32(INTER i){ MVM_exception_throw_adhoc(i.tc, "const_n32 NYI"); goto cbc_const_n64(i); } __code cbc_const_n64(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_BC_get_N64(i.cur_op, 2); i.cur_op += 10; goto cbc_next(i); } __code cbc_const_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)); i.cur_op += 6; goto cbc_next(i); } __code cbc_set(INTER i){ GET_REG(i.cur_op, 0,i) = GET_REG(i.cur_op, 2,i); i.cur_op += 4; goto cbc_next(i); } __code cbc_extend_u8(INTER i){ GET_REG(i.cur_op, 0,i).u64 = (MVMuint64)GET_REG(i.cur_op, 2,i).u8; i.cur_op += 4; goto cbc_next(i); } __code cbc_extend_u16(INTER i){ GET_REG(i.cur_op, 0,i).u64 = (MVMuint64)GET_REG(i.cur_op, 2,i).u16; i.cur_op += 4; goto cbc_next(i); } __code cbc_extend_u32(INTER i){ GET_REG(i.cur_op, 0,i).u64 = (MVMuint64)GET_REG(i.cur_op, 2,i).u32; i.cur_op += 4; goto cbc_next(i); } __code cbc_extend_i8(INTER i){ GET_REG(i.cur_op, 0,i).i64 = (MVMint64)GET_REG(i.cur_op, 2,i).i8; i.cur_op += 4; goto cbc_next(i); } __code cbc_extend_i16(INTER i){ GET_REG(i.cur_op, 0,i).i64 = (MVMint64)GET_REG(i.cur_op, 2,i).i16; i.cur_op += 4; goto cbc_next(i); } __code cbc_extend_i32(INTER i){ GET_REG(i.cur_op, 0,i).i64 = (MVMint64)GET_REG(i.cur_op, 2,i).i32; i.cur_op += 4; goto cbc_next(i); } __code cbc_trunc_u8(INTER i){ GET_REG(i.cur_op, 0,i).u8 = (MVMuint8)GET_REG(i.cur_op, 2,i).u64; i.cur_op += 4; goto cbc_next(i); } __code cbc_trunc_u16(INTER i){ GET_REG(i.cur_op, 0,i).u16 = (MVMuint16)GET_REG(i.cur_op, 2,i).u64; i.cur_op += 4; goto cbc_next(i); } __code cbc_trunc_u32(INTER i){ GET_REG(i.cur_op, 0,i).u32 = (MVMuint32)GET_REG(i.cur_op, 2,i).u64; i.cur_op += 4; goto cbc_next(i); } __code cbc_trunc_i8(INTER i){ GET_REG(i.cur_op, 0,i).i8 = (MVMint8)GET_REG(i.cur_op, 2,i).i64; i.cur_op += 4; goto cbc_next(i); } __code cbc_trunc_i16(INTER i){ GET_REG(i.cur_op, 0,i).i16 = (MVMint16)GET_REG(i.cur_op, 2,i).i64; i.cur_op += 4; goto cbc_next(i); } __code cbc_trunc_i32(INTER i){ GET_REG(i.cur_op, 0,i).i32 = (MVMint32)GET_REG(i.cur_op, 2,i).i64; i.cur_op += 4; goto cbc_next(i); } __code cbc_extend_n32(INTER i){ GET_REG(i.cur_op, 0,i).n64 = (MVMnum64)GET_REG(i.cur_op, 2,i).n32; i.cur_op += 4; goto cbc_next(i); } __code cbc_trunc_n32(INTER i){ GET_REG(i.cur_op, 0,i).n32 = (MVMnum32)GET_REG(i.cur_op, 2,i).n64; i.cur_op += 4; goto cbc_next(i); } __code cbc_goto(INTER i){ i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 0); GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_if_i(INTER i){ if (GET_REG(i.cur_op, 0,i).i64) i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 2); else i.cur_op += 6; GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_unless_i(INTER i){ if (GET_REG(i.cur_op, 0,i).i64) i.cur_op += 6; else i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 2); GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_if_n(INTER i){ if (GET_REG(i.cur_op, 0,i).n64 != 0.0) i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 2); else i.cur_op += 6; GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_unless_n(INTER i){ if (GET_REG(i.cur_op, 0,i).n64 != 0.0) i.cur_op += 6; else i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 2); GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_if_s(INTER i){ MVMString *str = GET_REG(i.cur_op, 0,i).s; if (!str || MVM_string_graphs(i.tc, str) == 0) i.cur_op += 6; else i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 2); GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_unless_s(INTER i){ MVMString *str = GET_REG(i.cur_op, 0,i).s; if (!str || MVM_string_graphs(i.tc, str) == 0) i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 2); else i.cur_op += 6; GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_if_s0(INTER i){ MVMString *str = GET_REG(i.cur_op, 0,i).s; if (!MVM_coerce_istrue_s(i.tc, str)) i.cur_op += 6; else i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 2); GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_unless_s0(INTER i){ MVMString *str = GET_REG(i.cur_op, 0,i).s; if (!MVM_coerce_istrue_s(i.tc, str)) i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 2); else i.cur_op += 6; GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_if_o(INTER i){ GC_SYNC_POINT(i.tc); MVM_coerce_istrue(i.tc, GET_REG(i.cur_op, 0,i).o, NULL, i.bytecode_start + GET_UI32(i.cur_op, 2), i.cur_op + 6, 0); goto cbc_next(i); } __code cbc_unless_o(INTER i){ GC_SYNC_POINT(i.tc); MVM_coerce_istrue(i.tc, GET_REG(i.cur_op, 0,i).o, NULL, i.bytecode_start + GET_UI32(i.cur_op, 2), i.cur_op + 6, 1); goto cbc_next(i); } __code cbc_jumplist(INTER i){ MVMint64 num_labels = MVM_BC_get_I64(i.cur_op, 0); MVMint64 input = GET_REG(i.cur_op, 8,i).i64; i.cur_op += 10; /* the goto ops are guaranteed valid/existent by validation.c */ if (input < 0 || input >= num_labels) { /* implicitly covers num_labels == 0 */ /* skip the entire goto list block */ i.cur_op += (6 /* size of each goto op */) * num_labels; } else { /* delve directly into the selected goto op */ i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, input * (6 /* size of each goto op */) + (2 /* size of the goto instruction itself */)); } GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_getlex(INTER i){ MVMFrame *f = i.tc->cur_frame; MVMuint16 idx = GET_UI16(i.cur_op, 2); MVMuint16 outers = GET_UI16(i.cur_op, 4); MVMuint16 *lexical_types; while (outers) { if (!f->outer) MVM_exception_throw_adhoc(i.tc, "getlex: outer index out of range"); f = f->outer; outers--; } lexical_types = f->spesh_cand && f->spesh_cand->lexical_types ? f->spesh_cand->lexical_types : f->static_info->body.lexical_types; if (lexical_types[idx] == MVM_reg_obj) { MVMRegister found = GET_LEX(i.cur_op, 2, f,i); MVMObject *value = found.o == NULL ? MVM_frame_vivify_lexical(i.tc, f, idx) : found.o; GET_REG(i.cur_op, 0,i).o = value; if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_type(i.tc, value); } else { GET_REG(i.cur_op, 0,i) = GET_LEX(i.cur_op, 2, f,i); } i.cur_op += 6; goto cbc_next(i); } __code cbc_bindlex(INTER i){ MVMFrame *f = i.tc->cur_frame; MVMuint16 outers = GET_UI16(i.cur_op, 2); MVMuint16 kind = f->spesh_cand && f->spesh_cand->local_types ? f->spesh_cand->local_types[GET_UI16(i.cur_op, 4)] : f->static_info->body.local_types[GET_UI16(i.cur_op, 4)]; while (outers) { if (!f->outer) MVM_exception_throw_adhoc(i.tc, "bindlex: outer index out of range"); f = f->outer; outers--; } if (kind == MVM_reg_obj || kind == MVM_reg_str) { #if MVM_GC_DEGUG MVM_ASSERT_NOT_FROMSPACE(i.tc, GET_REG(i.cur_op, 4,i).o); #endif MVM_ASSIGN_REF(i.tc, &(f->header), GET_LEX(i.cur_op, 0, f,i).o, GET_REG(i.cur_op, 4,i).o); } else { GET_LEX(i.cur_op, 0, f,i) = GET_REG(i.cur_op, 4,i); } i.cur_op += 6; goto cbc_next(i); } __code cbc_getlex_ni(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_frame_find_lexical_by_name(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_reg_int64)->i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_getlex_nn(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_frame_find_lexical_by_name(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_reg_num64)->n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_getlex_ns(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_frame_find_lexical_by_name(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_reg_str)->s; i.cur_op += 6; goto cbc_next(i); } __code cbc_getlex_no(INTER i){ MVMRegister *found = MVM_frame_find_lexical_by_name(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_reg_obj); if (found) { GET_REG(i.cur_op, 0,i).o = found->o; if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_type(i.tc, found->o); } else { GET_REG(i.cur_op, 0,i).o = i.tc->instance->VMNull; } i.cur_op += 6; goto cbc_next(i); } __code cbc_bindlex_ni(INTER i){ MVM_frame_bind_lexical_by_name(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 0)), MVM_reg_int64, &(GET_REG(i.cur_op, 4,i))); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindlex_nn(INTER i){ MVM_frame_bind_lexical_by_name(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 0)), MVM_reg_num64, &(GET_REG(i.cur_op, 4,i))); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindlex_ns(INTER i){ MVM_frame_bind_lexical_by_name(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 0)), MVM_reg_str, &(GET_REG(i.cur_op, 4,i))); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindlex_no(INTER i){ MVM_frame_bind_lexical_by_name(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 0)), MVM_reg_obj, &(GET_REG(i.cur_op, 4,i))); i.cur_op += 6; goto cbc_next(i); } __code cbc_getlex_ng(INTER i){ goto cbc_bindlex_ng(i); } __code cbc_bindlex_ng(INTER i){ MVM_exception_throw_adhoc(i.tc, "get/bindlex_ng NYI"); goto cbc_getdynlex(i); } __code cbc_getdynlex(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_frame_getdynlex(i.tc, GET_REG(i.cur_op, 2,i).s, i.tc->cur_frame->caller); i.cur_op += 4; goto cbc_next(i); } __code cbc_binddynlex(INTER i){ MVM_frame_binddynlex(i.tc, GET_REG(i.cur_op, 0,i).s, GET_REG(i.cur_op, 2,i).o, i.tc->cur_frame->caller); i.cur_op += 4; goto cbc_next(i); } __code cbc_setlexvalue(INTER i){ MVMObject *code = GET_REG(i.cur_op, 0,i).o; MVMString *name = MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)); MVMObject *val = GET_REG(i.cur_op, 6,i).o; MVMint16 flag = GET_I16(i.cur_op, 8); if (flag < 0 || flag > 2) MVM_exception_throw_adhoc(i.tc, "setlexvalue provided with invalid flag"); if (IS_CONCRETE(code) && REPR(code)->ID == MVM_REPR_ID_MVMCode) { MVMStaticFrame *sf = ((MVMCode *)code)->body.sf; MVMuint8 found = 0; if (!sf->body.fully_deserialized) MVM_bytecode_finish_frame(i.tc, sf->body.cu, sf, 0); if (sf->body.lexical_names) { MVMLexicalRegistry *entry; MVM_HASH_GET(i.tc, sf->body.lexical_names, name, entry); if (entry && sf->body.lexical_types[entry->value] == MVM_reg_obj) { MVM_ASSIGN_REF(i.tc, &(sf->common.header), sf->body.static_env[entry->value].o, val); sf->body.static_env_flags[entry->value] = (MVMuint8)flag; found = 1; } } if (!found) MVM_exception_throw_adhoc(i.tc, "setstaticlex given invalid lexical name"); } else { MVM_exception_throw_adhoc(i.tc, "setstaticlex needs a code ref"); } i.cur_op += 10; goto cbc_next(i); } __code cbc_lexprimspec(INTER i){ MVMObject *ctx = GET_REG(i.cur_op, 2,i).o; MVMString *name = GET_REG(i.cur_op, 4,i).s; if (REPR(ctx)->ID != MVM_REPR_ID_MVMContext || !IS_CONCRETE(ctx)) MVM_exception_throw_adhoc(i.tc, "lexprimspec needs a context"); GET_REG(i.cur_op, 0,i).i64 = MVM_frame_lexical_primspec(i.tc, ((MVMContext *)ctx)->body.context, name); i.cur_op += 6; goto cbc_next(i); } __code cbc_return_i(INTER i){ if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_return_type(i.tc, NULL); MVM_args_set_result_int(i.tc, GET_REG(i.cur_op, 0,i).i64, MVM_RETURN_CALLER_FRAME); if (MVM_frame_try_return(i.tc) == 0) goto cbc_return_label(i); goto cbc_next(i); } __code cbc_return_n(INTER i){ if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_return_type(i.tc, NULL); MVM_args_set_result_num(i.tc, GET_REG(i.cur_op, 0,i).n64, MVM_RETURN_CALLER_FRAME); if (MVM_frame_try_return(i.tc) == 0) goto cbc_return_label(i); goto cbc_next(i); } __code cbc_return_s(INTER i){ if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_return_type(i.tc, NULL); MVM_args_set_result_str(i.tc, GET_REG(i.cur_op, 0,i).s, MVM_RETURN_CALLER_FRAME); if (MVM_frame_try_return(i.tc) == 0) goto cbc_return_label(i); goto cbc_next(i); } __code cbc_return_o(INTER i){ MVMObject *value = GET_REG(i.cur_op, 0, i).o; if (MVM_spesh_log_is_logging(i.tc)) { MVMROOT(i.tc, value, { MVM_spesh_log_return_type(i.tc, value); }); } MVM_args_set_result_obj(i.tc, value, MVM_RETURN_CALLER_FRAME); if (MVM_frame_try_return(i.tc) == 0) goto cbc_return_label(i); goto cbc_next(i); } __code cbc_return(INTER i){ if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_return_type(i.tc, NULL); MVM_args_assert_void_return_ok(i.tc, MVM_RETURN_CALLER_FRAME); if (MVM_frame_try_return(i.tc) == 0) goto cbc_return_label(i); goto cbc_next(i); } __code cbc_eq_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 == GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_ne_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 != GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_lt_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 < GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_le_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 <= GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_gt_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 > GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_ge_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 >= GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_cmp_i(INTER i){ MVMint64 a = GET_REG(i.cur_op, 2,i).i64, b = GET_REG(i.cur_op, 4,i).i64; GET_REG(i.cur_op, 0,i).i64 = (a > b) - (a < b); i.cur_op += 6; goto cbc_next(i); } __code cbc_add_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 + GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_sub_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 - GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_mul_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 * GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_div_i(INTER i){ MVMint64 num = GET_REG(i.cur_op, 2,i).i64; MVMint64 denom = GET_REG(i.cur_op, 4,i).i64; /* if we have a negative result, make sure we floor rather * than rounding towards zero. */ if (denom == 0) MVM_exception_throw_adhoc(i.tc, "Division by zero"); if ((num < 0) ^ (denom < 0)) { if ((num % denom) != 0) { GET_REG(i.cur_op, 0,i).i64 = num / denom - 1; } else { GET_REG(i.cur_op, 0,i).i64 = num / denom; } } else { GET_REG(i.cur_op, 0,i).i64 = num / denom; } i.cur_op += 6; goto cbc_next(i); } __code cbc_div_u(INTER i){ GET_REG(i.cur_op, 0,i).u64 = GET_REG(i.cur_op, 2,i).u64 / GET_REG(i.cur_op, 4,i).u64; i.cur_op += 6; goto cbc_next(i); } __code cbc_mod_i(INTER i){ MVMint64 numer = GET_REG(i.cur_op, 2,i).i64; MVMint64 denom = GET_REG(i.cur_op, 4,i).i64; if (denom == 0) MVM_exception_throw_adhoc(i.tc, "Modulation by zero"); GET_REG(i.cur_op, 0,i).i64 = numer % denom; i.cur_op += 6; goto cbc_next(i); } __code cbc_mod_u(INTER i){ GET_REG(i.cur_op, 0,i).u64 = GET_REG(i.cur_op, 2,i).u64 % GET_REG(i.cur_op, 4,i).u64; i.cur_op += 6; goto cbc_next(i); } __code cbc_neg_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = -GET_REG(i.cur_op, 2,i).i64; i.cur_op += 4; goto cbc_next(i); } __code cbc_abs_i(INTER i){ MVMint64 v = GET_REG(i.cur_op, 2,i).i64, mask = v >> 63; GET_REG(i.cur_op, 0,i).i64 = (v + mask) ^ mask; i.cur_op += 4; goto cbc_next(i); } __code cbc_inc_i(INTER i){ GET_REG(i.cur_op, 0,i).i64++; i.cur_op += 2; goto cbc_next(i); } __code cbc_inc_u(INTER i){ GET_REG(i.cur_op, 0,i).u64++; i.cur_op += 2; goto cbc_next(i); } __code cbc_dec_i(INTER i){ GET_REG(i.cur_op, 0,i).i64--; i.cur_op += 2; goto cbc_next(i); } __code cbc_dec_u(INTER i){ GET_REG(i.cur_op, 0,i).u64--; i.cur_op += 2; goto cbc_next(i); } __code cbc_band_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 & GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_bor_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 | GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_bxor_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 ^ GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_bnot_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = ~GET_REG(i.cur_op, 2,i).i64; i.cur_op += 4; goto cbc_next(i); } __code cbc_blshift_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 << GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_brshift_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 >> GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_pow_i(INTER i){ MVMint64 base = GET_REG(i.cur_op, 2,i).i64; MVMint64 exp = GET_REG(i.cur_op, 4,i).i64; MVMint64 result = 1; /* "Exponentiation by squaring" */ if (exp < 0) { result = 0; /* because 1/base**-exp is between 0 and 1 */ } else { while (exp) { if (exp & 1) result *= base; exp >>= 1; base *= base; } } GET_REG(i.cur_op, 0,i).i64 = result; i.cur_op += 6; goto cbc_next(i); } __code cbc_not_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).i64 ? 0 : 1; i.cur_op += 4; goto cbc_next(i); } __code cbc_gcd_i(INTER i){ MVMint64 a = labs(GET_REG(i.cur_op, 2,i).i64), b = labs(GET_REG(i.cur_op, 4,i).i64), c; while ( b != 0 ) { c = a % b; a = b; b = c; } GET_REG(i.cur_op, 0,i).i64 = a; i.cur_op += 6; goto cbc_next(i); } __code cbc_lcm_i(INTER i){ MVMint64 a = GET_REG(i.cur_op, 2,i).i64, b = GET_REG(i.cur_op, 4,i).i64, c, a_ = a, b_ = b; while ( b != 0 ) { c = a % b; a = b; b = c; } c = a; GET_REG(i.cur_op, 0,i).i64 = a_ / c * b_; i.cur_op += 6; goto cbc_next(i); } __code cbc_eq_n(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).n64 == GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_ne_n(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).n64 != GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_lt_n(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).n64 < GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_le_n(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).n64 <= GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_gt_n(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).n64 > GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_ge_n(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).n64 >= GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_cmp_n(INTER i){ MVMnum64 a = GET_REG(i.cur_op, 2,i).n64, b = GET_REG(i.cur_op, 4,i).n64; GET_REG(i.cur_op, 0,i).i64 = (a > b) - (a < b); i.cur_op += 6; goto cbc_next(i); } __code cbc_add_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = GET_REG(i.cur_op, 2,i).n64 + GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_sub_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = GET_REG(i.cur_op, 2,i).n64 - GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_mul_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = GET_REG(i.cur_op, 2,i).n64 * GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_div_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = GET_REG(i.cur_op, 2,i).n64 / GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_mod_n(INTER i){ MVMnum64 a = GET_REG(i.cur_op, 2,i).n64; MVMnum64 b = GET_REG(i.cur_op, 4,i).n64; GET_REG(i.cur_op, 0,i).n64 = b == 0 ? a : a - b * floor(a / b); i.cur_op += 6; goto cbc_next(i); } __code cbc_neg_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = -GET_REG(i.cur_op, 2,i).n64; i.cur_op += 4; goto cbc_next(i); } __code cbc_abs_n(INTER i){ { MVMnum64 num = GET_REG(i.cur_op, 2,i).n64; /* The 1.0/num logic checks for a negative zero */ if (num < 0 || (num == 0 && 1.0/num < 0) ) num = num * -1; GET_REG(i.cur_op, 0,i).n64 = num; i.cur_op += 4; } goto cbc_next(i); } __code cbc_pow_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = pow(GET_REG(i.cur_op, 2,i).n64, GET_REG(i.cur_op, 4,i).n64); i.cur_op += 6; goto cbc_next(i); } __code cbc_ceil_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = ceil(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_floor_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = floor(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_sin_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = sin(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_asin_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = asin(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_cos_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = cos(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_acos_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = acos(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_tan_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = tan(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_atan_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = atan(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_atan2_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = atan2(GET_REG(i.cur_op, 2,i).n64, GET_REG(i.cur_op, 4,i).n64); i.cur_op += 6; goto cbc_next(i); } __code cbc_sec_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = 1.0 / cos(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_asec_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = acos(1.0 / GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_sinh_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = sinh(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_cosh_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = cosh(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_tanh_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = tanh(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_sech_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = 1.0 / cosh(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_sqrt_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = sqrt(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_log_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = log(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_exp_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = exp(GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_in(INTER i){ GET_REG(i.cur_op, 0,i).n64 = (MVMnum64)GET_REG(i.cur_op, 2,i).i64; i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_ni(INTER i){ GET_REG(i.cur_op, 0,i).i64 = (MVMint64)GET_REG(i.cur_op, 2,i).n64; i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_is(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_coerce_i_s(i.tc, GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_ns(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_coerce_n_s(i.tc, GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_si(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_coerce_s_i(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_sn(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_coerce_s_n(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_smrt_numify(INTER i){ /* Increment PC before calling coercer, as it may make * a method call to get the result. */ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMRegister *res = &GET_REG(i.cur_op, 0,i); i.cur_op += 4; MVM_coerce_smart_numify(i.tc, obj, res); goto cbc_next(i); } __code cbc_smrt_strify(INTER i){ /* Increment PC before calling coercer, as it may make * a method call to get the result. */ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMRegister *res = &GET_REG(i.cur_op, 0,i); i.cur_op += 4; MVM_coerce_smart_stringify(i.tc, obj, res); goto cbc_next(i); } __code cbc_prepargs(INTER i){ /* Store callsite in the frame so that the GC knows how to mark * any arguments. Note that since none of the arg-setting ops can * trigger GC, there's no way the setup can be interrupted, so we * don't need to clear the args buffer before we start. */ i.cur_callsite =i.cu->body.callsites[GET_UI16(i.cur_op, 0)]; i.tc->cur_frame->cur_args_callsite = i.cur_callsite; i.cur_op += 2; goto cbc_next(i); } __code cbc_arg_i(INTER i){ i.tc->cur_frame->args[GET_UI16(i.cur_op, 0)].i64 = GET_REG(i.cur_op, 2,i).i64; i.cur_op += 4; goto cbc_next(i); } __code cbc_arg_n(INTER i){ i.tc->cur_frame->args[GET_UI16(i.cur_op, 0)].n64 = GET_REG(i.cur_op, 2,i).n64; i.cur_op += 4; goto cbc_next(i); } __code cbc_arg_s(INTER i){ i.tc->cur_frame->args[GET_UI16(i.cur_op, 0)].s = GET_REG(i.cur_op, 2,i).s; i.cur_op += 4; goto cbc_next(i); } __code cbc_arg_o(INTER i){ i.tc->cur_frame->args[GET_UI16(i.cur_op, 0)].o = GET_REG(i.cur_op, 2,i).o; i.cur_op += 4; goto cbc_next(i); } __code cbc_argconst_i(INTER i){ i.tc->cur_frame->args[GET_UI16(i.cur_op, 0)].i64 = MVM_BC_get_I64(i.cur_op, 2); i.cur_op += 10; goto cbc_next(i); } __code cbc_argconst_n(INTER i){ i.tc->cur_frame->args[GET_UI16(i.cur_op, 0)].n64 = MVM_BC_get_N64(i.cur_op, 2); i.cur_op += 10; goto cbc_next(i); } __code cbc_argconst_s(INTER i){ i.tc->cur_frame->args[GET_UI16(i.cur_op, 0)].s = MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)); i.cur_op += 6; goto cbc_next(i); } __code cbc_invoke_v(INTER i){ MVMObject *code = GET_REG(i.cur_op, 0,i).o; MVMRegister *args = i.tc->cur_frame->args; MVMuint16 was_multi = 0; /* was_multi argument is MVMuint16* */ code = MVM_frame_find_invokee_multi_ok(i.tc, code, &i.cur_callsite, args, &was_multi); if (MVM_spesh_log_is_logging(i.tc)) { MVMROOT(i.tc, code, { /* was_multi is MVMint16 */ MVM_spesh_log_invoke_target(i.tc, code, was_multi); }); } i.tc->cur_frame->return_value = NULL; i.tc->cur_frame->return_type = MVM_RETURN_VOID; i.cur_op += 2; i.tc->cur_frame->return_address = i.cur_op; STABLE(code)->invoke(i.tc, code, i.cur_callsite, args); goto cbc_next(i); } __code cbc_invoke_i(INTER i){ MVMObject *code = GET_REG(i.cur_op, 2,i).o; MVMRegister *args = i.tc->cur_frame->args; MVMuint16 was_multi = 0; code = MVM_frame_find_invokee_multi_ok(i.tc, code, &i.cur_callsite, args, &was_multi); if (MVM_spesh_log_is_logging(i.tc)) { MVMROOT(i.tc, code, { MVM_spesh_log_invoke_target(i.tc, code, was_multi); }); } i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_INT; i.cur_op += 4; i.tc->cur_frame->return_address = i.cur_op; STABLE(code)->invoke(i.tc, code, i.cur_callsite, args); goto cbc_next(i); } __code cbc_invoke_n(INTER i){ MVMObject *code = GET_REG(i.cur_op, 2,i).o; MVMRegister *args = i.tc->cur_frame->args; MVMuint16 was_multi = 0; code = MVM_frame_find_invokee_multi_ok(i.tc, code, &i.cur_callsite, args, &was_multi); if (MVM_spesh_log_is_logging(i.tc)) { MVMROOT(i.tc, code, { MVM_spesh_log_invoke_target(i.tc, code, was_multi); }); } i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_NUM; i.cur_op += 4; i.tc->cur_frame->return_address = i.cur_op; STABLE(code)->invoke(i.tc, code, i.cur_callsite, args); goto cbc_next(i); } __code cbc_invoke_s(INTER i){ MVMObject *code = GET_REG(i.cur_op, 2,i).o; MVMRegister *args = i.tc->cur_frame->args; MVMuint16 was_multi = 0; code = MVM_frame_find_invokee_multi_ok(i.tc, code, &i.cur_callsite, args, &was_multi); if (MVM_spesh_log_is_logging(i.tc)) { MVMROOT(i.tc, code, { MVM_spesh_log_invoke_target(i.tc, code, was_multi); }); } i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_STR; i.cur_op += 4; i.tc->cur_frame->return_address = i.cur_op; STABLE(code)->invoke(i.tc, code, i.cur_callsite, args); goto cbc_next(i); } __code cbc_invoke_o(INTER i){ MVMObject *code = GET_REG(i.cur_op, 2,i).o; MVMRegister *args = i.tc->cur_frame->args; MVMuint16 was_multi = 0; code = MVM_frame_find_invokee_multi_ok(i.tc, code, &i.cur_callsite, args, &was_multi); if (MVM_spesh_log_is_logging(i.tc)) { MVMROOT(i.tc, code, { MVM_spesh_log_invoke_target(i.tc, code, was_multi); }); } i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_OBJ; i.cur_op += 4; i.tc->cur_frame->return_address = i.cur_op; STABLE(code)->invoke(i.tc, code, i.cur_callsite, args); goto cbc_next(i); } __code cbc_checkarity(INTER i){ MVM_args_checkarity(i.tc, &i.tc->cur_frame->params, GET_UI16(i.cur_op, 0), GET_UI16(i.cur_op, 2)); i.cur_op += 4; goto cbc_next(i); } __code cbc_param_rp_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_args_get_required_pos_int(i.tc, &i.tc->cur_frame->params, GET_UI16(i.cur_op, 2)); i.cur_op += 4; goto cbc_next(i); } __code cbc_param_rp_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_args_get_pos_num(i.tc, &i.tc->cur_frame->params, GET_UI16(i.cur_op, 2), MVM_ARG_REQUIRED).arg.n64; i.cur_op += 4; goto cbc_next(i); } __code cbc_param_rp_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_args_get_required_pos_str(i.tc, &i.tc->cur_frame->params, GET_UI16(i.cur_op, 2)); i.cur_op += 4; goto cbc_next(i); } __code cbc_param_rp_o(INTER i){ MVMuint16 arg_idx = GET_UI16(i.cur_op, 2); MVMObject *param = MVM_args_get_required_pos_obj(i.tc, &i.tc->cur_frame->params, arg_idx); GET_REG(i.cur_op, 0,i).o = param; if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_parameter(i.tc, arg_idx, param); i.cur_op += 4; goto cbc_next(i); } __code cbc_param_op_i(INTER i){ { MVMArgInfo param = MVM_args_get_optional_pos_int(i.tc, &i.tc->cur_frame->params, GET_UI16(i.cur_op, 2)); if (param.exists) { GET_REG(i.cur_op, 0,i).i64 = param.arg.i64; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 4); } else { i.cur_op += 8; } goto cbc_next(i); } } __code cbc_param_op_n(INTER i){ MVMArgInfo param = MVM_args_get_pos_num(i.tc, &i.tc->cur_frame->params, GET_UI16(i.cur_op, 2), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).n64 = param.arg.n64; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 4); } else { i.cur_op += 8; } goto cbc_next(i); } __code cbc_param_op_s(INTER i){ { MVMArgInfo param = MVM_args_get_optional_pos_str(i.tc, &i.tc->cur_frame->params, GET_UI16(i.cur_op, 2)); if (param.exists) { GET_REG(i.cur_op, 0,i).s = param.arg.s; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 4); } else { i.cur_op += 8; } goto cbc_next(i); } } __code cbc_param_op_o(INTER i){ MVMuint16 arg_idx = GET_UI16(i.cur_op, 2); MVMArgInfo param = MVM_args_get_optional_pos_obj(i.tc, &i.tc->cur_frame->params, arg_idx); if (param.exists) { GET_REG(i.cur_op, 0,i).o = param.arg.o; if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_parameter(i.tc, arg_idx, param.arg.o); i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 4); } else { i.cur_op += 8; } goto cbc_next(i); } __code cbc_param_rn_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_args_get_named_int(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_REQUIRED).arg.i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_param_rn_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_args_get_named_num(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_REQUIRED).arg.n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_param_rn_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_args_get_named_str(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_REQUIRED).arg.s; i.cur_op += 6; goto cbc_next(i); } __code cbc_param_rn_o(INTER i){ MVMArgInfo param = MVM_args_get_named_obj(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_REQUIRED); GET_REG(i.cur_op, 0,i).o = param.arg.o; if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_parameter(i.tc, param.arg_idx, param.arg.o); i.cur_op += 6; goto cbc_next(i); } __code cbc_param_on_i(INTER i){ MVMArgInfo param = MVM_args_get_named_int(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).i64 = param.arg.i64; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 6); } else { i.cur_op += 10; } goto cbc_next(i); } __code cbc_param_on_n(INTER i){ MVMArgInfo param = MVM_args_get_named_num(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).n64 = param.arg.n64; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 6); } else { i.cur_op += 10; } goto cbc_next(i); } __code cbc_param_on_s(INTER i){ MVMArgInfo param = MVM_args_get_named_str(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).s = param.arg.s; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 6); } else { i.cur_op += 10; } goto cbc_next(i); } __code cbc_param_on_o(INTER i){ MVMArgInfo param = MVM_args_get_named_obj(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).o = param.arg.o; if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_parameter(i.tc, param.arg_idx, param.arg.o); i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 6); } else { i.cur_op += 10; } goto cbc_next(i); } __code cbc_param_sp(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_args_slurpy_positional(i.tc, &i.tc->cur_frame->params, GET_UI16(i.cur_op, 2)); i.cur_op += 4; goto cbc_next(i); } __code cbc_param_sn(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_args_slurpy_named(i.tc, &i.tc->cur_frame->params); i.cur_op += 2; goto cbc_next(i); } __code cbc_getcode(INTER i){ GET_REG(i.cur_op, 0,i).o =i.cu->body.coderefs[GET_UI16(i.cur_op, 2)]; i.cur_op += 4; goto cbc_next(i); } __code cbc_caller(INTER i){ MVMFrame *caller = i.tc->cur_frame; MVMint64 depth = GET_REG(i.cur_op, 2,i).i64; while (caller && depth-- > 0) /* keep the > 0. */ caller = caller->caller; GET_REG(i.cur_op, 0,i).o = caller ? caller->code_ref : i.tc->instance->VMNull; i.cur_op += 4; goto cbc_next(i); } __code cbc_capturelex(INTER i){ MVM_frame_capturelex(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_takeclosure(INTER i){ (i.reg_base[*((MVMuint16 *)(i.cur_op + 0))]).o = MVM_frame_takeclosure(i.tc, GET_REG(i.cur_op, 2,i).o); //MVMObject* tmp_base = MVM_frame_takeclosure(i.tc,GET_REG(i.cur_op,2,i).o); //GET_REG(i.cur_op, 0,i).o = MVM_frame_takeclosure(i.tc, GET_REG(i.cur_op, 2,i).o); //GET_REG(i.cur_op,0,i).o = tmp_base; i.cur_op += 4; goto cbc_next(i); } __code cbc_exception(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->active_handlers ? i.tc->active_handlers->ex_obj : i.tc->instance->VMNull; i.cur_op += 2; goto cbc_next(i); } __code cbc_bindexmessage(INTER i){ MVMObject *ex = GET_REG(i.cur_op, 0,i).o; if (IS_CONCRETE(ex) && REPR(ex)->ID == MVM_REPR_ID_MVMException) { MVM_ASSIGN_REF(i.tc, &(ex->header), ((MVMException *)ex)->body.message, GET_REG(i.cur_op, 2,i).s); } else { MVM_exception_throw_adhoc(i.tc, "bindexmessage needs a VMException, got %s (%s)", REPR(ex)->name, MVM_6model_get_debug_name(i.tc, ex)); } i.cur_op += 4; goto cbc_next(i); } __code cbc_bindexpayload(INTER i){ MVMObject *ex = GET_REG(i.cur_op, 0,i).o; MVM_bind_exception_payload(i.tc, ex, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_bindexcategory(INTER i){ MVMObject *ex = GET_REG(i.cur_op, 0,i).o; MVM_bind_exception_category(i.tc, ex, GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_getexmessage(INTER i){ MVMObject *ex = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(ex) && REPR(ex)->ID == MVM_REPR_ID_MVMException) GET_REG(i.cur_op, 0,i).s = ((MVMException *)ex)->body.message; else MVM_exception_throw_adhoc(i.tc, "getexmessage needs a VMException, got %s (%s)", REPR(ex)->name, MVM_6model_get_debug_name(i.tc, ex)); i.cur_op += 4; goto cbc_next(i); } __code cbc_getexpayload(INTER i){ MVMObject *ex = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).o = MVM_get_exception_payload(i.tc, ex); i.cur_op += 4; goto cbc_next(i); } __code cbc_getexcategory(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_get_exception_category(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_throwdyn(INTER i){ MVMRegister *rr = &GET_REG(i.cur_op, 0,i); MVMObject *ex_obj = GET_REG(i.cur_op, 2,i).o; i.cur_op += 4; MVM_exception_throwobj(i.tc, MVM_EX_THROW_DYN, ex_obj, rr); goto cbc_next(i); } __code cbc_throwlex(INTER i){ MVMRegister *rr = &GET_REG(i.cur_op, 0,i); MVMObject *ex_obj = GET_REG(i.cur_op, 2,i).o; i.cur_op += 4; MVM_exception_throwobj(i.tc, MVM_EX_THROW_LEX, ex_obj, rr); goto cbc_next(i); } __code cbc_throwlexotic(INTER i){ MVMRegister *rr = &GET_REG(i.cur_op, 0,i); MVMObject *ex_obj = GET_REG(i.cur_op, 2,i).o; i.cur_op += 4; MVM_exception_throwobj(i.tc, MVM_EX_THROW_LEXOTIC, ex_obj, rr); goto cbc_next(i); } __code cbc_throwcatdyn(INTER i){ MVMRegister *rr = &GET_REG(i.cur_op, 0,i); MVMuint32 cat = (MVMuint32)MVM_BC_get_I64(i.cur_op, 2); i.cur_op += 4; MVM_exception_throwcat(i.tc, MVM_EX_THROW_DYN, cat, rr); goto cbc_next(i); } __code cbc_throwcatlex(INTER i){ MVMRegister *rr = &GET_REG(i.cur_op, 0,i); MVMuint32 cat = (MVMuint32)MVM_BC_get_I64(i.cur_op, 2); i.cur_op += 4; MVM_exception_throwcat(i.tc, MVM_EX_THROW_LEX, cat, rr); goto cbc_next(i); } __code cbc_throwcatlexotic(INTER i){ MVMRegister *rr = &GET_REG(i.cur_op, 0,i); MVMuint32 cat = (MVMuint32)MVM_BC_get_I64(i.cur_op, 2); i.cur_op += 4; MVM_exception_throwcat(i.tc, MVM_EX_THROW_LEXOTIC, cat, rr); goto cbc_next(i); } __code cbc_die(INTER i){ MVMRegister *rr = &GET_REG(i.cur_op, 0,i); MVMString *str = GET_REG(i.cur_op, 2,i).s; i.cur_op += 4; MVM_exception_die(i.tc, str, rr); goto cbc_next(i); } __code cbc_rethrow(INTER i){ MVM_exception_throwobj(i.tc, MVM_EX_THROW_DYN, GET_REG(i.cur_op, 0,i).o, NULL); goto cbc_next(i); } __code cbc_resume(INTER i){ /* Expect that resume will set the PC, so don't update i.cur_op * here. */ MVM_exception_resume(i.tc, GET_REG(i.cur_op, 0,i).o); goto cbc_next(i); } __code cbc_takehandlerresult(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->last_handler_result ? i.tc->last_handler_result : i.tc->instance->VMNull; i.tc->last_handler_result = NULL; i.cur_op += 2; goto cbc_next(i); } __code cbc_backtracestrings(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_exception_backtrace_strings(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_usecapture(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_args_use_capture(i.tc, i.tc->cur_frame); i.cur_op += 2; goto cbc_next(i); } __code cbc_savecapture(INTER i){ /* Create a new call capture object. */ GET_REG(i.cur_op, 0,i).o = MVM_args_save_capture(i.tc, i.tc->cur_frame); i.cur_op += 2; goto cbc_next(i); } __code cbc_captureposelems(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { MVMCallCapture *cc = (MVMCallCapture *)obj; GET_REG(i.cur_op, 0,i).i64 = cc->body.apc->num_pos; } else { MVM_exception_throw_adhoc(i.tc, "captureposelems needs a MVMCallCapture"); } i.cur_op += 4; goto cbc_next(i); } __code cbc_captureposarg(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { MVMCallCapture *cc = (MVMCallCapture *)obj; GET_REG(i.cur_op, 0,i).o = MVM_args_get_required_pos_obj(i.tc, cc->body.apc, (MVMuint32)GET_REG(i.cur_op, 4,i).i64); } else { MVM_exception_throw_adhoc(i.tc, "captureposarg needs a MVMCallCapture"); } i.cur_op += 6; goto cbc_next(i); } __code cbc_captureposarg_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { MVMCallCapture *cc = (MVMCallCapture *)obj; GET_REG(i.cur_op, 0,i).i64 = MVM_args_get_required_pos_int(i.tc, cc->body.apc, (MVMuint32)GET_REG(i.cur_op, 4,i).i64); } else { MVM_exception_throw_adhoc(i.tc, "captureposarg_i needs a MVMCallCapture"); } i.cur_op += 6; goto cbc_next(i); } __code cbc_captureposarg_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { MVMCallCapture *cc = (MVMCallCapture *)obj; GET_REG(i.cur_op, 0,i).n64 = MVM_args_get_pos_num(i.tc, cc->body.apc, (MVMuint32)GET_REG(i.cur_op, 4,i).i64, MVM_ARG_REQUIRED).arg.n64; } else { MVM_exception_throw_adhoc(i.tc, "captureposarg_n needs a MVMCallCapture"); } i.cur_op += 6; goto cbc_next(i); } __code cbc_captureposarg_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { MVMCallCapture *cc = (MVMCallCapture *)obj; GET_REG(i.cur_op, 0,i).s = MVM_args_get_required_pos_str(i.tc, cc->body.apc, (MVMuint32)GET_REG(i.cur_op, 4,i).i64); } else { MVM_exception_throw_adhoc(i.tc, "captureposarg_s needs a MVMCallCapture"); } i.cur_op += 6; goto cbc_next(i); } __code cbc_captureposprimspec(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMint64 j = GET_REG(i.cur_op, 4,i).i64; if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { MVMCallCapture *cc = (MVMCallCapture *)obj; if (j >= 0 && j < cc->body.apc->num_pos) { MVMCallsiteEntry *arg_flags = cc->body.apc->arg_flags ? cc->body.apc->arg_flags : cc->body.apc->callsite->arg_flags; switch (arg_flags[j] & MVM_CALLSITE_ARG_MASK) { case MVM_CALLSITE_ARG_INT: GET_REG(i.cur_op, 0,i).i64 = MVM_STORAGE_SPEC_BP_INT; break; case MVM_CALLSITE_ARG_NUM: GET_REG(i.cur_op, 0,i).i64 = MVM_STORAGE_SPEC_BP_NUM; break; case MVM_CALLSITE_ARG_STR: GET_REG(i.cur_op, 0,i).i64 = MVM_STORAGE_SPEC_BP_STR; break; default: GET_REG(i.cur_op, 0,i).i64 = MVM_STORAGE_SPEC_BP_NONE; break; } } else { MVM_exception_throw_adhoc(i.tc, "Bad argument index given to captureposprimspec"); } } else { MVM_exception_throw_adhoc(i.tc, "captureposprimspec needs a MVMCallCapture"); } i.cur_op += 6; goto cbc_next(i); } __code cbc_captureexistsnamed(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { MVMCallCapture *cc = (MVMCallCapture *)obj; GET_REG(i.cur_op, 0,i).i64 = MVM_args_has_named(i.tc, cc->body.apc, GET_REG(i.cur_op, 4,i).s); } else { MVM_exception_throw_adhoc(i.tc, "captureexistsnamed needs a MVMCallCapture"); } i.cur_op += 6; goto cbc_next(i); } __code cbc_capturehasnameds(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { /* If positionals count doesn't mai->tch arg count, we must * have some named args. */ MVMCallCapture *cc = (MVMCallCapture *)obj; GET_REG(i.cur_op, 0,i).i64 = cc->body.apc->arg_count != cc->body.apc->num_pos; } else { MVM_exception_throw_adhoc(i.tc, "capturehasnameds needs a MVMCallCapture"); } i.cur_op += 4; goto cbc_next(i); } __code cbc_invokewithcapture(INTER i){ MVMObject *cobj; cobj = GET_REG(i.cur_op, 4,i).o; if (IS_CONCRETE(cobj) && REPR(cobj)->ID == MVM_REPR_ID_MVMCallCapture) { MVMObject *code = GET_REG(i.cur_op, 2,i).o; MVMCallCapture *cc = (MVMCallCapture *)cobj; MVMFrameExtra *e = MVM_frame_extra(i.tc, i.tc->cur_frame); code = MVM_frame_find_invokee(i.tc, code, NULL); i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_OBJ; i.cur_op += 6; i.tc->cur_frame->return_address = i.cur_op; MVMROOT(i.tc, cobj, { STABLE(code)->invoke(i.tc, code, cc->body.apc->callsite, cc->body.apc->args); }); if (MVM_FRAME_IS_ON_CALLSTACK(i.tc, i.tc->cur_frame)) { e->invoked_call_capture = cobj; } else { MVM_ASSIGN_REF(i.tc, &(i.tc->cur_frame->header), e->invoked_call_capture, cobj); } } else { MVM_exception_throw_adhoc(i.tc, "invokewithcapture needs a MVMCallCapture"); } goto cbc_next(i); } __code cbc_multicacheadd(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_multi_cache_add(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_multicachefind(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_multi_cache_find(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_null_s(INTER i){ GET_REG(i.cur_op, 0,i).s = NULL; i.cur_op += 2; goto cbc_next(i); } __code cbc_isnull_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).s ? 0 : 1; i.cur_op += 4; goto cbc_next(i); } __code cbc_eq_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_equal(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_ne_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = (MVMint64)(MVM_string_equal(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s)? 0 : 1); i.cur_op += 6; goto cbc_next(i); } __code cbc_gt_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_compare(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s) == 1; i.cur_op += 6; goto cbc_next(i); } __code cbc_ge_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_compare(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s) >= 0; i.cur_op += 6; goto cbc_next(i); } __code cbc_lt_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_compare(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s) == -1; i.cur_op += 6; goto cbc_next(i); } __code cbc_le_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_compare(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s) <= 0; i.cur_op += 6; goto cbc_next(i); } __code cbc_cmp_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_compare(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_unicmp_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_unicode_string_compare(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64, GET_REG(i.cur_op, 10,i).i64); i.cur_op += 12; goto cbc_next(i); } __code cbc_eqat_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_equal_at(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_eqatic_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_equal_at_ignore_case(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_eqaticim_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_equal_at_ignore_case_ignore_mark(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_haveat_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_have_at(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).s, GET_REG(i.cur_op, 10,i).i64); i.cur_op += 12; goto cbc_next(i); } __code cbc_concat_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_concatenate(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_repeat_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_repeat(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_substr_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_substring(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_index_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_index(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_indexic_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_index_ignore_case(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_indexicim_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_index_ignore_case_ignore_mark(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_graphs_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_graphs(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_codes_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_codes(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_getcp_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_get_grapheme_at(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_indexcp_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_index_of_grapheme(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_uc(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_uc(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_lc(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_lc(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_tc(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_tc(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_split(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_string_split(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_join(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_join(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_getcpbyname(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_unicode_lookup_by_name(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_getstrfromname(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_unicode_string_from_name(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_indexat(INTER i){ /* branches on *failure* to mai->tch in the constant string, to save an instruction in regexes */ if (MVM_string_char_at_in_string(i.tc, GET_REG(i.cur_op, 0,i).s, GET_REG(i.cur_op, 2,i).i64, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 4))) >= 0) i.cur_op += 12; else i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 8); GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_indexnat(INTER i){ /* branches on *failure* to mai->tch in the constant string, to save an instruction in regexes */ if (MVM_string_char_at_in_string(i.tc, GET_REG(i.cur_op, 0,i).s, GET_REG(i.cur_op, 2,i).i64, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 4))) == -1) i.cur_op += 12; else i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 8); GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_unipropcode(INTER i){ GET_REG(i.cur_op, 0,i).i64 = (MVMint64)MVM_unicode_name_to_property_code(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_unipvalcode(INTER i){ GET_REG(i.cur_op, 0,i).i64 = (MVMint64)MVM_unicode_name_to_property_value_code(i.tc, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_hasuniprop(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_offset_has_unicode_property_value(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64); i.cur_op += 10; goto cbc_next(i); } __code cbc_hasunipropc(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_offset_has_unicode_property_value(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, (MVMint64)GET_UI16(i.cur_op, 6), (MVMint64)GET_UI16(i.cur_op, 8)); i.cur_op += 10; goto cbc_next(i); } __code cbc_chars(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_graphs(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_chr(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_chr(i.tc, (MVMCodepoint)GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_ordfirst(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_ord_at(i.tc, GET_REG(i.cur_op, 2,i).s, 0); i.cur_op += 4; goto cbc_next(i); } __code cbc_ordat(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_ord_at(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_rindexfrom(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_index_from_end(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_escape(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_escape(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_flip(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_flip(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_setbuffersize_fh(INTER i){ MVM_io_set_buffer_size(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_iscclass(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_is_cclass(i.tc, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_findcclass(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_find_cclass(i.tc, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64); i.cur_op += 10; goto cbc_next(i); } __code cbc_findnotcclass(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_find_not_cclass(i.tc, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64); i.cur_op += 10; goto cbc_next(i); } __code cbc_nfafromstatelist(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nfa_from_statelist(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_nfarunproto(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nfa_run_proto(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_nfarunalt(INTER i){ MVM_nfa_run_alt(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).o, GET_REG(i.cur_op, 8,i).o, GET_REG(i.cur_op, 10,i).o); i.cur_op += 12; goto cbc_next(i); } __code cbc_radix(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_radix(i.tc, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64); i.cur_op += 10; goto cbc_next(i); } __code cbc_encode(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_string_encode_to_buf(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).o, NULL); i.cur_op += 8; goto cbc_next(i); } __code cbc_decode(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_decode_from_buf(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_istrue_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_coerce_istrue_s(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_isfalse_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_coerce_istrue_s(i.tc, GET_REG(i.cur_op, 2,i).s) ? 0 : 1; i.cur_op += 4; goto cbc_next(i); } __code cbc_null(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->instance->VMNull; i.cur_op += 2; goto cbc_next(i); } __code cbc_isnull(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = MVM_is_null(i.tc, obj); i.cur_op += 4; goto cbc_next(i); } __code cbc_ifnonnull(INTER i){ if (MVM_is_null(i.tc, GET_REG(i.cur_op, 0,i).o)) i.cur_op += 6; else i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 2); GC_SYNC_POINT(i.tc); goto cbc_next(i); } __code cbc_findmeth(INTER i){ /* Increment PC first, as we may make a method call. */ MVMRegister *res = &GET_REG(i.cur_op, 0,i); MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMString *name = MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 4)); i.cur_op += 8; MVM_6model_find_method(i.tc, obj, name, res, 1); goto cbc_next(i); } __code cbc_findmeth_s(INTER i){ /* Increment PC first, as we may make a method call. */ MVMRegister *res = &GET_REG(i.cur_op, 0,i); MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMString *name = GET_REG(i.cur_op, 4,i).s; i.cur_op += 6; MVM_6model_find_method(i.tc, obj, name, res, 1); goto cbc_next(i); } __code cbc_can(INTER i){ /* Increment PC first, as we may make a method call. */ MVMRegister *res = &GET_REG(i.cur_op, 0,i); MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMString *name = MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 4)); i.cur_op += 8; MVM_6model_can_method(i.tc, obj, name, res); goto cbc_next(i); } __code cbc_can_s(INTER i){ /* Increment PC first, as we may make a method call. */ MVMRegister *res = &GET_REG(i.cur_op, 0,i); MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMString *name = GET_REG(i.cur_op, 4,i).s; i.cur_op += 6; MVM_6model_can_method(i.tc, obj, name, res); goto cbc_next(i); } __code cbc_create(INTER i){ /* Ordering here matters. We write the object into the * register before calling initialize. This is because * if initialize allocates, obj may have moved after * we called it. Note that type is never used after * the initial allocate call also. This saves us having * to put things on the temporary stack. The GC will * know to update it in the register if it moved. */ MVMObject *type = GET_REG(i.cur_op, 2,i).o; MVMObject *obj = REPR(type)->allocate(i.tc, STABLE(type)); GET_REG(i.cur_op, 0,i).o = obj; if (REPR(obj)->initialize) REPR(obj)->initialize(i.tc, STABLE(obj), obj, OBJECT_BODY(obj)); i.cur_op += 4; goto cbc_next(i); } __code cbc_clone(INTER i){ MVMObject *value = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(value)) { MVMROOT(i.tc, value, { MVMObject *cloned = REPR(value)->allocate(i.tc, STABLE(value)); /* Ordering here matters. We write the object into the * register before calling copy_to. This is because * if copy_to allocates, obj may have moved after * we called it. This saves us having to put things on * the temporary stack. The GC will know to update it * in the register if it moved. */ GET_REG(i.cur_op, 0,i).o = cloned; REPR(value)->copy_to(i.tc, STABLE(value), OBJECT_BODY(value), cloned, OBJECT_BODY(cloned)); }); } else { GET_REG(i.cur_op, 0,i).o = value; } i.cur_op += 4; goto cbc_next(i); } __code cbc_isconcrete(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = obj && IS_CONCRETE(obj) ? 1 : 0; i.cur_op += 4; goto cbc_next(i); } __code cbc_rebless(INTER i){ if (!REPR(GET_REG(i.cur_op, 2,i).o)->change_type) { MVM_exception_throw_adhoc(i.tc, "This REPR cannot change type"); } REPR(GET_REG(i.cur_op, 2,i).o)->change_type(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); GET_REG(i.cur_op, 0,i).o = GET_REG(i.cur_op, 2,i).o; MVM_SC_WB_OBJ(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 6; MVM_spesh_deopt_all(i.tc); goto cbc_next(i); } __code cbc_istype(INTER i){ /* Increment PC first, as we may make a method call. */ MVMRegister *res = &GET_REG(i.cur_op, 0,i); MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMObject *type = GET_REG(i.cur_op, 4,i).o; i.cur_op += 6; MVM_6model_istype(i.tc, obj, type, res); goto cbc_next(i); } __code cbc_objprimspec(INTER i){ MVMObject *type = GET_REG(i.cur_op, 2,i).o; if (type) { const MVMStorageSpec *ss = REPR(type)->get_storage_spec(i.tc, STABLE(type)); GET_REG(i.cur_op, 0,i).i64 = ss->boxed_primitive; } else { GET_REG(i.cur_op, 0,i).i64 = 0; } i.cur_op += 4; goto cbc_next(i); } __code cbc_gethow(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_6model_get_how(i.tc, STABLE(GET_REG(i.cur_op, 2,i).o)); i.cur_op += 4; goto cbc_next(i); } __code cbc_getwhat(INTER i){ GET_REG(i.cur_op, 0,i).o = STABLE(GET_REG(i.cur_op, 2,i).o)->WHAT; i.cur_op += 4; goto cbc_next(i); } __code cbc_getwho(INTER i){ MVMObject *who = STABLE(GET_REG(i.cur_op, 2,i).o)->WHO; GET_REG(i.cur_op, 0,i).o = who ? who : i.tc->instance->VMNull; i.cur_op += 4; goto cbc_next(i); } __code cbc_setwho(INTER i){ MVMSTable *st = STABLE(GET_REG(i.cur_op, 2,i).o); MVM_ASSIGN_REF(i.tc, &(st->header), st->WHO, GET_REG(i.cur_op, 4,i).o); GET_REG(i.cur_op, 0,i).o = GET_REG(i.cur_op, 2,i).o; i.cur_op += 6; goto cbc_next(i); } __code cbc_reprname(INTER i){ const MVMREPROps *repr = REPR(GET_REG(i.cur_op, 2,i).o); GET_REG(i.cur_op, 0,i).s = i.tc->instance->repr_list[repr->ID]->name; i.cur_op += 4; goto cbc_next(i); } __code cbc_getwhere(INTER i){ GET_REG(i.cur_op, 0,i).i64 = (MVMint64)GET_REG(i.cur_op, 2,i).o; i.cur_op += 4; goto cbc_next(i); } __code cbc_eqaddr(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_REG(i.cur_op, 2,i).o == GET_REG(i.cur_op, 4,i).o ? 1 : 0; i.cur_op += 6; goto cbc_next(i); } __code cbc_bindattr_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot bind attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.bind_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).o, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 4)), GET_I16(i.cur_op, 10), GET_REG(i.cur_op, 8,i), MVM_reg_int64); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 12; goto cbc_next(i); } __code cbc_bindattr_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot bind attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.bind_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).o, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 4)), GET_I16(i.cur_op, 10), GET_REG(i.cur_op, 8,i), MVM_reg_num64); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 12; goto cbc_next(i); } __code cbc_bindattr_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot bind attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.bind_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).o, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 4)), GET_I16(i.cur_op, 10), GET_REG(i.cur_op, 8,i), MVM_reg_str); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 12; goto cbc_next(i); } __code cbc_bindattr_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot bind attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.bind_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).o, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 4)), GET_I16(i.cur_op, 10), GET_REG(i.cur_op, 8,i), MVM_reg_obj); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 12; goto cbc_next(i); } __code cbc_bindattrs_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot bind attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.bind_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).s, -1, GET_REG(i.cur_op, 6,i), MVM_reg_int64); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 8; goto cbc_next(i); } __code cbc_bindattrs_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot bind attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.bind_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).s, -1, GET_REG(i.cur_op, 6,i), MVM_reg_num64); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 8; goto cbc_next(i); } __code cbc_bindattrs_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot bind attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.bind_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).s, -1, GET_REG(i.cur_op, 6,i), MVM_reg_str); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 8; goto cbc_next(i); } __code cbc_bindattrs_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot bind attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.bind_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).s, -1, GET_REG(i.cur_op, 6,i), MVM_reg_obj); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 8; goto cbc_next(i); } __code cbc_getattr_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot look up attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.get_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).o, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), GET_I16(i.cur_op, 10), &GET_REG(i.cur_op, 0,i), MVM_reg_int64); i.cur_op += 12; goto cbc_next(i); } __code cbc_getattr_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot look up attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.get_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).o, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), GET_I16(i.cur_op, 10), &GET_REG(i.cur_op, 0,i), MVM_reg_num64); i.cur_op += 12; goto cbc_next(i); } __code cbc_getattr_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot look up attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.get_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).o, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), GET_I16(i.cur_op, 10), &GET_REG(i.cur_op, 0,i), MVM_reg_str); i.cur_op += 12; goto cbc_next(i); } __code cbc_getattr_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot look up attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.get_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).o, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), GET_I16(i.cur_op, 10), &GET_REG(i.cur_op, 0,i), MVM_reg_obj); if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_type(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 12; goto cbc_next(i); } __code cbc_getattrs_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot look up attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.get_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s, -1, &GET_REG(i.cur_op, 0,i), MVM_reg_int64); i.cur_op += 8; goto cbc_next(i); } __code cbc_getattrs_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot look up attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.get_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s, -1, &GET_REG(i.cur_op, 0,i), MVM_reg_num64); i.cur_op += 8; goto cbc_next(i); } __code cbc_getattrs_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot look up attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.get_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s, -1, &GET_REG(i.cur_op, 0,i), MVM_reg_str); i.cur_op += 8; goto cbc_next(i); } __code cbc_getattrs_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot look up attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); REPR(obj)->attr_funcs.get_attribute(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s, -1, &GET_REG(i.cur_op, 0,i), MVM_reg_obj); if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_type(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_attrinited(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot look up attributes in a %s type object", MVM_6model_get_debug_name(i.tc, obj)); GET_REG(i.cur_op, 0,i).i64 = REPR(obj)->attr_funcs.is_attribute_initialized(i.tc, STABLE(obj), OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s, MVM_NO_HINT); i.cur_op += 8; goto cbc_next(i); } __code cbc_box_i(INTER i){ MVM_box_int(i.tc, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).o, &GET_REG(i.cur_op, 0,i)); i.cur_op += 6; goto cbc_next(i); } __code cbc_box_n(INTER i){ MVM_box_num(i.tc, GET_REG(i.cur_op, 2,i).n64, GET_REG(i.cur_op, 4,i).o, &GET_REG(i.cur_op, 0,i)); i.cur_op += 6; goto cbc_next(i); } __code cbc_box_s(INTER i){ MVM_box_str(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).o, &GET_REG(i.cur_op, 0,i)); i.cur_op += 6; goto cbc_next(i); } __code cbc_unbox_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot unbox a type object (%s) to an int.", MVM_6model_get_debug_name(i.tc, obj)); GET_REG(i.cur_op, 0,i).i64 = REPR(obj)->box_funcs.get_int(i.tc, STABLE(obj), obj, OBJECT_BODY(obj)); i.cur_op += 4; goto cbc_next(i); } __code cbc_unbox_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot unbox a type object (%s) to a num.", MVM_6model_get_debug_name(i.tc, obj)); GET_REG(i.cur_op, 0,i).n64 = REPR(obj)->box_funcs.get_num(i.tc, STABLE(obj), obj, OBJECT_BODY(obj)); i.cur_op += 4; goto cbc_next(i); } __code cbc_unbox_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot unbox a type object (%s) to a str.", MVM_6model_get_debug_name(i.tc, obj)); GET_REG(i.cur_op, 0,i).s = REPR(obj)->box_funcs.get_str(i.tc, STABLE(obj), obj, OBJECT_BODY(obj)); i.cur_op += 4; goto cbc_next(i); } __code cbc_atpos_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->pos_funcs.at_pos(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).i64, &GET_REG(i.cur_op, 0,i), MVM_reg_int64); i.cur_op += 6; goto cbc_next(i); } __code cbc_atpos_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->pos_funcs.at_pos(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).i64, &GET_REG(i.cur_op, 0,i), MVM_reg_num64); i.cur_op += 6; goto cbc_next(i); } __code cbc_atpos_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->pos_funcs.at_pos(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).i64, &GET_REG(i.cur_op, 0,i), MVM_reg_str); i.cur_op += 6; goto cbc_next(i); } __code cbc_atpos_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(obj)) REPR(obj)->pos_funcs.at_pos(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 4,i).i64, &GET_REG(i.cur_op, 0,i), MVM_reg_obj); else GET_REG(i.cur_op, 0,i).o = i.tc->instance->VMNull; i.cur_op += 6; goto cbc_next(i); } __code cbc_bindpos_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.bind_pos(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i), MVM_reg_int64); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindpos_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.bind_pos(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i), MVM_reg_num64); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindpos_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.bind_pos(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i), MVM_reg_str); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindpos_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.bind_pos(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i), MVM_reg_obj); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 6; goto cbc_next(i); } __code cbc_push_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.push(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i), MVM_reg_int64); MVM_SC_WB_OBJ(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_push_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.push(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i), MVM_reg_num64); MVM_SC_WB_OBJ(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_push_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.push(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i), MVM_reg_str); MVM_SC_WB_OBJ(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_push_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.push(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i), MVM_reg_obj); MVM_SC_WB_OBJ(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_pop_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->pos_funcs.pop(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), &GET_REG(i.cur_op, 0,i), MVM_reg_int64); i.cur_op += 4; goto cbc_next(i); } __code cbc_pop_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->pos_funcs.pop(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), &GET_REG(i.cur_op, 0,i), MVM_reg_num64); i.cur_op += 4; goto cbc_next(i); } __code cbc_pop_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->pos_funcs.pop(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), &GET_REG(i.cur_op, 0,i), MVM_reg_str); i.cur_op += 4; goto cbc_next(i); } __code cbc_pop_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->pos_funcs.pop(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), &GET_REG(i.cur_op, 0,i), MVM_reg_obj); i.cur_op += 4; goto cbc_next(i); } __code cbc_shift_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->pos_funcs.shift(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), &GET_REG(i.cur_op, 0,i), MVM_reg_int64); i.cur_op += 4; goto cbc_next(i); } __code cbc_shift_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->pos_funcs.shift(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), &GET_REG(i.cur_op, 0,i), MVM_reg_num64); i.cur_op += 4; goto cbc_next(i); } __code cbc_shift_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->pos_funcs.shift(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), &GET_REG(i.cur_op, 0,i), MVM_reg_str); i.cur_op += 4; goto cbc_next(i); } __code cbc_shift_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->pos_funcs.shift(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), &GET_REG(i.cur_op, 0,i), MVM_reg_obj); i.cur_op += 4; goto cbc_next(i); } __code cbc_unshift_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.unshift(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i), MVM_reg_int64); i.cur_op += 4; goto cbc_next(i); } __code cbc_unshift_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.unshift(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i), MVM_reg_num64); i.cur_op += 4; goto cbc_next(i); } __code cbc_unshift_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.unshift(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i), MVM_reg_str); i.cur_op += 4; goto cbc_next(i); } __code cbc_unshift_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.unshift(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i), MVM_reg_obj); i.cur_op += 4; goto cbc_next(i); } __code cbc_splice(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.splice(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_setelemspos(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->pos_funcs.set_elems(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_existspos(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_repr_exists_pos(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_atkey_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->ass_funcs.at_key(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), (MVMObject *)GET_REG(i.cur_op, 4,i).s, &GET_REG(i.cur_op, 0,i), MVM_reg_int64); i.cur_op += 6; goto cbc_next(i); } __code cbc_atkey_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->ass_funcs.at_key(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), (MVMObject *)GET_REG(i.cur_op, 4,i).s, &GET_REG(i.cur_op, 0,i), MVM_reg_num64); i.cur_op += 6; goto cbc_next(i); } __code cbc_atkey_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->ass_funcs.at_key(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), (MVMObject *)GET_REG(i.cur_op, 4,i).s, &GET_REG(i.cur_op, 0,i), MVM_reg_str); i.cur_op += 6; goto cbc_next(i); } __code cbc_atkey_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(obj)) REPR(obj)->ass_funcs.at_key(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), (MVMObject *)GET_REG(i.cur_op, 4,i).s, &GET_REG(i.cur_op, 0,i), MVM_reg_obj); else GET_REG(i.cur_op, 0,i).o = i.tc->instance->VMNull; i.cur_op += 6; goto cbc_next(i); } __code cbc_bindkey_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->ass_funcs.bind_key(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), (MVMObject *)GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i), MVM_reg_int64); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindkey_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->ass_funcs.bind_key(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), (MVMObject *)GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i), MVM_reg_num64); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindkey_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->ass_funcs.bind_key(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), (MVMObject *)GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i), MVM_reg_str); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindkey_o(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->ass_funcs.bind_key(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), (MVMObject *)GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i), MVM_reg_obj); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 6; goto cbc_next(i); } __code cbc_existskey(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = REPR(obj)->ass_funcs.exists_key(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), (MVMObject *)GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_deletekey(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; REPR(obj)->ass_funcs.delete_key(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), (MVMObject *)GET_REG(i.cur_op, 2,i).s); MVM_SC_WB_OBJ(i.tc, obj); i.cur_op += 4; goto cbc_next(i); } __code cbc_elems(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = (MVMint64)REPR(obj)->elems(i.tc, STABLE(obj), obj, OBJECT_BODY(obj)); i.cur_op += 4; goto cbc_next(i); } __code cbc_knowhow(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->instance->KnowHOW; i.cur_op += 2; goto cbc_next(i); } __code cbc_knowhowattr(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->instance->KnowHOWAttribute; i.cur_op += 2; goto cbc_next(i); } __code cbc_newtype(INTER i){ MVMObject *how = GET_REG(i.cur_op, 2,i).o; MVMString *repr_name = GET_REG(i.cur_op, 4,i).s; const MVMREPROps *repr = MVM_repr_get_by_name(i.tc, repr_name); GET_REG(i.cur_op, 0,i).o = repr->type_object_for(i.tc, how); i.cur_op += 6; goto cbc_next(i); } __code cbc_composetype(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; REPR(obj)->compose(i.tc, STABLE(obj), GET_REG(i.cur_op, 4,i).o); GET_REG(i.cur_op, 0,i).o = GET_REG(i.cur_op, 2,i).o; i.cur_op += 6; goto cbc_next(i); } __code cbc_setmethcache(INTER i){ MVMObject *iter = MVM_iter(i.tc, GET_REG(i.cur_op, 2,i).o); MVMObject *cache; MVMSTable *stable; MVMROOT(i.tc, iter, { cache = MVM_repr_alloc_init(i.tc, i.tc->instance->boot_types.BOOTHash); }); while (MVM_iter_istrue(i.tc, (MVMIter *)iter)) { MVMRegister result; REPR(iter)->pos_funcs.shift(i.tc, STABLE(iter), iter, OBJECT_BODY(iter), &result, MVM_reg_obj); MVM_repr_bind_key_o(i.tc, cache, MVM_iterkey_s(i.tc, (MVMIter *)iter), MVM_iterval(i.tc, (MVMIter *)iter)); } stable = STABLE(GET_REG(i.cur_op, 0,i).o); MVM_ASSIGN_REF(i.tc, &(stable->header), stable->method_cache, cache); stable->method_cache_sc = NULL; MVM_SC_WB_ST(i.tc, stable); i.cur_op += 4; goto cbc_next(i); } __code cbc_setmethcacheauth(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; MVMint64 new_flags = STABLE(obj)->mode_flags & (~MVM_METHOD_CACHE_AUTHORITATIVE); MVMint64 flag = GET_REG(i.cur_op, 2,i).i64; if (flag != 0) new_flags |= MVM_METHOD_CACHE_AUTHORITATIVE; STABLE(obj)->mode_flags = new_flags; MVM_SC_WB_ST(i.tc, STABLE(obj)); i.cur_op += 4; goto cbc_next(i); } __code cbc_settypecache(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; MVMObject *types = GET_REG(i.cur_op, 2,i).o; MVMSTable *st = STABLE(obj); MVMint64 j, elems = REPR(types)->elems(i.tc, STABLE(types), types, OBJECT_BODY(types)); MVMObject **cache = MVM_malloc(sizeof(MVMObject *) * elems); for (j = 0; j < elems; j++) { MVM_ASSIGN_REF(i.tc, &(st->header), cache[j], MVM_repr_at_pos_o(i.tc, types, j)); } /* technically this free isn't thread safe */ if (st->type_check_cache) MVM_free(st->type_check_cache); st->type_check_cache = cache; st->type_check_cache_length = (MVMuint16)elems; MVM_SC_WB_ST(i.tc, st); i.cur_op += 4; goto cbc_next(i); } __code cbc_settypecheckmode(INTER i){ MVMSTable *st = STABLE(GET_REG(i.cur_op, 0,i).o); st->mode_flags = GET_REG(i.cur_op, 2,i).i64 | (st->mode_flags & (~MVM_TYPE_CHECK_CACHE_FLAG_MASK)); MVM_SC_WB_ST(i.tc, st); i.cur_op += 4; goto cbc_next(i); } __code cbc_setboolspec(INTER i){ MVMSTable *st = GET_REG(i.cur_op, 0,i).o->st; MVMBoolificationSpec *bs = MVM_malloc(sizeof(MVMBoolificationSpec)); MVMBoolificationSpec *orig_bs = st->boolification_spec; bs->mode = (MVMuint32)GET_REG(i.cur_op, 2,i).i64; MVM_ASSIGN_REF(i.tc, &(st->header), bs->method, GET_REG(i.cur_op, 4,i).o); st->boolification_spec = bs; MVM_free(orig_bs); i.cur_op += 6; goto cbc_next(i); } __code cbc_istrue(INTER i){ /* Increment PC first then call coerce, since it may want to * do an invocation. */ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMRegister *res = &GET_REG(i.cur_op, 0,i); i.cur_op += 4; MVM_coerce_istrue(i.tc, obj, res, NULL, NULL, 0); goto cbc_next(i); } __code cbc_isfalse(INTER i){ /* Increment PC first then call coerce, since it may want to * do an invocation. */ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMRegister *res = &GET_REG(i.cur_op, 0,i); i.cur_op += 4; MVM_coerce_istrue(i.tc, obj, res, NULL, NULL, 1); goto cbc_next(i); } __code cbc_bootint(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->instance->boot_types.BOOTInt; i.cur_op += 2; goto cbc_next(i); } __code cbc_bootnum(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->instance->boot_types.BOOTNum; i.cur_op += 2; goto cbc_next(i); } __code cbc_bootstr(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->instance->boot_types.BOOTStr; i.cur_op += 2; goto cbc_next(i); } __code cbc_bootarray(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->instance->boot_types.BOOTArray; i.cur_op += 2; goto cbc_next(i); } __code cbc_bootintarray(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->instance->boot_types.BOOTIntArray; i.cur_op += 2; goto cbc_next(i); } __code cbc_bootnumarray(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->instance->boot_types.BOOTNumArray; i.cur_op += 2; goto cbc_next(i); } __code cbc_bootstrarray(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->instance->boot_types.BOOTStrArray; i.cur_op += 2; goto cbc_next(i); } __code cbc_boothash(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->instance->boot_types.BOOTHash; i.cur_op += 2; goto cbc_next(i); } __code cbc_isint(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = obj && REPR(obj)->ID == MVM_REPR_ID_P6int ? 1 : 0; i.cur_op += 4; goto cbc_next(i); } __code cbc_isnum(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = obj && REPR(obj)->ID == MVM_REPR_ID_P6num ? 1 : 0; i.cur_op += 4; goto cbc_next(i); } __code cbc_isstr(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = obj && REPR(obj)->ID == MVM_REPR_ID_P6str ? 1 : 0; i.cur_op += 4; goto cbc_next(i); } __code cbc_islist(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = obj && REPR(obj)->ID == MVM_REPR_ID_VMArray ? 1 : 0; i.cur_op += 4; goto cbc_next(i); } __code cbc_ishash(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = obj && REPR(obj)->ID == MVM_REPR_ID_MVMHash ? 1 : 0; i.cur_op += 4; goto cbc_next(i); } __code cbc_sethllconfig(INTER i){ MVM_hll_set_config(i.tc, GET_REG(i.cur_op, 0,i).s, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_hllboxtype_i(INTER i){ GET_REG(i.cur_op, 0,i).o =i.cu->body.hll_config->int_box_type; i.cur_op += 2; goto cbc_next(i); } __code cbc_hllboxtype_n(INTER i){ GET_REG(i.cur_op, 0,i).o =i.cu->body.hll_config->num_box_type; i.cur_op += 2; goto cbc_next(i); } __code cbc_hllboxtype_s(INTER i){ GET_REG(i.cur_op, 0,i).o =i.cu->body.hll_config->str_box_type; i.cur_op += 2; goto cbc_next(i); } __code cbc_hlllist(INTER i){ GET_REG(i.cur_op, 0,i).o =i.cu->body.hll_config->slurpy_array_type; i.cur_op += 2; goto cbc_next(i); } __code cbc_hllhash(INTER i){ GET_REG(i.cur_op, 0,i).o =i.cu->body.hll_config->slurpy_hash_type; i.cur_op += 2; goto cbc_next(i); } __code cbc_getcomp(INTER i){ MVMObject *obj = i.tc->instance->compiler_registry; uv_mutex_lock(&i.tc->instance->mutex_compiler_registry); GET_REG(i.cur_op, 0,i).o = MVM_repr_at_key_o(i.tc, obj, GET_REG(i.cur_op, 2,i).s); uv_mutex_unlock(&i.tc->instance->mutex_compiler_registry); i.cur_op += 4; goto cbc_next(i); } __code cbc_bindcomp(INTER i){ MVMObject *obj = i.tc->instance->compiler_registry; uv_mutex_lock(&i.tc->instance->mutex_compiler_registry); REPR(obj)->ass_funcs.bind_key(i.tc, STABLE(obj), obj, OBJECT_BODY(obj), (MVMObject *)GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i), MVM_reg_obj); uv_mutex_unlock(&i.tc->instance->mutex_compiler_registry); GET_REG(i.cur_op, 0,i).o = GET_REG(i.cur_op, 4,i).o; i.cur_op += 6; goto cbc_next(i); } __code cbc_getcurhllsym(INTER i){ MVMString *hll_name = i.tc->cur_frame->static_info->body.cu->body.hll_name; GET_REG(i.cur_op, 0,i).o = MVM_hll_sym_get(i.tc, hll_name, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_bindcurhllsym(INTER i){ MVMObject *syms = i.tc->instance->hll_syms, *hash; MVMString *hll_name = i.tc->cur_frame->static_info->body.cu->body.hll_name; uv_mutex_lock(&i.tc->instance->mutex_hll_syms); hash = MVM_repr_at_key_o(i.tc, syms, hll_name); if (MVM_is_null(i.tc, hash)) { hash = MVM_repr_alloc_init(i.tc, i.tc->instance->boot_types.BOOTHash); /* must re-get syms in case it moved */ syms = i.tc->instance->hll_syms; hll_name = i.tc->cur_frame->static_info->body.cu->body.hll_name; MVM_repr_bind_key_o(i.tc, syms, hll_name, hash); } MVM_repr_bind_key_o(i.tc, hash, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).o); GET_REG(i.cur_op, 0,i).o = GET_REG(i.cur_op, 4,i).o; uv_mutex_unlock(&i.tc->instance->mutex_hll_syms); i.cur_op += 6; goto cbc_next(i); } __code cbc_gethllsym(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_hll_sym_get(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindhllsym(INTER i){ MVMObject *syms = i.tc->instance->hll_syms; MVMString *hll_name = GET_REG(i.cur_op, 0,i).s; MVMObject *hash; uv_mutex_lock(&i.tc->instance->mutex_hll_syms); hash = MVM_repr_at_key_o(i.tc, syms, hll_name); if (MVM_is_null(i.tc, hash)) { hash = MVM_repr_alloc_init(i.tc, i.tc->instance->boot_types.BOOTHash); /* must re-get syms and HLL name in case it moved */ syms = i.tc->instance->hll_syms; hll_name = GET_REG(i.cur_op, 0,i).s; MVM_repr_bind_key_o(i.tc, syms, hll_name, hash); } MVM_repr_bind_key_o(i.tc, hash, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).o); uv_mutex_unlock(&i.tc->instance->mutex_hll_syms); i.cur_op += 6; goto cbc_next(i); } __code cbc_settypehll(INTER i){ STABLE(GET_REG(i.cur_op, 0,i).o)->hll_owner = MVM_hll_get_config_for(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_settypehllrole(INTER i){ STABLE(GET_REG(i.cur_op, 0,i).o)->hll_role = GET_REG(i.cur_op, 2,i).i64; i.cur_op += 4; goto cbc_next(i); } __code cbc_hllize(INTER i){ /* Increment PC before mapping, as it may invoke. */ MVMRegister *res_reg = &GET_REG(i.cur_op, 0,i); MVMObject *mapee = GET_REG(i.cur_op, 2,i).o; i.cur_op += 4; MVM_hll_map(i.tc, mapee, MVM_hll_current(i.tc), res_reg); goto cbc_next(i); } __code cbc_hllizefor(INTER i){ /* Increment PC before mapping, as it may invoke. */ MVMRegister *res_reg = &GET_REG(i.cur_op, 0,i); MVMObject *mapee = GET_REG(i.cur_op, 2,i).o; MVMString *hll = GET_REG(i.cur_op, 4,i).s; i.cur_op += 6; MVM_hll_map(i.tc, mapee, MVM_hll_get_config_for(i.tc, hll), res_reg); goto cbc_next(i); } __code cbc_usecompileehllconfig(INTER i){ MVM_hll_enter_compilee_mode(i.tc); goto cbc_next(i); } __code cbc_usecompilerhllconfig(INTER i){ MVM_hll_leave_compilee_mode(i.tc); goto cbc_next(i); } __code cbc_iter(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_iter(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_iterkey_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_iterkey_s(i.tc, (MVMIter *)GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_iterval(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_iterval(i.tc, (MVMIter *)GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_getcodename(INTER i){ MVMObject *co = GET_REG(i.cur_op, 2,i).o; if (REPR(co)->ID != MVM_REPR_ID_MVMCode || !IS_CONCRETE(co)) MVM_exception_throw_adhoc(i.tc, "gei->tcodename requires a concrete code object"); GET_REG(i.cur_op, 0,i).s = ((MVMCode *)co)->body.name; i.cur_op += 4; goto cbc_next(i); } __code cbc_iscoderef(INTER i){ GET_REG(i.cur_op, 0,i).i64 = !GET_REG(i.cur_op, 2,i).o || STABLE(GET_REG(i.cur_op, 2,i).o)->invoke == MVM_6model_invoke_default ? 0 : 1; i.cur_op += 4; goto cbc_next(i); } __code cbc_getcodeobj(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).o = MVM_frame_get_code_object(i.tc, (MVMCode *)obj); i.cur_op += 4; goto cbc_next(i); } __code cbc_setcodeobj(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; if (REPR(obj)->ID == MVM_REPR_ID_MVMCode) { MVM_ASSIGN_REF(i.tc, &(obj->header), ((MVMCode *)obj)->body.code_object, GET_REG(i.cur_op, 2,i).o); } else { MVM_exception_throw_adhoc(i.tc, "sei->tcodeobj needs a code ref"); } i.cur_op += 4; goto cbc_next(i); } __code cbc_setcodename(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; if (REPR(obj)->ID == MVM_REPR_ID_MVMCode) { MVM_ASSIGN_REF(i.tc, &(obj->header), ((MVMCode *)obj)->body.name, GET_REG(i.cur_op, 2,i).s); } else { MVM_exception_throw_adhoc(i.tc, "sei->tcodename needs a code ref"); } i.cur_op += 4; goto cbc_next(i); } __code cbc_forceouterctx(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o, *ctx = GET_REG(i.cur_op, 2,i).o; MVMFrame *orig; MVMFrame *context; MVMStaticFrame *sf; if (REPR(obj)->ID != MVM_REPR_ID_MVMCode || !IS_CONCRETE(obj)) { MVM_exception_throw_adhoc(i.tc, "forceouterctx needs a code ref"); } if (REPR(ctx)->ID != MVM_REPR_ID_MVMContext || !IS_CONCRETE(ctx)) { MVM_exception_throw_adhoc(i.tc, "forceouterctx needs a context"); } orig = ((MVMCode *)obj)->body.outer; sf = ((MVMCode *)obj)->body.sf; context = ((MVMContext *)ctx)->body.context; MVM_ASSIGN_REF(i.tc, &(((MVMObject *)sf)->header), sf->body.outer, context->static_info); if (orig != context) MVM_ASSIGN_REF(i.tc, &(obj->header), ((MVMCode *)obj)->body.outer, context); i.cur_op += 4; goto cbc_next(i); } __code cbc_setinvokespec(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o, *ch = GET_REG(i.cur_op, 2,i).o, *invocation_handler = GET_REG(i.cur_op, 6,i).o; MVMString *name = GET_REG(i.cur_op, 4,i).s; MVMInvocationSpec *is = MVM_calloc(1, sizeof(MVMInvocationSpec)); MVMSTable *st = STABLE(obj); MVM_ASSIGN_REF(i.tc, &(st->header), is->class_handle, ch); MVM_ASSIGN_REF(i.tc, &(st->header), is->attr_name, name); if (ch && name) is->hint = REPR(ch)->attr_funcs.hint_for(i.tc, STABLE(ch), ch, name); MVM_ASSIGN_REF(i.tc, &(st->header), is->invocation_handler, invocation_handler); /* XXX not thread safe, but this should occur on non-shared objects anyway... */ if (st->invocation_spec) MVM_free(st->invocation_spec); st->invocation_spec = is; i.cur_op += 8; goto cbc_next(i); } __code cbc_isinvokable(INTER i){ MVMSTable *st = STABLE(GET_REG(i.cur_op, 2,i).o); GET_REG(i.cur_op, 0,i).i64 = st->invoke == MVM_6model_invoke_default ? (st->invocation_spec ? 1 : 0) : 1; i.cur_op += 4; goto cbc_next(i); } __code cbc_freshcoderef(INTER i){ MVMObject * const cr = GET_REG(i.cur_op, 2,i).o; MVMCode *ncr; if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) MVM_exception_throw_adhoc(i.tc, "freshcoderef requires a coderef"); ncr = (MVMCode *)(GET_REG(i.cur_op, 0,i).o = MVM_repr_clone(i.tc, cr)); MVMROOT(i.tc, ncr, { MVMStaticFrame *nsf; if (!ncr->body.sf->body.fully_deserialized) MVM_bytecode_finish_frame(i.tc, ncr->body.sf->body.cu, ncr->body.sf, 0); nsf = (MVMStaticFrame *)MVM_repr_clone(i.tc, (MVMObject *)ncr->body.sf); MVM_ASSIGN_REF(i.tc, &(ncr->common.header), ncr->body.sf, nsf); MVM_ASSIGN_REF(i.tc, &(ncr->common.header), ncr->body.sf->body.static_code, ncr); }); i.cur_op += 4; goto cbc_next(i); } __code cbc_markcodestatic(INTER i){ MVMObject * const cr = GET_REG(i.cur_op, 0,i).o; if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) MVM_exception_throw_adhoc(i.tc, "markcodestatic requires a coderef"); ((MVMCode *)cr)->body.is_static = 1; i.cur_op += 2; goto cbc_next(i); } __code cbc_markcodestub(INTER i){ MVMObject * const cr = GET_REG(i.cur_op, 0,i).o; if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) MVM_exception_throw_adhoc(i.tc, "markcodestub requires a coderef"); ((MVMCode *)cr)->body.is_compiler_stub = 1; i.cur_op += 2; goto cbc_next(i); } __code cbc_getstaticcode(INTER i){ MVMObject * const cr = GET_REG(i.cur_op, 2,i).o; if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) MVM_exception_throw_adhoc(i.tc, "getstaticcode requires a static coderef"); GET_REG(i.cur_op, 0,i).o = (MVMObject *)((MVMCode *)cr)->body.sf->body.static_code; i.cur_op += 4; goto cbc_next(i); } __code cbc_getcodecuid(INTER i){ MVMObject * const cr = GET_REG(i.cur_op, 2,i).o; if (REPR(cr)->ID != MVM_REPR_ID_MVMCode || !IS_CONCRETE(cr)) MVM_exception_throw_adhoc(i.tc, "gei->tcodecuid requires a static coderef"); GET_REG(i.cur_op, 0,i).s = ((MVMCode *)cr)->body.sf->body.cuuid; i.cur_op += 4; goto cbc_next(i); } __code cbc_setdispatcher(INTER i){ i.tc->cur_dispatcher = GET_REG(i.cur_op, 0,i).o; i.tc->cur_dispatcher_for = NULL; i.cur_op += 2; goto cbc_next(i); } __code cbc_takedispatcher(INTER i){ MVMObject *disp = i.tc->cur_dispatcher; MVMObject *disp_for = i.tc->cur_dispatcher_for; MVMObject *cur_code = i.tc->cur_frame->code_ref; if (disp && (!disp_for || disp_for == cur_code)) { GET_REG(i.cur_op, 0,i).o = disp; i.tc->cur_dispatcher = NULL; } else { GET_REG(i.cur_op, 0,i).o = i.tc->instance->VMNull; } i.cur_op += 2; goto cbc_next(i); } __code cbc_assign(INTER i){ MVMObject *cont = GET_REG(i.cur_op, 0,i).o; MVMObject *obj = GET_REG(i.cur_op, 2,i).o; const MVMContainerSpec *spec = STABLE(cont)->container_spec; i.cur_op += 4; if (spec) { spec->store(i.tc, cont, obj); } else { MVM_exception_throw_adhoc(i.tc, "Cannot assign to an immutable value"); } goto cbc_next(i); } __code cbc_assignunchecked(INTER i){ MVMObject *cont = GET_REG(i.cur_op, 0,i).o; MVMObject *obj = GET_REG(i.cur_op, 2,i).o; const MVMContainerSpec *spec = STABLE(cont)->container_spec; i.cur_op += 4; if (spec) { spec->store_unchecked(i.tc, cont, obj); } else { MVM_exception_throw_adhoc(i.tc, "Cannot assign to an immutable value"); } goto cbc_next(i); } __code cbc_iscont(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = MVM_is_null(i.tc, obj) || STABLE(obj)->container_spec == NULL ? 0 : 1; i.cur_op += 4; goto cbc_next(i); } __code cbc_decont(INTER i){ MVMuint8 *prev_op = i.cur_op; MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMRegister *r = &GET_REG(i.cur_op, 0,i); i.cur_op += 4; if (obj && IS_CONCRETE(obj) && STABLE(obj)->container_spec) { STABLE(obj)->container_spec->fetch(i.tc, obj, r); if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_decont(i.tc, prev_op, r->o); } else { r->o = obj; } goto cbc_next(i); } // still no tail call trouble on waste void cbc_setcontspec0(INTER i){ MVMSTable *st = STABLE(GET_REG(i.cur_op, 0,i).o); MVMString *name = GET_REG(i.cur_op, 2,i).s; const MVMContainerConfigurer *cc = MVM_6model_get_container_config(i.tc, name); if (cc == NULL) { char *c_name = MVM_string_utf8_encode_C_string(i.tc, name); c_name = MVM_string_utf8_encode_C_string(i.tc, name); char *waste[] = { c_name, NULL }; waste[0] = c_name; MVM_exception_throw_adhoc_free(i.tc, waste, "Cannot use unknown container spec %s", c_name); } if (st->container_spec) MVM_exception_throw_adhoc(i.tc, "Cannot change a type's container specification"); cc->set_container_spec(i.tc, st); cc->configure_container_spec(i.tc, st, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; return; } __code cbc_setcontspec(INTER i){ cbc_setcontspec0(i); goto cbc_next(i); } __code cbc_sha1(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_sha1(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_createsc(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_sc_create(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_scsetobj(INTER i){ MVMObject *sc = GET_REG(i.cur_op, 0,i).o; MVMObject *obj = GET_REG(i.cur_op, 4,i).o; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Must provide an SCRef operand to scsetobj"); MVM_sc_set_object(i.tc, (MVMSerializationContext *)sc, GET_REG(i.cur_op, 2,i).i64, obj); if (MVM_sc_get_stable_sc(i.tc, STABLE(obj)) == NULL) { /* Need to claim the SC also; typical case for new type objects. */ MVMSTable *st = STABLE(obj); MVM_sc_set_stable_sc(i.tc, st, (MVMSerializationContext *)sc); MVM_sc_push_stable(i.tc, (MVMSerializationContext *)sc, st); } i.cur_op += 6; goto cbc_next(i); } __code cbc_scsetcode(INTER i){ MVMObject *sc = GET_REG(i.cur_op, 0,i).o; MVMObject *code = GET_REG(i.cur_op, 4,i).o; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Must provide an SCRef operand to scsei->tcode"); MVM_sc_set_obj_sc(i.tc, code, (MVMSerializationContext *)sc); MVM_sc_set_code(i.tc, (MVMSerializationContext *)sc, GET_REG(i.cur_op, 2,i).i64, code); i.cur_op += 6; goto cbc_next(i); } __code cbc_scgetobj(INTER i){ MVMObject *sc = GET_REG(i.cur_op, 2,i).o; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Must provide an SCRef operand to scgetobj"); GET_REG(i.cur_op, 0,i).o = MVM_sc_get_object(i.tc, (MVMSerializationContext *)sc, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_scgethandle(INTER i){ MVMObject *sc = GET_REG(i.cur_op, 2,i).o; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Must provide an SCRef operand to scgethandle"); GET_REG(i.cur_op, 0,i).s = MVM_sc_get_handle(i.tc, (MVMSerializationContext *)sc); i.cur_op += 4; goto cbc_next(i); } __code cbc_scgetobjidx(INTER i){ MVMObject *sc = GET_REG(i.cur_op, 2,i).o; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Must provide an SCRef operand to scgetobjidx"); GET_REG(i.cur_op, 0,i).i64 = MVM_sc_find_object_idx(i.tc, (MVMSerializationContext *)sc, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_scsetdesc(INTER i){ MVMObject *sc = GET_REG(i.cur_op, 0,i).o; MVMString *desc = GET_REG(i.cur_op, 2,i).s; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Must provide an SCRef operand to scsetdesc"); MVM_sc_set_description(i.tc, (MVMSerializationContext *)sc, desc); i.cur_op += 4; goto cbc_next(i); } __code cbc_scobjcount(INTER i){ MVMObject *sc = GET_REG(i.cur_op, 2,i).o; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Must provide an SCRef operand to scobjcount"); GET_REG(i.cur_op, 0,i).i64 = MVM_sc_get_object_count(i.tc, (MVMSerializationContext *)sc); i.cur_op += 4; goto cbc_next(i); } __code cbc_setobjsc(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; MVMObject *sc = GET_REG(i.cur_op, 2,i).o; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Must provide an SCRef operand to setobjsc"); MVM_sc_set_obj_sc(i.tc, obj, (MVMSerializationContext *)sc); i.cur_op += 4; goto cbc_next(i); } __code cbc_getobjsc(INTER i){ GET_REG(i.cur_op, 0,i).o = (MVMObject *)MVM_sc_get_obj_sc(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_serialize(INTER i){ MVMObject *sc = GET_REG(i.cur_op, 2,i).o; MVMObject *obj = GET_REG(i.cur_op, 4,i).o; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Must provide an SCRef operand to serialize"); GET_REG(i.cur_op, 0,i).s = MVM_serialization_serialize(i.tc, (MVMSerializationContext *)sc, obj); i.cur_op += 6; goto cbc_next(i); } __code cbc_deserialize(INTER i){ MVMString *blob = GET_REG(i.cur_op, 0,i).s; MVMObject *sc = GET_REG(i.cur_op, 2,i).o; MVMObject *sh = GET_REG(i.cur_op, 4,i).o; MVMObject *cr = GET_REG(i.cur_op, 6,i).o; MVMObject *conf = GET_REG(i.cur_op, 8,i).o; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Must provide an SCRef operand to deserialize"); MVM_serialization_deserialize(i.tc, (MVMSerializationContext *)sc, sh, cr, conf, blob); i.cur_op += 10; goto cbc_next(i); } __code cbc_wval(INTER i){ MVMuint16 dep = GET_UI16(i.cur_op, 2); MVMuint16 idx = GET_UI16(i.cur_op, 4); GET_REG(i.cur_op, 0,i).o = MVM_sc_get_sc_object(i.tc,i.cu, dep, idx); i.cur_op += 6; goto cbc_next(i); } __code cbc_wval_wide(INTER i){ MVMuint16 dep = GET_UI16(i.cur_op, 2); MVMuint64 idx = MVM_BC_get_I64(i.cur_op, 4); GET_REG(i.cur_op, 0,i).o = MVM_sc_get_sc_object(i.tc,i.cu, dep, idx); i.cur_op += 12; goto cbc_next(i); } __code cbc_scwbdisable(INTER i){ GET_REG(i.cur_op, 0,i).i64 = ++i.tc->sc_wb_disable_depth; i.cur_op += 2; goto cbc_next(i); } __code cbc_scwbenable(INTER i){ GET_REG(i.cur_op, 0,i).i64 = --i.tc->sc_wb_disable_depth; i.cur_op += 2; goto cbc_next(i); } __code cbc_pushcompsc(INTER i){ MVMObject * const sc = GET_REG(i.cur_op, 0,i).o; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Can only push an SCRef with pushcompsc"); if (MVM_is_null(i.tc, i.tc->compiling_scs)) { MVMROOT(i.tc, sc, { i.tc->compiling_scs = MVM_repr_alloc_init(i.tc, i.tc->instance->boot_types.BOOTArray); }); } MVM_repr_unshift_o(i.tc, i.tc->compiling_scs, sc); i.cur_op += 2; goto cbc_next(i); } __code cbc_popcompsc(INTER i){ MVMObject * const scs = i.tc->compiling_scs; if (MVM_is_null(i.tc, scs) || MVM_repr_elems(i.tc, scs) == 0) MVM_exception_throw_adhoc(i.tc, "No current compiling SC"); GET_REG(i.cur_op, 0,i).o = MVM_repr_shift_o(i.tc, i.tc->compiling_scs); i.cur_op += 2; goto cbc_next(i); } __code cbc_scgetdesc(INTER i){ MVMObject *sc = GET_REG(i.cur_op, 2,i).o; if (REPR(sc)->ID != MVM_REPR_ID_SCRef) MVM_exception_throw_adhoc(i.tc, "Must provide an SCRef operand to scgetdesc"); GET_REG(i.cur_op, 0,i).s = MVM_sc_get_description(i.tc, (MVMSerializationContext *)sc); i.cur_op += 4; goto cbc_next(i); } __code cbc_loadbytecode(INTER i){ /* This op will end up returning into the runloop to run * deserialization and load code, so make sure we're done * processing this op really. */ MVMString *filename = GET_REG(i.cur_op, 2,i).s; GET_REG(i.cur_op, 0,i).s = filename; i.cur_op += 4; /* Set up return (really continuation after load) address * and enter bytecode loading process. */ i.tc->cur_frame->return_address = i.cur_op; MVM_load_bytecode(i.tc, filename); goto cbc_next(i); } __code cbc_loadbytecodebuffer(INTER i){ /* This op will end up returning into the runloop to run * deserialization and load code, so make sure we're done * processing this op really. */ MVMObject *buffer = GET_REG(i.cur_op, 0,i).o; i.cur_op += 2; /* Set up return (really continuation after load) address * and enter bytecode loading process. */ i.tc->cur_frame->return_address = i.cur_op; MVM_load_bytecode_buffer(i.tc, buffer); goto cbc_next(i); } __code cbc_loadbytecodefh(INTER i){ /* This op will end up returning into the runloop to run * deserialization and load code, so make sure we're done * processing this op really. */ MVMObject *file = GET_REG(i.cur_op, 0,i).o; MVMString *filename = GET_REG(i.cur_op, 2,i).s; i.cur_op += 4; /* Set up return (really continuation after load) address * and enter bytecode loading process. */ i.tc->cur_frame->return_address = i.cur_op; MVM_load_bytecode_fh(i.tc, file, filename); goto cbc_next(i); } __code cbc_masttofile(INTER i){ MVM_mast_to_file(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_masttocu(INTER i){ /* This op will end up returning into the runloop to run * deserialization and load code, so make sure we're done * processing this op really. */ MVMObject *node = GET_REG(i.cur_op, 2,i).o; MVMObject *types = GET_REG(i.cur_op, 4,i).o; MVMRegister *result_reg = &GET_REG(i.cur_op, 0,i); i.cur_op += 6; /* Set up return (really continuation after load) address * and enter bytecode loading process. */ i.tc->cur_frame->return_address = i.cur_op; MVM_mast_to_cu(i.tc, node, types, result_reg); goto cbc_next(i); } __code cbc_iscompunit(INTER i){ MVMObject *maybe_cu = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = REPR(maybe_cu)->ID == MVM_REPR_ID_MVMCompUnit; i.cur_op += 4; goto cbc_next(i); } __code cbc_compunitmainline(INTER i){ MVMObject *maybe_cu = GET_REG(i.cur_op, 2,i).o; if (REPR(maybe_cu)->ID == MVM_REPR_ID_MVMCompUnit) { MVMCompUnit *cu = (MVMCompUnit *)maybe_cu; GET_REG(i.cur_op, 0,i).o = cu->body.coderefs[0]; } else { MVM_exception_throw_adhoc(i.tc, "compunitmainline requires an MVMCompUnit"); } i.cur_op += 4; goto cbc_next(i); } __code cbc_compunitcodes(INTER i){ MVMObject * const result = MVM_repr_alloc_init(i.tc, MVM_hll_current(i.tc)->slurpy_array_type); MVMCompUnit * const maybe_cu = (MVMCompUnit *)GET_REG(i.cur_op, 2,i).o; if (REPR(maybe_cu)->ID == MVM_REPR_ID_MVMCompUnit) { const MVMuint32 num_frames = maybe_cu->body.num_frames; MVMObject ** const coderefs = maybe_cu->body.coderefs; MVMuint32 j; for (j = 0; j < num_frames; j++) { MVM_repr_push_o(i.tc, result, coderefs[j]); } GET_REG(i.cur_op, 0,i).o = result; } else { MVM_exception_throw_adhoc(i.tc, "compunii->tcodes requires an MVMCompUnit"); } i.cur_op += 4; goto cbc_next(i); } __code cbc_ctx(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_frame_context_wrapper(i.tc, i.tc->cur_frame); i.cur_op += 2; goto cbc_next(i); } __code cbc_ctxouter(INTER i){ MVMObject *this_ctx = GET_REG(i.cur_op, 2,i).o; MVMFrame *frame; if (!IS_CONCRETE(this_ctx) || REPR(this_ctx)->ID != MVM_REPR_ID_MVMContext) { MVM_exception_throw_adhoc(i.tc, "ctxouter needs an MVMContext"); } if ((frame = ((MVMContext *)this_ctx)->body.context->outer)) GET_REG(i.cur_op, 0,i).o = MVM_frame_context_wrapper(i.tc, frame); else GET_REG(i.cur_op, 0,i).o = i.tc->instance->VMNull; i.cur_op += 4; goto cbc_next(i); } __code cbc_ctxcaller(INTER i){ MVMObject *this_ctx = GET_REG(i.cur_op, 2,i).o, *ctx = NULL; MVMFrame *frame; if (!IS_CONCRETE(this_ctx) || REPR(this_ctx)->ID != MVM_REPR_ID_MVMContext) { MVM_exception_throw_adhoc(i.tc, "ctxcaller needs an MVMContext"); } if ((frame = ((MVMContext *)this_ctx)->body.context->caller)) ctx = MVM_frame_context_wrapper(i.tc, frame); GET_REG(i.cur_op, 0,i).o = ctx ? ctx : i.tc->instance->VMNull; i.cur_op += 4; goto cbc_next(i); } __code cbc_ctxlexpad(INTER i){ MVMObject *this_ctx = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(this_ctx) || REPR(this_ctx)->ID != MVM_REPR_ID_MVMContext) { MVM_exception_throw_adhoc(i.tc, "ctxlexpad needs an MVMContext"); } GET_REG(i.cur_op, 0,i).o = this_ctx; i.cur_op += 4; goto cbc_next(i); } __code cbc_curcode(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->cur_frame->code_ref; i.cur_op += 2; goto cbc_next(i); } __code cbc_callercode(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->cur_frame->caller ? i.tc->cur_frame->caller->code_ref : i.tc->instance->VMNull; i.cur_op += 2; goto cbc_next(i); } __code cbc_add_I(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_bigint_add(i.tc, GET_REG(i.cur_op, 6,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_sub_I(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_bigint_sub(i.tc, GET_REG(i.cur_op, 6,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_mul_I(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_bigint_mul(i.tc, GET_REG(i.cur_op, 6,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_div_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 6,i).o; GET_REG(i.cur_op, 0,i).o = MVM_bigint_div(i.tc, type, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_mod_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 6,i).o; GET_REG(i.cur_op, 0,i).o = MVM_bigint_mod(i.tc, type, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_neg_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 4,i).o; MVMObject * const result = MVM_repr_alloc_init(i.tc, type); MVM_bigint_neg(i.tc, result, GET_REG(i.cur_op, 2,i).o); GET_REG(i.cur_op, 0,i).o = result; i.cur_op += 6; goto cbc_next(i); } __code cbc_abs_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 4,i).o; MVMObject * const result = MVM_repr_alloc_init(i.tc, type); MVM_bigint_abs(i.tc, result, GET_REG(i.cur_op, 2,i).o); GET_REG(i.cur_op, 0,i).o = result; i.cur_op += 6; goto cbc_next(i); } __code cbc_cmp_I(INTER i){ MVMObject *a = GET_REG(i.cur_op, 2,i).o, *b = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).i64 = MVM_bigint_cmp(i.tc, a, b); i.cur_op += 6; goto cbc_next(i); } __code cbc_eq_I(INTER i){ MVMObject *a = GET_REG(i.cur_op, 2,i).o, *b = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).i64 = MP_EQ == MVM_bigint_cmp(i.tc, a, b); i.cur_op += 6; goto cbc_next(i); } __code cbc_ne_I(INTER i){ MVMObject *a = GET_REG(i.cur_op, 2,i).o, *b = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).i64 = MP_EQ != MVM_bigint_cmp(i.tc, a, b); i.cur_op += 6; goto cbc_next(i); } __code cbc_lt_I(INTER i){ MVMObject *a = GET_REG(i.cur_op, 2,i).o, *b = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).i64 = MP_LT == MVM_bigint_cmp(i.tc, a, b); i.cur_op += 6; goto cbc_next(i); } __code cbc_le_I(INTER i){ MVMObject *a = GET_REG(i.cur_op, 2,i).o, *b = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).i64 = MP_GT != MVM_bigint_cmp(i.tc, a, b); i.cur_op += 6; goto cbc_next(i); } __code cbc_gt_I(INTER i){ MVMObject *a = GET_REG(i.cur_op, 2,i).o, *b = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).i64 = MP_GT == MVM_bigint_cmp(i.tc, a, b); i.cur_op += 6; goto cbc_next(i); } __code cbc_ge_I(INTER i){ MVMObject *a = GET_REG(i.cur_op, 2,i).o, *b = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).i64 = MP_LT != MVM_bigint_cmp(i.tc, a, b); i.cur_op += 6; goto cbc_next(i); } __code cbc_bor_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 6,i).o; GET_REG(i.cur_op, 0,i).o = MVM_bigint_or(i.tc, type, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_bxor_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 6,i).o; GET_REG(i.cur_op, 0,i).o = MVM_bigint_xor(i.tc, type, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_band_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 6,i).o; GET_REG(i.cur_op, 0,i).o = MVM_bigint_and(i.tc, type, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_bnot_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).o = MVM_bigint_not(i.tc, type, GET_REG(i.cur_op, 2,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_blshift_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 6,i).o; GET_REG(i.cur_op, 0,i).o = MVM_bigint_shl(i.tc, type, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_brshift_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 6,i).o; GET_REG(i.cur_op, 0,i).o = MVM_bigint_shr(i.tc, type, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_pow_I(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_bigint_pow(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).o, GET_REG(i.cur_op, 8,i).o); i.cur_op += 10; goto cbc_next(i); } __code cbc_gcd_I(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_bigint_gcd(i.tc, GET_REG(i.cur_op, 6,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_lcm_I(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_bigint_lcm(i.tc, GET_REG(i.cur_op, 6,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_expmod_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 8,i).o; MVMObject * const result = MVM_repr_alloc_init(i.tc, type); MVM_bigint_expmod(i.tc, result, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).o); GET_REG(i.cur_op, 0,i).o = result; i.cur_op += 10; goto cbc_next(i); } __code cbc_isprime_I(INTER i){ MVMObject *a = GET_REG(i.cur_op, 2,i).o; MVMint64 b = GET_REG(i.cur_op, 4,i).i64; GET_REG(i.cur_op, 0,i).i64 = MVM_bigint_is_prime(i.tc, a, b); i.cur_op += 6; goto cbc_next(i); } __code cbc_rand_I(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).o = MVM_bigint_rand(i.tc, type, GET_REG(i.cur_op, 2,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_coerce_In(INTER i){ MVMObject *a = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).n64 = MVM_bigint_to_num(i.tc, a); i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_Is(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_bigint_to_str(i.tc, GET_REG(i.cur_op, 2,i).o, 10); i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_nI(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).o = MVM_bigint_from_num(i.tc, type, GET_REG(i.cur_op, 2,i).n64); i.cur_op += 6; goto cbc_next(i); } __code cbc_coerce_sI(INTER i){ MVMString *s = GET_REG(i.cur_op, 2,i).s; MVMObject *type = GET_REG(i.cur_op, 4,i).o; char *buf = MVM_string_ascii_encode(i.tc, s, NULL, 0); MVMObject *a = MVM_repr_alloc_init(i.tc, type); MVM_bigint_from_str(i.tc, a, buf); MVM_free(buf); GET_REG(i.cur_op, 0,i).o = a; i.cur_op += 6; goto cbc_next(i); } __code cbc_isbig_I(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_bigint_is_big(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_bool_I(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_bigint_bool(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_base_I(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_bigint_to_str(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_radix_I(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_bigint_radix(i.tc, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64, GET_REG(i.cur_op, 10,i).o); i.cur_op += 12; goto cbc_next(i); } __code cbc_div_In(INTER i){ MVMObject *a = GET_REG(i.cur_op, 2,i).o, *b = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).n64 = MVM_bigint_div_num(i.tc, a, b); i.cur_op += 6; goto cbc_next(i); } __code cbc_copy_f(INTER i){ MVM_file_copy(i.tc, GET_REG(i.cur_op, 0,i).s, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_append_f(INTER i){ MVM_exception_throw_adhoc(i.tc, "append is not supported"); goto cbc_next(i); } __code cbc_rename_f(INTER i){ MVM_file_rename(i.tc, GET_REG(i.cur_op, 0,i).s, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_delete_f(INTER i){ MVM_file_delete(i.tc, GET_REG(i.cur_op, 0,i).s); i.cur_op += 2; goto cbc_next(i); } __code cbc_chmod_f(INTER i){ MVM_file_chmod(i.tc, GET_REG(i.cur_op, 0,i).s, GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_exists_f(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_file_exists(i.tc, GET_REG(i.cur_op, 2,i).s, 0); i.cur_op += 4; goto cbc_next(i); } __code cbc_mkdir(INTER i){ MVM_dir_mkdir(i.tc, GET_REG(i.cur_op, 0,i).s, GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_rmdir(INTER i){ MVM_dir_rmdir(i.tc, GET_REG(i.cur_op, 0,i).s); i.cur_op += 2; goto cbc_next(i); } __code cbc_open_dir(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_dir_open(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_read_dir(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_dir_read(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_close_dir(INTER i){ MVM_dir_close(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_open_fh(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_file_open_fh(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_close_fh(INTER i){ MVM_io_close(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_seek_fh(INTER i){ MVM_io_seek(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_lock_fh(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_io_lock(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_unlock_fh(INTER i){ MVM_io_unlock(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_sync_fh(INTER i){ MVM_io_flush(i.tc, GET_REG(i.cur_op, 0,i).o, 1); i.cur_op += 2; goto cbc_next(i); } __code cbc_trunc_fh(INTER i){ MVM_io_truncate(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_eof_fh(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_io_eof(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_getstdin(INTER i){ if (MVM_is_null(i.tc, i.tc->instance->stdin_handle)) MVM_exception_throw_adhoc(i.tc, "STDIN filehandle was never initialized"); GET_REG(i.cur_op, 0,i).o = i.tc->instance->stdin_handle; i.cur_op += 2; goto cbc_next(i); } __code cbc_getstdout(INTER i){ if (MVM_is_null(i.tc, i.tc->instance->stdout_handle)) MVM_exception_throw_adhoc(i.tc, "STDOUT filehandle was never initialized"); GET_REG(i.cur_op, 0,i).o = i.tc->instance->stdout_handle; i.cur_op += 2; goto cbc_next(i); } __code cbc_getstderr(INTER i){ if (MVM_is_null(i.tc, i.tc->instance->stderr_handle)) MVM_exception_throw_adhoc(i.tc, "STDERR filehandle was never initialized"); GET_REG(i.cur_op, 0,i).o = i.tc->instance->stderr_handle; i.cur_op += 2; goto cbc_next(i); } __code cbc_connect_sk(INTER i){ MVM_io_connect(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_socket(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_socket_create(i.tc, GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_getport_sk(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_io_getport(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_bind_sk(INTER i){ MVM_io_bind(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, (int)GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_accept_sk(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_accept(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_decodetocodes(INTER i){ goto cbc_encodefromcodes(i); } __code cbc_encodefromcodes(INTER i){ MVM_exception_throw_adhoc(i.tc, "NYI"); goto cbc_print(i); } __code cbc_print(INTER i){ MVM_string_print(i.tc, GET_REG(i.cur_op, 0,i).s); i.cur_op += 2; goto cbc_next(i); } __code cbc_say(INTER i){ MVM_string_say(i.tc, GET_REG(i.cur_op, 0,i).s); i.cur_op += 2; goto cbc_next(i); } __code cbc_tell_fh(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_io_tell(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_stat(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_file_stat(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, 0); i.cur_op += 6; goto cbc_next(i); } __code cbc_tryfindmeth(INTER i){ MVMRegister *res = &GET_REG(i.cur_op, 0,i); MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMString *name = MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 4)); i.cur_op += 8; MVM_6model_find_method(i.tc, obj, name, res, 0); goto cbc_next(i); } __code cbc_tryfindmeth_s(INTER i){ MVMRegister *res = &GET_REG(i.cur_op, 0,i); MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMString *name = GET_REG(i.cur_op, 4,i).s; i.cur_op += 6; MVM_6model_find_method(i.tc, obj, name, res, 0); goto cbc_next(i); } __code cbc_chdir(INTER i){ MVM_dir_chdir(i.tc, GET_REG(i.cur_op, 0,i).s); i.cur_op += 2; goto cbc_next(i); } __code cbc_srand(INTER i){ MVM_proc_seed(i.tc, GET_REG(i.cur_op, 0,i).i64); i.cur_op += 2; goto cbc_next(i); } __code cbc_rand_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_proc_rand_i(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_rand_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_proc_rand_n(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_time_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_proc_time_i(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_sleep(INTER i){ MVM_gc_mark_thread_blocked(i.tc); MVM_platform_sleep(GET_REG(i.cur_op, 0,i).n64); MVM_gc_mark_thread_unblocked(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_newthread(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_thread_new(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_threadjoin(INTER i){ MVM_thread_join(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_time_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_proc_time_n(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_exit(INTER i){ MVMint64 exit_code = GET_REG(i.cur_op, 0,i).i64; MVM_io_flush_standard_handles(i.tc); exit(exit_code); goto cbc_next(i); } __code cbc_cwd(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_dir_cwd(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_clargs(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_proc_clargs(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_getenvhash(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_proc_getenvhash(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_loadlib(INTER i){ MVMString *name = GET_REG(i.cur_op, 0,i).s; MVMString *path = GET_REG(i.cur_op, 2,i).s; MVM_dll_load(i.tc, name, path); i.cur_op += 4; goto cbc_next(i); } __code cbc_freelib(INTER i){ MVMString *name = GET_REG(i.cur_op, 0,i).s; MVM_dll_free(i.tc, name); i.cur_op += 2; goto cbc_next(i); } __code cbc_findsym(INTER i){ MVMString *lib = GET_REG(i.cur_op, 2,i).s; MVMString *sym = GET_REG(i.cur_op, 4,i).s; MVMObject *obj = MVM_dll_find_symbol(i.tc, lib, sym); if (MVM_is_null(i.tc, obj)) MVM_exception_throw_adhoc(i.tc, "symbol not found in DLL"); GET_REG(i.cur_op, 0,i).o = obj; i.cur_op += 6; goto cbc_next(i); } __code cbc_dropsym(INTER i){ MVM_dll_drop_symbol(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_loadext(INTER i){ MVMString *lib = GET_REG(i.cur_op, 0,i).s; MVMString *ext = GET_REG(i.cur_op, 2,i).s; MVM_ext_load(i.tc, lib, ext); i.cur_op += 4; goto cbc_next(i); } __code cbc_backendconfig(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_backend_config(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_getlexouter(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_frame_find_lexical_by_name_outer(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_getlexrel(INTER i){ MVMObject *ctx = GET_REG(i.cur_op, 2,i).o; MVMRegister *r; if (REPR(ctx)->ID != MVM_REPR_ID_MVMContext || !IS_CONCRETE(ctx)) MVM_exception_throw_adhoc(i.tc, "getlexrel needs a context"); r = MVM_frame_find_lexical_by_name_rel(i.tc, GET_REG(i.cur_op, 4,i).s, ((MVMContext *)ctx)->body.context); GET_REG(i.cur_op, 0,i).o = r ? r->o : i.tc->instance->VMNull; i.cur_op += 6; goto cbc_next(i); } __code cbc_getlexreldyn(INTER i){ MVMObject *ctx = GET_REG(i.cur_op, 2,i).o; if (REPR(ctx)->ID != MVM_REPR_ID_MVMContext || !IS_CONCRETE(ctx)) MVM_exception_throw_adhoc(i.tc, "getlexreldyn needs a context"); GET_REG(i.cur_op, 0,i).o = MVM_frame_getdynlex(i.tc, GET_REG(i.cur_op, 4,i).s, ((MVMContext *)ctx)->body.context); i.cur_op += 6; goto cbc_next(i); } __code cbc_getlexrelcaller(INTER i){ MVMObject *ctx = GET_REG(i.cur_op, 2,i).o; MVMRegister *res; if (REPR(ctx)->ID != MVM_REPR_ID_MVMContext || !IS_CONCRETE(ctx)) MVM_exception_throw_adhoc(i.tc, "getlexrelcaller needs a context"); res = MVM_frame_find_lexical_by_name_rel_caller(i.tc, GET_REG(i.cur_op, 4,i).s, ((MVMContext *)ctx)->body.context); GET_REG(i.cur_op, 0,i).o = res ? res->o : i.tc->instance->VMNull; i.cur_op += 6; goto cbc_next(i); } __code cbc_getlexcaller(INTER i){ MVMRegister *res = MVM_frame_find_lexical_by_name_rel_caller(i.tc, GET_REG(i.cur_op, 2,i).s, i.tc->cur_frame->caller); GET_REG(i.cur_op, 0,i).o = res ? res->o : i.tc->instance->VMNull; i.cur_op += 4; goto cbc_next(i); } __code cbc_bitand_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_bitand(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_bitor_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_bitor(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_bitxor_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_bitxor(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_isnanorinf(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_num_isnanorinf(i.tc, GET_REG(i.cur_op, 2,i).n64); i.cur_op += 4; goto cbc_next(i); } __code cbc_inf(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_num_posinf(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_neginf(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_num_neginf(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_nan(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_num_nan(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_getpid(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_proc_getpid(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_filereadable(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_file_isreadable(i.tc, GET_REG(i.cur_op, 2,i).s,0); i.cur_op += 4; goto cbc_next(i); } __code cbc_filewritable(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_file_iswritable(i.tc, GET_REG(i.cur_op, 2,i).s,0); i.cur_op += 4; goto cbc_next(i); } __code cbc_fileexecutable(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_file_isexecutable(i.tc, GET_REG(i.cur_op, 2,i).s,0); i.cur_op += 4; goto cbc_next(i); } __code cbc_capturenamedshash(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { MVMCallCapture *cc = (MVMCallCapture *)obj; GET_REG(i.cur_op, 0,i).o = MVM_args_slurpy_named(i.tc, cc->body.apc); } else { MVM_exception_throw_adhoc(i.tc, "capturehasnameds needs a MVMCallCapture"); } i.cur_op += 4; goto cbc_next(i); } __code cbc_read_fhb(INTER i){ MVM_io_read_bytes(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_write_fhb(INTER i){ MVM_io_write_bytes(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_replace(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_replace(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).s); i.cur_op += 10; goto cbc_next(i); } __code cbc_newexception(INTER i){ GET_REG(i.cur_op, 0,i).o = (MVMObject *)MVM_repr_alloc_init(i.tc, i.tc->instance->boot_types.BOOTException); i.cur_op += 2; goto cbc_next(i); } __code cbc_permit(INTER i){ MVM_io_eventloop_permit(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_backtrace(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_exception_backtrace(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_symlink(INTER i){ MVM_file_symlink(i.tc, GET_REG(i.cur_op, 0,i).s, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_link(INTER i){ MVM_file_link(i.tc, GET_REG(i.cur_op, 0,i).s, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_gethostname(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_io_get_hostname(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_exreturnafterunwind(INTER i){ MVMObject *ex = GET_REG(i.cur_op, 0,i).o; MVM_exception_returnafterunwind(i.tc, ex); i.cur_op += 2; goto cbc_next(i); } __code cbc_continuationreset(INTER i){ MVMRegister *res = &GET_REG(i.cur_op, 0,i); MVMObject *tag = GET_REG(i.cur_op, 2,i).o; MVMObject *code = GET_REG(i.cur_op, 4,i).o; i.cur_op += 6; MVM_continuation_reset(i.tc, tag, code, res); goto cbc_next(i); } __code cbc_continuationcontrol(INTER i){ MVMRegister *res = &GET_REG(i.cur_op, 0,i); MVMint64 protect = GET_REG(i.cur_op, 2,i).i64; MVMObject *tag = GET_REG(i.cur_op, 4,i).o; MVMObject *code = GET_REG(i.cur_op, 6,i).o; i.cur_op += 8; MVM_continuation_control(i.tc, protect, tag, code, res); goto cbc_next(i); } __code cbc_continuationinvoke(INTER i){ MVMRegister *res = &GET_REG(i.cur_op, 0,i); MVMObject *cont = GET_REG(i.cur_op, 2,i).o; MVMObject *code = GET_REG(i.cur_op, 4,i).o; i.cur_op += 6; MVM_continuation_invoke(i.tc, (MVMContinuation *)cont, code, res); goto cbc_next(i); } __code cbc_randscale_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_proc_rand_n(i.tc) * GET_REG(i.cur_op, 2,i).n64; i.cur_op += 4; goto cbc_next(i); } __code cbc_uniisblock(INTER i){ GET_REG(i.cur_op, 0,i).i64 = (MVMint64)MVM_unicode_is_in_block(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).s); i.cur_op += 8; goto cbc_next(i); } __code cbc_assertparamcheck(INTER i){ MVMint64 ok = GET_REG(i.cur_op, 0,i).i64; i.cur_op += 2; if (!ok) MVM_args_bind_failed(i.tc); goto cbc_next(i); } __code cbc_hintfor(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = REPR(obj)->attr_funcs.hint_for(i.tc, STABLE(obj), obj, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_paramnamesused(INTER i){ MVMArgProcContext *ctx = &i.tc->cur_frame->params; if (ctx->callsite->num_pos != ctx->callsite->arg_count) MVM_args_assert_nameds_used(i.tc, ctx); goto cbc_next(i); } __code cbc_getuniname(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_unicode_get_name(i.tc, GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_getuniprop_int(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_unicode_codepoint_get_property_int(i.tc, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_getuniprop_bool(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_unicode_codepoint_get_property_bool(i.tc, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_getuniprop_str(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_unicode_codepoint_get_property_str(i.tc, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_matchuniprop(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_unicode_codepoint_has_property_value(i.tc, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_nativecallbuild(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_nativecall_build(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).s, GET_REG(i.cur_op, 8,i).s, GET_REG(i.cur_op, 10,i).o, GET_REG(i.cur_op, 12,i).o); i.cur_op += 14; goto cbc_next(i); } __code cbc_nativecallinvoke(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativecall_invoke(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_nativecallrefresh(INTER i){ MVM_nativecall_refresh(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_threadrun(INTER i){ MVM_thread_run(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_threadid(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_thread_id(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_threadyield(INTER i){ MVM_thread_yield(i.tc); goto cbc_next(i); } __code cbc_currentthread(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_thread_current(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_lock(INTER i){ MVM_reentrantmutex_lock_checked(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_unlock(INTER i){ MVM_reentrantmutex_unlock_checked(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_semacquire(INTER i){ MVMObject *sem = GET_REG(i.cur_op, 0,i).o; if (REPR(sem)->ID == MVM_REPR_ID_Semaphore && IS_CONCRETE(sem)) MVM_semaphore_acquire(i.tc, (MVMSemaphore *)sem); else MVM_exception_throw_adhoc(i.tc, "semacquire requires a concrete object with REPR Semaphore"); i.cur_op += 2; goto cbc_next(i); } __code cbc_semtryacquire(INTER i){ MVMObject *sem = GET_REG(i.cur_op, 2,i).o; if (REPR(sem)->ID == MVM_REPR_ID_Semaphore && IS_CONCRETE(sem)) GET_REG(i.cur_op, 0,i).i64 = MVM_semaphore_tryacquire(i.tc, (MVMSemaphore *)sem); else MVM_exception_throw_adhoc(i.tc, "semtryacquire requires a concrete object with REPR Semaphore"); i.cur_op += 4; goto cbc_next(i); } __code cbc_semrelease(INTER i){ MVMObject *sem = GET_REG(i.cur_op, 0,i).o; if (REPR(sem)->ID == MVM_REPR_ID_Semaphore && IS_CONCRETE(sem)) MVM_semaphore_release(i.tc, (MVMSemaphore *)sem); else MVM_exception_throw_adhoc(i.tc, "semrelease requires a concrete object with REPR Semaphore"); i.cur_op += 2; goto cbc_next(i); } __code cbc_getlockcondvar(INTER i){ MVMObject *lock = GET_REG(i.cur_op, 2,i).o; if (REPR(lock)->ID == MVM_REPR_ID_ReentrantMutex && IS_CONCRETE(lock)) GET_REG(i.cur_op, 0,i).o = MVM_conditionvariable_from_lock(i.tc, (MVMReentrantMutex *)lock, GET_REG(i.cur_op, 4,i).o); else MVM_exception_throw_adhoc(i.tc, "getlockcondvar requires a concrete object with REPR ReentrantMutex"); i.cur_op += 6; goto cbc_next(i); } __code cbc_condwait(INTER i){ MVMObject *cv = GET_REG(i.cur_op, 0,i).o; if (REPR(cv)->ID == MVM_REPR_ID_ConditionVariable && IS_CONCRETE(cv)) MVM_conditionvariable_wait(i.tc, (MVMConditionVariable *)cv); else MVM_exception_throw_adhoc(i.tc, "condwait requires a concrete object with REPR ConditionVariable"); i.cur_op += 2; goto cbc_next(i); } __code cbc_condsignalone(INTER i){ MVMObject *cv = GET_REG(i.cur_op, 0,i).o; if (REPR(cv)->ID == MVM_REPR_ID_ConditionVariable && IS_CONCRETE(cv)) MVM_conditionvariable_signal_one(i.tc, (MVMConditionVariable *)cv); else MVM_exception_throw_adhoc(i.tc, "condsignalone requires a concrete object with REPR ConditionVariable"); i.cur_op += 2; goto cbc_next(i); } __code cbc_condsignalall(INTER i){ MVMObject *cv = GET_REG(i.cur_op, 0,i).o; if (REPR(cv)->ID == MVM_REPR_ID_ConditionVariable && IS_CONCRETE(cv)) MVM_conditionvariable_signal_all(i.tc, (MVMConditionVariable *)cv); else MVM_exception_throw_adhoc(i.tc, "condsignalall requires a concrete object with REPR ConditionVariable"); i.cur_op += 2; goto cbc_next(i); } __code cbc_queuepoll(INTER i){ MVMObject *queue = GET_REG(i.cur_op, 2,i).o; if (REPR(queue)->ID == MVM_REPR_ID_ConcBlockingQueue && IS_CONCRETE(queue)) GET_REG(i.cur_op, 0,i).o = MVM_concblockingqueue_poll(i.tc, (MVMConcBlockingQueue *)queue); else MVM_exception_throw_adhoc(i.tc, "queuepoll requires a concrete object with REPR ConcBlockingQueue"); i.cur_op += 4; goto cbc_next(i); } __code cbc_setmultispec(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; MVMObject *ch = GET_REG(i.cur_op, 2,i).o; MVMString *valid_attr = GET_REG(i.cur_op, 4,i).s; MVMString *cache_attr = GET_REG(i.cur_op, 6,i).s; MVMSTable *st = STABLE(obj); MVMInvocationSpec *is = st->invocation_spec; if (!is) MVM_exception_throw_adhoc(i.tc, "Can only use setmultispec after setinvokespec"); MVM_ASSIGN_REF(i.tc, &(st->header), is->md_class_handle, ch); MVM_ASSIGN_REF(i.tc, &(st->header), is->md_valid_attr_name, valid_attr); MVM_ASSIGN_REF(i.tc, &(st->header), is->md_cache_attr_name, cache_attr); is->md_valid_hint = REPR(ch)->attr_funcs.hint_for(i.tc, STABLE(ch), ch, valid_attr); is->md_cache_hint = REPR(ch)->attr_funcs.hint_for(i.tc, STABLE(ch), ch, cache_attr); i.cur_op += 8; goto cbc_next(i); } __code cbc_ctxouterskipthunks(INTER i){ MVMObject *this_ctx = GET_REG(i.cur_op, 2,i).o; MVMFrame *frame; if (!IS_CONCRETE(this_ctx) || REPR(this_ctx)->ID != MVM_REPR_ID_MVMContext) { MVM_exception_throw_adhoc(i.tc, "ctxouter needs an MVMContext"); } frame = ((MVMContext *)this_ctx)->body.context->outer; while (frame && frame->static_info->body.is_thunk) frame = frame->caller; if (frame) GET_REG(i.cur_op, 0,i).o = MVM_frame_context_wrapper(i.tc, frame); else GET_REG(i.cur_op, 0,i).o = i.tc->instance->VMNull; i.cur_op += 4; goto cbc_next(i); } __code cbc_ctxcallerskipthunks(INTER i){ MVMObject *this_ctx = GET_REG(i.cur_op, 2,i).o, *ctx = NULL; MVMFrame *frame; if (!IS_CONCRETE(this_ctx) || REPR(this_ctx)->ID != MVM_REPR_ID_MVMContext) { MVM_exception_throw_adhoc(i.tc, "ctxcaller needs an MVMContext"); } frame = ((MVMContext *)this_ctx)->body.context->caller; while (frame && frame->static_info->body.is_thunk) frame = frame->caller; if (frame) ctx = MVM_frame_context_wrapper(i.tc, frame); GET_REG(i.cur_op, 0,i).o = ctx ? ctx : i.tc->instance->VMNull; i.cur_op += 4; goto cbc_next(i); } __code cbc_timer(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_timer_create(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64, GET_REG(i.cur_op, 10,i).o); i.cur_op += 12; goto cbc_next(i); } __code cbc_cancel(INTER i){ MVM_io_eventloop_cancel_work(i.tc, GET_REG(i.cur_op, 0,i).o, NULL, NULL); i.cur_op += 2; goto cbc_next(i); } __code cbc_signal(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_signal_handle(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).o); i.cur_op += 10; goto cbc_next(i); } __code cbc_watchfile(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_file_watch(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s, GET_REG(i.cur_op, 8,i).o); i.cur_op += 10; goto cbc_next(i); } __code cbc_asyncconnect(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_socket_connect_async(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s, GET_REG(i.cur_op, 8,i).i64, GET_REG(i.cur_op, 10,i).o); i.cur_op += 12; goto cbc_next(i); } __code cbc_asynclisten(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_socket_listen_async(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s, GET_REG(i.cur_op, 8,i).i64, (int)GET_REG(i.cur_op, 10,i).i64, GET_REG(i.cur_op, 12,i).o); i.cur_op += 14; goto cbc_next(i); } __code cbc_asyncwritebytes(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_write_bytes_async(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).o, GET_REG(i.cur_op, 8,i).o, GET_REG(i.cur_op, 10,i).o); i.cur_op += 12; goto cbc_next(i); } __code cbc_asyncreadbytes(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_read_bytes_async(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).o, GET_REG(i.cur_op, 8,i).o, GET_REG(i.cur_op, 10,i).o); i.cur_op += 12; goto cbc_next(i); } __code cbc_getlexstatic_o(INTER i){ MVMRegister *found = MVM_frame_find_lexical_by_name(i.tc, GET_REG(i.cur_op, 2,i).s, MVM_reg_obj); if (found) { GET_REG(i.cur_op, 0,i).o = found->o; if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_static(i.tc, found->o); } else { GET_REG(i.cur_op, 0,i).o = i.tc->instance->VMNull; } i.cur_op += 4; goto cbc_next(i); } __code cbc_getlexperinvtype_o(INTER i){ MVMRegister *found = MVM_frame_find_lexical_by_name(i.tc, GET_REG(i.cur_op, 2,i).s, MVM_reg_obj); if (found) { GET_REG(i.cur_op, 0,i).o = found->o; if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_type(i.tc, found->o); } else { GET_REG(i.cur_op, 0,i).o = i.tc->instance->VMNull; } i.cur_op += 4; goto cbc_next(i); } __code cbc_execname(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_executable_name(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_const_i64_16(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_I16(i.cur_op, 2); i.cur_op += 4; goto cbc_next(i); } __code cbc_const_i64_32(INTER i){ GET_REG(i.cur_op, 0,i).i64 = GET_I32(i.cur_op, 2); i.cur_op += 6; goto cbc_next(i); } __code cbc_isnonnull(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = !MVM_is_null(i.tc, obj); i.cur_op += 4; goto cbc_next(i); } __code cbc_param_rn2_i(INTER i){ MVMArgInfo param = MVM_args_get_named_int(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (param.exists) GET_REG(i.cur_op, 0,i).i64 = param.arg.i64; else GET_REG(i.cur_op, 0,i).i64 = MVM_args_get_named_int(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), MVM_ARG_REQUIRED).arg.i64; i.cur_op += 10; goto cbc_next(i); } __code cbc_param_rn2_n(INTER i){ MVMArgInfo param = MVM_args_get_named_num(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (param.exists) GET_REG(i.cur_op, 0,i).n64 = param.arg.n64; else GET_REG(i.cur_op, 0,i).n64 = MVM_args_get_named_num(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), MVM_ARG_REQUIRED).arg.n64; i.cur_op += 10; goto cbc_next(i); } __code cbc_param_rn2_s(INTER i){ MVMArgInfo param = MVM_args_get_named_str(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (param.exists) GET_REG(i.cur_op, 0,i).s = param.arg.s; else GET_REG(i.cur_op, 0,i).s = MVM_args_get_named_str(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), MVM_ARG_REQUIRED).arg.s; i.cur_op += 10; goto cbc_next(i); } __code cbc_param_rn2_o(INTER i){ MVMArgInfo param = MVM_args_get_named_obj(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (!param.exists) param = MVM_args_get_named_obj(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), MVM_ARG_REQUIRED); GET_REG(i.cur_op, 0,i).o = param.arg.o; if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_parameter(i.tc, param.arg_idx, param.arg.o); i.cur_op += 10; goto cbc_next(i); } __code cbc_param_on2_i(INTER i){ MVMArgInfo param = MVM_args_get_named_int(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (!param.exists) param = MVM_args_get_named_int(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).i64 = param.arg.i64; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 10); } else { i.cur_op += 14; } goto cbc_next(i); } __code cbc_param_on2_n(INTER i){ MVMArgInfo param = MVM_args_get_named_num(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (!param.exists) param = MVM_args_get_named_num(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).n64 = param.arg.n64; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 10); } else { i.cur_op += 14; } goto cbc_next(i); } __code cbc_param_on2_s(INTER i){ MVMArgInfo param = MVM_args_get_named_str(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (!param.exists) param = MVM_args_get_named_str(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).s = param.arg.s; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 10); } else { i.cur_op += 14; } goto cbc_next(i); } __code cbc_param_on2_o(INTER i){ MVMArgInfo param = MVM_args_get_named_obj(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (!param.exists) param = MVM_args_get_named_obj(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).o = param.arg.o; if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_parameter(i.tc, param.arg_idx, param.arg.o); i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 10); } else { i.cur_op += 14; } goto cbc_next(i); } __code cbc_osrpoint(INTER i){ if (MVM_spesh_log_is_logging(i.tc)) MVM_spesh_log_osr(i.tc); MVM_spesh_osr_poll_for_result(i.tc); goto cbc_next(i); } __code cbc_nativecallcast(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativecall_cast(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_spawnprocasync(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_proc_spawn_async(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s, GET_REG(i.cur_op, 8,i).o, GET_REG(i.cur_op, 10,i).o); i.cur_op += 12; goto cbc_next(i); } __code cbc_killprocasync(INTER i){ MVM_proc_kill_async(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_startprofile(INTER i){ MVM_profile_start(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_endprofile(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_profile_end(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_objectid(INTER i){ GET_REG(i.cur_op, 0,i).i64 = (MVMint64)MVM_gc_object_id(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_settypefinalize(INTER i){ MVM_gc_finalize_set(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_force_gc(INTER i){ MVM_gc_enter_from_allocator(i.tc); goto cbc_next(i); } __code cbc_nativecallglobal(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativecall_global(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).o, GET_REG(i.cur_op, 8,i).o); i.cur_op += 10; goto cbc_next(i); } __code cbc_setparameterizer(INTER i){ MVM_6model_parametric_setup(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_parameterizetype(INTER i){ MVMObject *type = GET_REG(i.cur_op, 2,i).o; MVMObject *params = GET_REG(i.cur_op, 4,i).o; MVMRegister *result = &(GET_REG(i.cur_op, 0,i)); i.cur_op += 6; MVM_6model_parametric_parameterize(i.tc, type, params, result); goto cbc_next(i); } __code cbc_typeparameterized(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_6model_parametric_type_parameterized(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_typeparameters(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_6model_parametric_type_parameters(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_typeparameterat(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_6model_parametric_type_parameter_at(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_readlink(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_file_readlink(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_lstat(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_file_stat(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, 1); i.cur_op += 6; goto cbc_next(i); } __code cbc_iscont_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_6model_container_iscont_i(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_iscont_n(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_6model_container_iscont_n(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_iscont_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_6model_container_iscont_s(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_assign_i(INTER i){ MVMObject *cont = GET_REG(i.cur_op, 0,i).o; MVMint64 value = GET_REG(i.cur_op, 2,i).i64; i.cur_op += 4; MVM_6model_container_assign_i(i.tc, cont, value); goto cbc_next(i); } __code cbc_assign_n(INTER i){ MVMObject *cont = GET_REG(i.cur_op, 0,i).o; MVMnum64 value = GET_REG(i.cur_op, 2,i).n64; i.cur_op += 4; MVM_6model_container_assign_n(i.tc, cont, value); goto cbc_next(i); } __code cbc_assign_s(INTER i){ MVMObject *cont = GET_REG(i.cur_op, 0,i).o; MVMString *value = GET_REG(i.cur_op, 2,i).s; i.cur_op += 4; MVM_6model_container_assign_s(i.tc, cont, value); goto cbc_next(i); } __code cbc_decont_i(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMRegister *r = &GET_REG(i.cur_op, 0,i); i.cur_op += 4; MVM_6model_container_decont_i(i.tc, obj, r); goto cbc_next(i); } __code cbc_decont_n(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMRegister *r = &GET_REG(i.cur_op, 0,i); i.cur_op += 4; MVM_6model_container_decont_n(i.tc, obj, r); goto cbc_next(i); } __code cbc_decont_s(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMRegister *r = &GET_REG(i.cur_op, 0,i); i.cur_op += 4; MVM_6model_container_decont_s(i.tc, obj, r); goto cbc_next(i); } __code cbc_getrusage(INTER i){ MVM_proc_getrusage(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_threadlockcount(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_thread_lock_count(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_getlexref_i(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_lex_i(i.tc, GET_UI16(i.cur_op, 4), GET_UI16(i.cur_op, 2)); i.cur_op += 6; goto cbc_next(i); } __code cbc_getlexref_n(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_lex_n(i.tc, GET_UI16(i.cur_op, 4), GET_UI16(i.cur_op, 2)); i.cur_op += 6; goto cbc_next(i); } __code cbc_getlexref_s(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_lex_s(i.tc, GET_UI16(i.cur_op, 4), GET_UI16(i.cur_op, 2)); i.cur_op += 6; goto cbc_next(i); } __code cbc_getlexref_ni(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_lex_name_i(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2))); i.cur_op += 6; goto cbc_next(i); } __code cbc_getlexref_nn(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_lex_name_n(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2))); i.cur_op += 6; goto cbc_next(i); } __code cbc_getlexref_ns(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_lex_name_s(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2))); i.cur_op += 6; goto cbc_next(i); } __code cbc_atposref_i(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_pos_i(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_atposref_n(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_pos_n(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_atposref_s(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_pos_s(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_getattrref_i(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_attr_i(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6))); i.cur_op += 12; goto cbc_next(i); } __code cbc_getattrref_n(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_attr_n(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6))); i.cur_op += 12; goto cbc_next(i); } __code cbc_getattrref_s(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_attr_s(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6))); i.cur_op += 12; goto cbc_next(i); } __code cbc_getattrsref_i(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_attr_i(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s); i.cur_op += 8; goto cbc_next(i); } __code cbc_getattrsref_n(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_attr_n(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s); i.cur_op += 8; goto cbc_next(i); } __code cbc_getattrsref_s(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_attr_s(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s); i.cur_op += 8; goto cbc_next(i); } __code cbc_nativecallsizeof(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_nativecall_sizeof(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_encodenorm(INTER i){ MVM_exception_throw_adhoc(i.tc, "NYI"); goto cbc_normalizecodes(i); } __code cbc_normalizecodes(INTER i){ MVM_unicode_normalize_codepoints(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 4,i).o, MVM_unicode_normalizer_form(i.tc, GET_REG(i.cur_op, 2,i).i64)); i.cur_op += 6; goto cbc_next(i); } __code cbc_strfromcodes(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_unicode_codepoints_to_nfg_string(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_strtocodes(INTER i){ MVM_unicode_string_to_codepoints(i.tc, GET_REG(i.cur_op, 0,i).s, MVM_unicode_normalizer_form(i.tc, GET_REG(i.cur_op, 2,i).i64), GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_getcodelocation(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_code_location(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_eqatim_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_equal_at_ignore_mark(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_ordbaseat(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_ord_basechar_at(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_neverrepossess(INTER i){ MVM_6model_never_repossess(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_scdisclaim(INTER i){ MVM_sc_disclaim(i.tc, (MVMSerializationContext *)GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_atpos2d_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_repr_at_pos_2d_i(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_atpos2d_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_repr_at_pos_2d_n(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_atpos2d_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_repr_at_pos_2d_s(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_atpos2d_o(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_repr_at_pos_2d_o(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_atpos3d_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_repr_at_pos_3d_i(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64); i.cur_op += 10; goto cbc_next(i); } __code cbc_atpos3d_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_repr_at_pos_3d_n(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64); i.cur_op += 10; goto cbc_next(i); } __code cbc_atpos3d_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_repr_at_pos_3d_s(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64); i.cur_op += 10; goto cbc_next(i); } __code cbc_atpos3d_o(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_repr_at_pos_3d_o(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64); i.cur_op += 10; goto cbc_next(i); } __code cbc_atposnd_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_repr_at_pos_multidim_i(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_atposnd_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_repr_at_pos_multidim_n(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_atposnd_s(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_repr_at_pos_multidim_s(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_atposnd_o(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_repr_at_pos_multidim_o(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindpos2d_i(INTER i){ MVM_repr_bind_pos_2d_i(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_bindpos2d_n(INTER i){ MVM_repr_bind_pos_2d_n(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).n64); i.cur_op += 8; goto cbc_next(i); } __code cbc_bindpos2d_s(INTER i){ MVM_repr_bind_pos_2d_s(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).s); i.cur_op += 8; goto cbc_next(i); } __code cbc_bindpos2d_o(INTER i){ MVM_repr_bind_pos_2d_o(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).o); i.cur_op += 8; goto cbc_next(i); } __code cbc_bindpos3d_i(INTER i){ MVM_repr_bind_pos_3d_i(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).i64); i.cur_op += 10; goto cbc_next(i); } __code cbc_bindpos3d_n(INTER i){ MVM_repr_bind_pos_3d_n(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).n64); i.cur_op += 10; goto cbc_next(i); } __code cbc_bindpos3d_s(INTER i){ MVM_repr_bind_pos_3d_s(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).s); i.cur_op += 10; goto cbc_next(i); } __code cbc_bindpos3d_o(INTER i){ MVM_repr_bind_pos_3d_o(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64, GET_REG(i.cur_op, 8,i).o); i.cur_op += 10; goto cbc_next(i); } __code cbc_bindposnd_i(INTER i){ MVM_repr_bind_pos_multidim_i(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindposnd_n(INTER i){ MVM_repr_bind_pos_multidim_n(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).n64); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindposnd_s(INTER i){ MVM_repr_bind_pos_multidim_s(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_bindposnd_o(INTER i){ MVM_repr_bind_pos_multidim_o(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_dimensions(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_repr_dimensions(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_setdimensions(INTER i){ MVM_repr_set_dimensions(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_numdimensions(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_repr_num_dimensions(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_ctxcode(INTER i){ MVMObject *this_ctx = GET_REG(i.cur_op, 2,i).o; if (IS_CONCRETE(this_ctx) && REPR(this_ctx)->ID == MVM_REPR_ID_MVMContext) { MVMObject *code_obj = ((MVMContext *)this_ctx)->body.context->code_ref; GET_REG(i.cur_op, 0,i).o = code_obj ? code_obj : i.tc->instance->VMNull; i.cur_op += 4; } else { MVM_exception_throw_adhoc(i.tc, "ctxcode needs an MVMContext"); } goto cbc_next(i); } __code cbc_isrwcont(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMint64 is_rw = 0; if (!MVM_is_null(i.tc, obj)) { const MVMContainerSpec *cs = STABLE(obj)->container_spec; is_rw = cs && cs->can_store(i.tc, obj); } GET_REG(i.cur_op, 0,i).i64 = is_rw; i.cur_op += 4; goto cbc_next(i); } __code cbc_fc(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_fc(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_encoderep(INTER i){ GET_REG(i.cur_op, 8,i).o = MVM_string_encode_to_buf(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 8,i).o, GET_REG(i.cur_op, 6,i).s); i.cur_op += 10; goto cbc_next(i); } __code cbc_istty_fh(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_io_is_tty(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_multidimref_i(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_multidim_i(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_multidimref_n(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_multidim_n(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_multidimref_s(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_multidim_s(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_fileno_fh(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_io_fileno(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_asyncudp(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_socket_udp_async(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).s, GET_REG(i.cur_op, 8,i).i64, GET_REG(i.cur_op, 10,i).i64, GET_REG(i.cur_op, 12,i).o); i.cur_op += 14; goto cbc_next(i); } __code cbc_asyncwritebytesto(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_write_bytes_to_async(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).o, GET_REG(i.cur_op, 8,i).o, GET_REG(i.cur_op, 10,i).o, GET_REG(i.cur_op, 12,i).s, GET_REG(i.cur_op, 14,i).i64); i.cur_op += 16; goto cbc_next(i); } __code cbc_objprimbits(INTER i){ MVMObject *type = GET_REG(i.cur_op, 2,i).o; if (type) { const MVMStorageSpec *ss = REPR(type)->get_storage_spec(i.tc, STABLE(type)); GET_REG(i.cur_op, 0,i).i64 = ss->boxed_primitive ? ss->bits : 0; } else { GET_REG(i.cur_op, 0,i).i64 = 0; } i.cur_op += 4; goto cbc_next(i); } __code cbc_objprimunsigned(INTER i){ MVMObject *type = GET_REG(i.cur_op, 2,i).o; if (type) { const MVMStorageSpec *ss = REPR(type)->get_storage_spec(i.tc, STABLE(type)); GET_REG(i.cur_op, 0,i).i64 = ss->boxed_primitive == 1 ? ss->is_unsigned : 0; } else { GET_REG(i.cur_op, 0,i).i64 = 0; } i.cur_op += 4; goto cbc_next(i); } __code cbc_getlexref_i32(INTER i){ goto cbc_getlexref_i16(i); } __code cbc_getlexref_i16(INTER i){ goto cbc_getlexref_i8(i); } __code cbc_getlexref_i8(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_lex_i(i.tc, GET_UI16(i.cur_op, 4), GET_UI16(i.cur_op, 2)); i.cur_op += 6; goto cbc_next(i); } __code cbc_getlexref_n32(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_lex_n(i.tc, GET_UI16(i.cur_op, 4), GET_UI16(i.cur_op, 2)); i.cur_op += 6; goto cbc_next(i); } __code cbc_box_u(INTER i){ MVM_box_uint(i.tc, GET_REG(i.cur_op, 2,i).u64, GET_REG(i.cur_op, 4,i).o, &GET_REG(i.cur_op, 0,i)); i.cur_op += 6; goto cbc_next(i); } __code cbc_unbox_u(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; if (!IS_CONCRETE(obj)) MVM_exception_throw_adhoc(i.tc, "Cannot unbox a type object"); GET_REG(i.cur_op, 0,i).u64 = REPR(obj)->box_funcs.get_uint(i.tc, STABLE(obj), obj, OBJECT_BODY(obj)); i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_iu(INTER i){ GET_REG(i.cur_op, 0,i).u64 = (MVMuint64)GET_REG(i.cur_op, 2,i).i64; i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_ui(INTER i){ GET_REG(i.cur_op, 0,i).i64 = (MVMint64)GET_REG(i.cur_op, 2,i).u64; i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_nu(INTER i){ GET_REG(i.cur_op, 0,i).u64 = (MVMuint64)GET_REG(i.cur_op, 2,i).n64; i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_un(INTER i){ GET_REG(i.cur_op, 0,i).n64 = (MVMnum64)GET_REG(i.cur_op, 2,i).u64; i.cur_op += 4; goto cbc_next(i); } __code cbc_decont_u(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMRegister *r = &GET_REG(i.cur_op, 0,i); i.cur_op += 4; MVM_6model_container_decont_u(i.tc, obj, r); goto cbc_next(i); } __code cbc_getlexref_u(INTER i){ goto cbc_getlexref_u32(i); } __code cbc_getlexref_u32(INTER i){ goto cbc_getlexref_u16(i); } __code cbc_getlexref_u16(INTER i){ goto cbc_getlexref_u8(i); } __code cbc_getlexref_u8(INTER i){ /* XXX Cheat should have a _u here. */ GET_REG(i.cur_op, 0,i).o = MVM_nativeref_lex_i(i.tc, GET_UI16(i.cur_op, 4), GET_UI16(i.cur_op, 2)); i.cur_op += 6; goto cbc_next(i); } __code cbc_param_rp_u(INTER i){ GET_REG(i.cur_op, 0,i).u64 = MVM_args_get_pos_uint(i.tc, &i.tc->cur_frame->params, GET_UI16(i.cur_op, 2), MVM_ARG_REQUIRED).arg.u64; i.cur_op += 4; goto cbc_next(i); } __code cbc_param_op_u(INTER i){ MVMArgInfo param = MVM_args_get_pos_uint(i.tc, &i.tc->cur_frame->params, GET_UI16(i.cur_op, 2), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).u64 = param.arg.u64; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 4); } else { i.cur_op += 8; } goto cbc_next(i); } __code cbc_param_rn_u(INTER i){ GET_REG(i.cur_op, 0,i).u64 = MVM_args_get_named_uint(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_REQUIRED).arg.u64; i.cur_op += 6; goto cbc_next(i); } __code cbc_param_on_u(INTER i){ MVMArgInfo param = MVM_args_get_named_uint(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).u64 = param.arg.u64; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 6); } else { i.cur_op += 10; } goto cbc_next(i); } __code cbc_param_rn2_u(INTER i){ MVMArgInfo param = MVM_args_get_named_uint(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (param.exists) GET_REG(i.cur_op, 0,i).u64 = param.arg.u64; else GET_REG(i.cur_op, 0,i).u64 = MVM_args_get_named_uint(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), MVM_ARG_REQUIRED).arg.u64; i.cur_op += 10; goto cbc_next(i); } __code cbc_param_on2_u(INTER i){ MVMArgInfo param = MVM_args_get_named_uint(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_ARG_OPTIONAL); if (!param.exists) param = MVM_args_get_named_uint(i.tc, &i.tc->cur_frame->params, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 6)), MVM_ARG_OPTIONAL); if (param.exists) { GET_REG(i.cur_op, 0,i).u64 = param.arg.u64; i.cur_op = i.bytecode_start + GET_UI32(i.cur_op, 10); } else { i.cur_op += 14; } goto cbc_next(i); } __code cbc_stat_time(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_file_time(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, 0); i.cur_op += 6; goto cbc_next(i); } __code cbc_lstat_time(INTER i){ GET_REG(i.cur_op, 0,i).n64 = MVM_file_time(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).i64, 1); i.cur_op += 6; goto cbc_next(i); } __code cbc_setdebugtypename(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; if (MVM_string_graphs(i.tc, GET_REG(i.cur_op, 2,i).s)) { char *debugname = MVM_string_utf8_encode_C_string(i.tc, GET_REG(i.cur_op, 2,i).s); if (STABLE(obj)->debug_name) { MVM_free(STABLE(obj)->debug_name); } STABLE(obj)->debug_name = debugname; } else { STABLE(obj)->debug_name = NULL; } i.cur_op += 4; goto cbc_next(i); } __code cbc_throwpayloadlex(INTER i){ MVMRegister *rr = &GET_REG(i.cur_op, 0,i); MVMuint32 cat = (MVMuint32)MVM_BC_get_I64(i.cur_op, 2); MVMObject *payload = GET_REG(i.cur_op, 10,i).o; i.cur_op += 12; MVM_exception_throwpayload(i.tc, MVM_EX_THROW_LEX, cat, payload, rr); goto cbc_next(i); } __code cbc_throwpayloadlexcaller(INTER i){ MVMRegister *rr = &GET_REG(i.cur_op, 0,i); MVMuint32 cat = (MVMuint32)MVM_BC_get_I64(i.cur_op, 2); MVMObject *payload = GET_REG(i.cur_op, 10,i).o; i.cur_op += 12; MVM_exception_throwpayload(i.tc, MVM_EX_THROW_LEX_CALLER, cat, payload, rr); goto cbc_next(i); } __code cbc_lastexpayload(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->last_payload; i.cur_op += 2; goto cbc_next(i); } __code cbc_cancelnotify(INTER i){ MVM_io_eventloop_cancel_work(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_decoderconfigure(INTER i){ MVMObject *decoder = GET_REG(i.cur_op, 0,i).o; MVM_decoder_ensure_decoder(i.tc, decoder, "decoderconfigure"); MVM_decoder_configure(i.tc, (MVMDecoder *)decoder, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_decodersetlineseps(INTER i){ MVMObject *decoder = GET_REG(i.cur_op, 0,i).o; MVM_decoder_ensure_decoder(i.tc, decoder, "decodersetlineseps"); MVM_decoder_set_separators(i.tc, (MVMDecoder *)decoder, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_decoderaddbytes(INTER i){ MVMObject *decoder = GET_REG(i.cur_op, 0,i).o; MVM_decoder_ensure_decoder(i.tc, decoder, "decoderaddbytes"); MVM_decoder_add_bytes(i.tc, (MVMDecoder *)decoder, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_decodertakechars(INTER i){ MVMObject *decoder = GET_REG(i.cur_op, 2,i).o; MVM_decoder_ensure_decoder(i.tc, decoder, "decodertakechars"); GET_REG(i.cur_op, 0,i).s = MVM_decoder_take_chars(i.tc, (MVMDecoder *)decoder, GET_REG(i.cur_op, 4,i).i64, 0); i.cur_op += 6; goto cbc_next(i); } __code cbc_indexim_s(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_string_index_ignore_mark(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_decodertakeallchars(INTER i){ MVMObject *decoder = GET_REG(i.cur_op, 2,i).o; MVM_decoder_ensure_decoder(i.tc, decoder, "decodertakeallchars"); GET_REG(i.cur_op, 0,i).s = MVM_decoder_take_all_chars(i.tc, (MVMDecoder *)decoder); i.cur_op += 4; goto cbc_next(i); } __code cbc_decodertakeavailablechars(INTER i){ MVMObject *decoder = GET_REG(i.cur_op, 2,i).o; MVM_decoder_ensure_decoder(i.tc, decoder, "decodertakeavailablechars"); GET_REG(i.cur_op, 0,i).s = MVM_decoder_take_available_chars(i.tc, (MVMDecoder *)decoder); i.cur_op += 4; goto cbc_next(i); } __code cbc_decodertakeline(INTER i){ MVMObject *decoder = GET_REG(i.cur_op, 2,i).o; MVM_decoder_ensure_decoder(i.tc, decoder, "decodertakeline"); GET_REG(i.cur_op, 0,i).s = MVM_decoder_take_line(i.tc, (MVMDecoder *)decoder, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_decoderbytesavailable(INTER i){ MVMObject *decoder = GET_REG(i.cur_op, 2,i).o; MVM_decoder_ensure_decoder(i.tc, decoder, "decoderbytesavailable"); GET_REG(i.cur_op, 0,i).i64 = MVM_decoder_bytes_available(i.tc, (MVMDecoder *)decoder); i.cur_op += 4; goto cbc_next(i); } __code cbc_decodertakebytes(INTER i){ MVMObject *decoder = GET_REG(i.cur_op, 2,i).o; MVM_decoder_ensure_decoder(i.tc, decoder, "decodertakebytes"); GET_REG(i.cur_op, 0,i).o = MVM_decoder_take_bytes(i.tc, (MVMDecoder *)decoder, GET_REG(i.cur_op, 4,i).o, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_decoderempty(INTER i){ MVMObject *decoder = GET_REG(i.cur_op, 2,i).o; MVM_decoder_ensure_decoder(i.tc, decoder, "decoderempty"); GET_REG(i.cur_op, 0,i).i64 = MVM_decoder_empty(i.tc, (MVMDecoder *)decoder); i.cur_op += 4; goto cbc_next(i); } __code cbc_indexingoptimized(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_indexing_optimized(i.tc, GET_REG(i.cur_op, 2,i).s); i.cur_op += 4; goto cbc_next(i); } __code cbc_captureinnerlex(INTER i){ MVM_frame_capture_inner(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_setdispatcherfor(INTER i){ MVMObject *disp_for = GET_REG(i.cur_op, 2,i).o; i.tc->cur_dispatcher = GET_REG(i.cur_op, 0,i).o; i.tc->cur_dispatcher_for = REPR(disp_for)->ID == MVM_REPR_ID_MVMCode ? disp_for : MVM_frame_find_invokee(i.tc, disp_for, NULL); i.cur_op += 4; goto cbc_next(i); } __code cbc_cpucores(INTER i){ GET_REG(i.cur_op, 0,i).i32 = MVM_platform_cpu_count(); i.cur_op += 2; goto cbc_next(i); } __code cbc_decodertakecharseof(INTER i){ MVMObject *decoder = GET_REG(i.cur_op, 2,i).o; MVM_decoder_ensure_decoder(i.tc, decoder, "decodertakecharseof"); GET_REG(i.cur_op, 0,i).s = MVM_decoder_take_chars(i.tc, (MVMDecoder *)decoder, GET_REG(i.cur_op, 4,i).i64, 1); i.cur_op += 6; goto cbc_next(i); } __code cbc_cas_o(INTER i){ MVMRegister *result = &GET_REG(i.cur_op, 0,i); MVMObject *target = GET_REG(i.cur_op, 2,i).o; MVMObject *expected = GET_REG(i.cur_op, 4,i).o; MVMObject *value = GET_REG(i.cur_op, 6,i).o; i.cur_op += 8; MVM_6model_container_cas(i.tc, target, expected, value, result); goto cbc_next(i); } __code cbc_cas_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_6model_container_cas_i(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_atomicinc_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_6model_container_atomic_inc(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_atomicdec_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_6model_container_atomic_dec(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_atomicadd_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_6model_container_atomic_add(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).i64); i.cur_op += 6; goto cbc_next(i); } __code cbc_atomicload_o(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_6model_container_atomic_load(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_atomicload_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_6model_container_atomic_load_i(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_atomicstore_o(INTER i){ MVMObject *target = GET_REG(i.cur_op, 0,i).o; MVMObject *value = GET_REG(i.cur_op, 2,i).o; i.cur_op += 4; MVM_6model_container_atomic_store(i.tc, target, value); goto cbc_next(i); } __code cbc_atomicstore_i(INTER i){ MVM_6model_container_atomic_store_i(i.tc, GET_REG(i.cur_op, 0,i).o, GET_REG(i.cur_op, 2,i).i64); i.cur_op += 4; goto cbc_next(i); } __code cbc_barrierfull(INTER i){ MVM_barrier(); goto cbc_next(i); } __code cbc_nativeinvoke_v(INTER i){ i.tc->cur_frame->return_value = NULL; i.tc->cur_frame->return_type = MVM_RETURN_VOID; MVM_nativecall_invoke_jit(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_nativeinvoke_i(INTER i){ i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_INT; MVM_nativecall_invoke_jit(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_nativeinvoke_n(INTER i){ i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_NUM; MVM_nativecall_invoke_jit(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_nativeinvoke_s(INTER i){ i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_STR; MVM_nativecall_invoke_jit(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_nativeinvoke_o(INTER i){ i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_OBJ; MVM_nativecall_invoke_jit(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_getarg_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = i.tc->cur_frame->args[GET_REG(i.cur_op, 2,i).u16].i64; i.cur_op += 4; goto cbc_next(i); } __code cbc_getarg_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = i.tc->cur_frame->args[GET_REG(i.cur_op, 2,i).u16].n64; i.cur_op += 4; goto cbc_next(i); } __code cbc_getarg_s(INTER i){ GET_REG(i.cur_op, 0,i).s = i.tc->cur_frame->args[GET_REG(i.cur_op, 2,i).u16].s; i.cur_op += 4; goto cbc_next(i); } __code cbc_getarg_o(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->cur_frame->args[GET_REG(i.cur_op, 2,i).u16].o; i.cur_op += 4; goto cbc_next(i); } __code cbc_coerce_II(INTER i){ MVMObject * const type = GET_REG(i.cur_op, 4,i).o; GET_REG(i.cur_op, 0,i).o = MVM_bigint_from_bigint(i.tc, type, GET_REG(i.cur_op, 2,i).o); i.cur_op += 6; goto cbc_next(i); } __code cbc_encoderepconf(INTER i){ GET_REG(i.cur_op, 8,i).o = MVM_string_encode_to_buf_config(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 8,i).o, GET_REG(i.cur_op, 6,i).s, GET_REG(i.cur_op, 10,i).i64); i.cur_op += 12; goto cbc_next(i); } __code cbc_encodeconf(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_string_encode_to_buf_config(i.tc, GET_REG(i.cur_op, 2,i).s, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).o, NULL, GET_REG(i.cur_op, 8,i).i64); i.cur_op += 10; goto cbc_next(i); } __code cbc_decodeconf(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_decode_from_buf_config(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).s, NULL, GET_REG(i.cur_op, 6,i).i64); i.cur_op += 8; goto cbc_next(i); } __code cbc_decoderepconf(INTER i){ GET_REG(i.cur_op, 0,i).s = MVM_string_decode_from_buf_config(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).s, GET_REG(i.cur_op, 6,i).s, GET_REG(i.cur_op, 8,i).i64); i.cur_op += 10; goto cbc_next(i); } __code cbc_getppid(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_proc_getppid(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_getsignals(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_io_get_signals(i.tc); i.cur_op += 2; goto cbc_next(i); } __code cbc_sp_guard(INTER i){ MVMObject *check = GET_REG(i.cur_op, 0,i).o; MVMSTable *want = (MVMSTable *)i.tc->cur_frame ->effective_spesh_slots[GET_UI16(i.cur_op, 2)]; i.cur_op += 8; if (!check || STABLE(check) != want) MVM_spesh_deopt_one(i.tc, GET_UI32(i.cur_op, -4)); goto cbc_next(i); } __code cbc_sp_guardconc(INTER i){ MVMObject *check = GET_REG(i.cur_op, 0,i).o; MVMSTable *want = (MVMSTable *)i.tc->cur_frame ->effective_spesh_slots[GET_UI16(i.cur_op, 2)]; i.cur_op += 8; if (!check || !IS_CONCRETE(check) || STABLE(check) != want) MVM_spesh_deopt_one(i.tc, GET_UI32(i.cur_op, -4)); goto cbc_next(i); } __code cbc_sp_guardtype(INTER i){ MVMObject *check = GET_REG(i.cur_op, 0,i).o; MVMSTable *want = (MVMSTable *)i.tc->cur_frame ->effective_spesh_slots[GET_UI16(i.cur_op, 2)]; i.cur_op += 8; if (!check || IS_CONCRETE(check) || STABLE(check) != want) MVM_spesh_deopt_one(i.tc, GET_UI32(i.cur_op, -4)); goto cbc_next(i); } __code cbc_sp_guardsf(INTER i){ MVMObject *check = GET_REG(i.cur_op, 0,i).o; MVMStaticFrame *want = (MVMStaticFrame *)i.tc->cur_frame ->effective_spesh_slots[GET_UI16(i.cur_op, 2)]; i.cur_op += 8; if (REPR(check)->ID != MVM_REPR_ID_MVMCode || ((MVMCode *)check)->body.sf != want) MVM_spesh_deopt_one(i.tc, GET_UI32(i.cur_op, -4)); goto cbc_next(i); } __code cbc_sp_guardsfouter(INTER i){ MVMObject *check = GET_REG(i.cur_op, 0,i).o; MVMStaticFrame *want = (MVMStaticFrame *)i.tc->cur_frame ->effective_spesh_slots[GET_UI16(i.cur_op, 2)]; i.cur_op += 8; if (REPR(check)->ID != MVM_REPR_ID_MVMCode || ((MVMCode *)check)->body.sf != want || ((MVMCode *)check)->body.outer != i.tc->cur_frame) MVM_spesh_deopt_one(i.tc, GET_UI32(i.cur_op, -4)); goto cbc_next(i); } __code cbc_sp_rebless(INTER i){ if (!REPR(GET_REG(i.cur_op, 2,i).o)->change_type) { MVM_exception_throw_adhoc(i.tc, "This REPR cannot change type"); } REPR(GET_REG(i.cur_op, 2,i).o)->change_type(i.tc, GET_REG(i.cur_op, 2,i).o, GET_REG(i.cur_op, 4,i).o); GET_REG(i.cur_op, 0,i).o = GET_REG(i.cur_op, 2,i).o; MVM_SC_WB_OBJ(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 10; MVM_spesh_deopt_all(i.tc); MVM_spesh_deopt_one(i.tc, GET_UI32(i.cur_op, -4)); goto cbc_next(i); } __code cbc_sp_resolvecode(INTER i){ GET_REG(i.cur_op, 0,i).o = MVM_frame_resolve_invokee_spesh(i.tc, GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_sp_decont(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMRegister *r = &GET_REG(i.cur_op, 0,i); i.cur_op += 4; if (obj && IS_CONCRETE(obj) && STABLE(obj)->container_spec) STABLE(obj)->container_spec->fetch(i.tc, obj, r); else r->o = obj; goto cbc_next(i); } __code cbc_sp_getlex_o(INTER i){ MVMFrame *f = i.tc->cur_frame; MVMuint16 idx = GET_UI16(i.cur_op, 2); MVMuint16 outers = GET_UI16(i.cur_op, 4); MVMRegister found; while (outers) { if (!f->outer) MVM_exception_throw_adhoc(i.tc, "getlex: outer index out of range"); f = f->outer; outers--; } found = GET_LEX(i.cur_op, 2, f,i); GET_REG(i.cur_op, 0,i).o = found.o == NULL ? MVM_frame_vivify_lexical(i.tc, f, idx) : found.o; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_getlex_ins(INTER i){ MVMFrame *f = i.tc->cur_frame; MVMuint16 idx = GET_UI16(i.cur_op, 2); MVMuint16 outers = GET_UI16(i.cur_op, 4); while (outers) { if (!f->outer) MVM_exception_throw_adhoc(i.tc, "getlex: outer index out of range"); f = f->outer; outers--; } GET_REG(i.cur_op, 0,i) = GET_LEX(i.cur_op, 2, f,i); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_getlex_no(INTER i){ MVMRegister *found = MVM_frame_find_lexical_by_name(i.tc, MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 2)), MVM_reg_obj); GET_REG(i.cur_op, 0,i).o = found ? found->o : i.tc->instance->VMNull; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_getarg_o(INTER i){ GET_REG(i.cur_op, 0,i).o = i.tc->cur_frame->params.args[GET_UI16(i.cur_op, 2)].o; i.cur_op += 4; goto cbc_next(i); } __code cbc_sp_getarg_i(INTER i){ GET_REG(i.cur_op, 0,i).i64 = i.tc->cur_frame->params.args[GET_UI16(i.cur_op, 2)].i64; i.cur_op += 4; goto cbc_next(i); } __code cbc_sp_getarg_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = i.tc->cur_frame->params.args[GET_UI16(i.cur_op, 2)].n64; i.cur_op += 4; goto cbc_next(i); } __code cbc_sp_getarg_s(INTER i){ GET_REG(i.cur_op, 0,i).s = i.tc->cur_frame->params.args[GET_UI16(i.cur_op, 2)].s; i.cur_op += 4; goto cbc_next(i); } __code cbc_sp_fastinvoke_v(INTER i){ MVMCode *code = (MVMCode *)GET_REG(i.cur_op, 0,i).o; MVMRegister *args = i.tc->cur_frame->args; MVMint32 spesh_cand = GET_UI16(i.cur_op, 2); i.tc->cur_frame->return_value = NULL; i.tc->cur_frame->return_type = MVM_RETURN_VOID; i.cur_op += 4; i.tc->cur_frame->return_address = i.cur_op; MVM_frame_invoke(i.tc, code->body.sf, i.cur_callsite, args, code->body.outer, (MVMObject *)code, spesh_cand); goto cbc_next(i); } __code cbc_sp_fastinvoke_i(INTER i){ MVMCode *code = (MVMCode *)GET_REG(i.cur_op, 2,i).o; MVMRegister *args = i.tc->cur_frame->args; MVMint32 spesh_cand = GET_UI16(i.cur_op, 4); i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_INT; i.cur_op += 6; i.tc->cur_frame->return_address = i.cur_op; MVM_frame_invoke(i.tc, code->body.sf, i.cur_callsite, args, code->body.outer, (MVMObject *)code, spesh_cand); goto cbc_next(i); } __code cbc_sp_fastinvoke_n(INTER i){ MVMCode *code = (MVMCode *)GET_REG(i.cur_op, 2,i).o; MVMRegister *args = i.tc->cur_frame->args; MVMint32 spesh_cand = GET_UI16(i.cur_op, 4); i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_NUM; i.cur_op += 6; i.tc->cur_frame->return_address = i.cur_op; MVM_frame_invoke(i.tc, code->body.sf, i.cur_callsite, args, code->body.outer, (MVMObject *)code, spesh_cand); goto cbc_next(i); } __code cbc_sp_fastinvoke_s(INTER i){ MVMCode *code = (MVMCode *)GET_REG(i.cur_op, 2,i).o; MVMRegister *args = i.tc->cur_frame->args; MVMint32 spesh_cand = GET_UI16(i.cur_op, 4); i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_STR; i.cur_op += 6; i.tc->cur_frame->return_address = i.cur_op; MVM_frame_invoke(i.tc, code->body.sf, i.cur_callsite, args, code->body.outer, (MVMObject *)code, spesh_cand); goto cbc_next(i); } __code cbc_sp_fastinvoke_o(INTER i){ MVMCode *code = (MVMCode *)GET_REG(i.cur_op, 2,i).o; MVMRegister *args = i.tc->cur_frame->args; MVMint32 spesh_cand = GET_UI16(i.cur_op, 4); i.tc->cur_frame->return_value = &GET_REG(i.cur_op, 0,i); i.tc->cur_frame->return_type = MVM_RETURN_OBJ; i.cur_op += 6; i.tc->cur_frame->return_address = i.cur_op; MVM_frame_invoke(i.tc, code->body.sf, i.cur_callsite, args, code->body.outer, (MVMObject *)code, spesh_cand); goto cbc_next(i); } __code cbc_sp_paramnamesused(INTER i){ MVM_args_throw_named_unused_error(i.tc, (MVMString *)i.tc->cur_frame ->effective_spesh_slots[GET_UI16(i.cur_op, 0)]); i.cur_op += 2; goto cbc_next(i); } __code cbc_sp_getspeshslot(INTER i){ GET_REG(i.cur_op, 0,i).o = (MVMObject *)i.tc->cur_frame ->effective_spesh_slots[GET_UI16(i.cur_op, 2)]; i.cur_op += 4; goto cbc_next(i); } __code cbc_sp_findmeth(INTER i){ /* Obtain object and cache index; see if we get a mai->tch. */ MVMObject *obj = GET_REG(i.cur_op, 2,i).o; MVMuint16 idx = GET_UI16(i.cur_op, 8); if ((MVMSTable *)i.tc->cur_frame->effective_spesh_slots[idx] == STABLE(obj)) { GET_REG(i.cur_op, 0,i).o = (MVMObject *)i.tc->cur_frame->effective_spesh_slots[idx + 1]; i.cur_op += 10; } else { /* May invoke, so pre-increment op counter */ MVMString *name = MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 4)); MVMRegister *res = &GET_REG(i.cur_op, 0,i); i.cur_op += 10; MVM_6model_find_method_spesh(i.tc, obj, name, idx, res); } goto cbc_next(i); } __code cbc_sp_fastcreate(INTER i){ /* Assume we're in normal code, so doing a nursery allocation. * Also, that there is no initialize. */ MVMuint16 size = GET_UI16(i.cur_op, 2); MVMObject *obj = MVM_gc_allocate_zeroed(i.tc, size); obj->st = (MVMSTable *)i.tc->cur_frame->effective_spesh_slots[GET_UI16(i.cur_op, 4)]; obj->header.size = size; obj->header.owner = i.tc->thread_id; GET_REG(i.cur_op, 0,i).o = obj; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_get_o(INTER i){ MVMObject *val = ((MVMObject *)((char *)GET_REG(i.cur_op, 2,i).o + GET_UI16(i.cur_op, 4))); GET_REG(i.cur_op, 0,i).o = val ? val : i.tc->instance->VMNull; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_get_i64(INTER i){ GET_REG(i.cur_op, 0,i).i64 = *((MVMint64 *)((char *)GET_REG(i.cur_op, 2,i).o + GET_UI16(i.cur_op, 4))); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_get_i32(INTER i){ GET_REG(i.cur_op, 0,i).i64 = *((MVMint32 *)((char *)GET_REG(i.cur_op, 2,i).o + GET_UI16(i.cur_op, 4))); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_get_i16(INTER i){ GET_REG(i.cur_op, 0,i).i64 = *((MVMint16 *)((char *)GET_REG(i.cur_op, 2,i).o + GET_UI16(i.cur_op, 4))); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_get_i8(INTER i){ GET_REG(i.cur_op, 0,i).i64 = *((MVMint8 *)((char *)GET_REG(i.cur_op, 2,i).o + GET_UI16(i.cur_op, 4))); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_get_n(INTER i){ GET_REG(i.cur_op, 0,i).n64 = *((MVMnum64 *)((char *)GET_REG(i.cur_op, 2,i).o + GET_UI16(i.cur_op, 4))); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_get_s(INTER i){ GET_REG(i.cur_op, 0,i).s = ((MVMString *)((char *)GET_REG(i.cur_op, 2,i).o + GET_UI16(i.cur_op, 4))); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_bind_o(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; MVMObject *value = GET_REG(i.cur_op, 4,i).o; MVM_ASSIGN_REF(i.tc, &(o->header), *((MVMObject **)((char *)o + GET_UI16(i.cur_op, 2))), value); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_bind_i64(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; *((MVMint64 *)((char *)o + GET_UI16(i.cur_op, 2))) = GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_bind_i32(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; *((MVMint32 *)((char *)o + GET_UI16(i.cur_op, 2))) = GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_bind_i16(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; *((MVMint16 *)((char *)o + GET_UI16(i.cur_op, 2))) = GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_bind_i8(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; *((MVMint8 *)((char *)o + GET_UI16(i.cur_op, 2))) = GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_bind_n(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; *((MVMnum64 *)((char *)o + GET_UI16(i.cur_op, 2))) = GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_bind_s(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; MVMString *value = GET_REG(i.cur_op, 4,i).s; MVM_ASSIGN_REF(i.tc, &(o->header), *((MVMObject **)((char *)o + GET_UI16(i.cur_op, 2))), value); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_p6oget_o(INTER i){ MVMObject *o = GET_REG(i.cur_op, 2,i).o; MVMObject *val = MVM_p6opaque_read_object(i.tc, o, GET_UI16(i.cur_op, 4)); GET_REG(i.cur_op, 0,i).o = val ? val : i.tc->instance->VMNull; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_p6ogetvt_o(INTER i){ MVMObject *o = GET_REG(i.cur_op, 2,i).o; char *data = MVM_p6opaque_real_data(i.tc, OBJECT_BODY(o)); MVMObject *val = *((MVMObject **)(data + GET_UI16(i.cur_op, 4))); if (!val) { val = (MVMObject *)i.tc->cur_frame->effective_spesh_slots[GET_UI16(i.cur_op, 6)]; MVM_ASSIGN_REF(i.tc, &(o->header), *((MVMObject **)(data + GET_UI16(i.cur_op, 4))), val); } GET_REG(i.cur_op, 0,i).o = val; i.cur_op += 8; goto cbc_next(i); } __code cbc_sp_p6ogetvc_o(INTER i){ MVMObject *o = GET_REG(i.cur_op, 2,i).o; char *data = MVM_p6opaque_real_data(i.tc, OBJECT_BODY(o)); MVMObject *val = *((MVMObject **)(data + GET_UI16(i.cur_op, 4))); if (!val) { /* Clone might allocate, so re-fei->tch things after it. */ val = MVM_repr_clone(i.tc, (MVMObject *)i.tc->cur_frame->effective_spesh_slots[GET_UI16(i.cur_op, 6)]); o = GET_REG(i.cur_op, 2,i).o; data = MVM_p6opaque_real_data(i.tc, OBJECT_BODY(o)); MVM_ASSIGN_REF(i.tc, &(o->header), *((MVMObject **)(data + GET_UI16(i.cur_op, 4))), val); } GET_REG(i.cur_op, 0,i).o = val; i.cur_op += 8; goto cbc_next(i); } __code cbc_sp_p6oget_i(INTER i){ MVMObject *o = GET_REG(i.cur_op, 2,i).o; char *data = MVM_p6opaque_real_data(i.tc, OBJECT_BODY(o)); GET_REG(i.cur_op, 0,i).i64 = *((MVMint64 *)(data + GET_UI16(i.cur_op, 4))); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_p6oget_n(INTER i){ MVMObject *o = GET_REG(i.cur_op, 2,i).o; char *data = MVM_p6opaque_real_data(i.tc, OBJECT_BODY(o)); GET_REG(i.cur_op, 0,i).n64 = *((MVMnum64 *)(data + GET_UI16(i.cur_op, 4))); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_p6oget_s(INTER i){ MVMObject *o = GET_REG(i.cur_op, 2,i).o; char *data = MVM_p6opaque_real_data(i.tc, OBJECT_BODY(o)); GET_REG(i.cur_op, 0,i).s = *((MVMString **)(data + GET_UI16(i.cur_op, 4))); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_p6obind_o(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; MVMObject *value = GET_REG(i.cur_op, 4,i).o; char *data = MVM_p6opaque_real_data(i.tc, OBJECT_BODY(o)); MVM_ASSIGN_REF(i.tc, &(o->header), *((MVMObject **)(data + GET_UI16(i.cur_op, 2))), value); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_p6obind_i(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; char *data = MVM_p6opaque_real_data(i.tc, OBJECT_BODY(o)); *((MVMint64 *)(data + GET_UI16(i.cur_op, 2))) = GET_REG(i.cur_op, 4,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_p6obind_n(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; char *data = MVM_p6opaque_real_data(i.tc, OBJECT_BODY(o)); *((MVMnum64 *)(data + GET_UI16(i.cur_op, 2))) = GET_REG(i.cur_op, 4,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_p6obind_s(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; char *data = MVM_p6opaque_real_data(i.tc, OBJECT_BODY(o)); MVM_ASSIGN_REF(i.tc, &(o->header), *((MVMString **)(data + GET_UI16(i.cur_op, 2))), GET_REG(i.cur_op, 4,i).s); i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_deref_get_i64(INTER i){ MVMObject *o = GET_REG(i.cur_op, 2,i).o; MVMint64 **target = ((MVMint64 **)((char *)o + GET_UI16(i.cur_op, 4))); GET_REG(i.cur_op, 0,i).i64 = **target; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_deref_get_n(INTER i){ MVMObject *o = GET_REG(i.cur_op, 2,i).o; MVMnum64 **target = ((MVMnum64 **)((char *)o + GET_UI16(i.cur_op, 4))); GET_REG(i.cur_op, 0,i).n64 = **target; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_deref_bind_i64(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; MVMint64 **target = ((MVMint64 **)((char *)o + GET_UI16(i.cur_op, 4))); **target = GET_REG(i.cur_op, 2,i).i64; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_deref_bind_n(INTER i){ MVMObject *o = GET_REG(i.cur_op, 0,i).o; MVMnum64 **target = ((MVMnum64 **)((char *)o + GET_UI16(i.cur_op, 4))); **target = GET_REG(i.cur_op, 2,i).n64; i.cur_op += 6; goto cbc_next(i); } __code cbc_sp_getlexvia_o(INTER i){ MVMFrame *f = ((MVMCode *)GET_REG(i.cur_op, 6,i).o)->body.outer; MVMuint16 idx = GET_UI16(i.cur_op, 2); MVMuint16 outers = GET_UI16(i.cur_op, 4) - 1; /* - 1 as already in outer */ MVMRegister found; while (outers) { if (!f->outer) MVM_exception_throw_adhoc(i.tc, "getlex: outer index out of range"); f = f->outer; outers--; } found = GET_LEX(i.cur_op, 2, f,i); GET_REG(i.cur_op, 0,i).o = found.o == NULL ? MVM_frame_vivify_lexical(i.tc, f, idx) : found.o; i.cur_op += 8; goto cbc_next(i); } __code cbc_sp_getlexvia_ins(INTER i){ MVMFrame *f = ((MVMCode *)GET_REG(i.cur_op, 6,i).o)->body.outer; MVMuint16 idx = GET_UI16(i.cur_op, 2); MVMuint16 outers = GET_UI16(i.cur_op, 4) - 1; /* - 1 as already in outer */ while (outers) { if (!f->outer) MVM_exception_throw_adhoc(i.tc, "getlex: outer index out of range"); f = f->outer; outers--; } GET_REG(i.cur_op, 0,i) = GET_LEX(i.cur_op, 2, f,i); i.cur_op += 8; goto cbc_next(i); } __code cbc_sp_getstringfrom(INTER i){ MVMCompUnit *dep = (MVMCompUnit *)i.tc->cur_frame->effective_spesh_slots[GET_UI16(i.cur_op, 2)]; MVMuint32 idx = GET_UI32(i.cur_op, 4); GET_REG(i.cur_op, 0,i).s = MVM_cu_string(i.tc, dep, idx); i.cur_op += 8; goto cbc_next(i); } __code cbc_sp_getwvalfrom(INTER i){ MVMSerializationContext *dep = (MVMSerializationContext *)i.tc->cur_frame->effective_spesh_slots[GET_UI16(i.cur_op, 2)]; MVMuint64 idx = MVM_BC_get_I64(i.cur_op, 4); GET_REG(i.cur_op, 0,i).o = MVM_sc_get_object(i.tc, dep, idx); i.cur_op += 12; goto cbc_next(i); } __code cbc_sp_jit_enter(INTER i){ if (i.tc->cur_frame->spesh_cand->jitcode == NULL) { MVM_exception_throw_adhoc(i.tc, "Try to enter NULL jitcode"); } /* trampoline back to this opcode */ i.cur_op -= 2; MVM_jit_enter_code(i.tc,i.cu, i.tc->cur_frame->spesh_cand->jitcode); if (!i.tc->cur_frame) { /* somehow unwound our top frame */ goto cbc_return_label(i); } goto cbc_next(i); } __code cbc_sp_boolify_iter(INTER i){ GET_REG(i.cur_op, 0,i).i64 = MVM_iter_istrue(i.tc, (MVMIter*)GET_REG(i.cur_op, 2,i).o); i.cur_op += 4; goto cbc_next(i); } __code cbc_sp_boolify_iter_arr(INTER i){ MVMIter *iter = (MVMIter *)GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = iter->body.array_state.index + 1 < iter->body.array_state.limit ? 1 : 0; i.cur_op += 4; goto cbc_next(i); } __code cbc_sp_boolify_iter_hash(INTER i){ MVMIter *iter = (MVMIter *)GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).i64 = iter->body.hash_state.next != NULL ? 1 : 0; i.cur_op += 4; goto cbc_next(i); } __code cbc_sp_cas_o(INTER i){ MVMRegister *result = &GET_REG(i.cur_op, 0,i); MVMObject *target = GET_REG(i.cur_op, 2,i).o; MVMObject *expected = GET_REG(i.cur_op, 4,i).o; MVMObject *value = GET_REG(i.cur_op, 6,i).o; i.cur_op += 8; target->st->container_spec->cas(i.tc, target, expected, value, result); goto cbc_next(i); } __code cbc_sp_atomicload_o(INTER i){ MVMObject *target = GET_REG(i.cur_op, 2,i).o; GET_REG(i.cur_op, 0,i).o = target->st->container_spec->atomic_load(i.tc, target); i.cur_op += 4; goto cbc_next(i); } __code cbc_sp_atomicstore_o(INTER i){ MVMObject *target = GET_REG(i.cur_op, 0,i).o; MVMObject *value = GET_REG(i.cur_op, 2,i).o; i.cur_op += 4; target->st->container_spec->atomic_store(i.tc, target, value); goto cbc_next(i); } __code cbc_prof_enter(INTER i){ MVM_profile_log_enter(i.tc, i.tc->cur_frame->static_info, MVM_PROFILE_ENTER_NORMAL); goto cbc_next(i); } __code cbc_prof_enterspesh(INTER i){ MVM_profile_log_enter(i.tc, i.tc->cur_frame->static_info, MVM_PROFILE_ENTER_SPESH); goto cbc_next(i); } __code cbc_prof_enterinline(INTER i){ MVM_profile_log_enter(i.tc, (MVMStaticFrame *)i.tc->cur_frame->effective_spesh_slots[GET_UI16(i.cur_op, 0)], MVM_PROFILE_ENTER_SPESH_INLINE); i.cur_op += 2; goto cbc_next(i); } __code cbc_prof_enternative(INTER i){ MVM_profile_log_enter_native(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_prof_exit(INTER i){ MVM_profile_log_exit(i.tc); goto cbc_next(i); } __code cbc_prof_allocated(INTER i){ MVM_profile_log_allocated(i.tc, GET_REG(i.cur_op, 0,i).o); i.cur_op += 2; goto cbc_next(i); } __code cbc_ctw_check(INTER i){ MVMObject *obj = GET_REG(i.cur_op, 0,i).o; MVMint16 blame = GET_I16(i.cur_op, 2); i.cur_op += 4; MVM_cross_thread_write_check(i.tc, obj, blame); goto cbc_next(i); } __code cbc_DEPRECATED_4(INTER i){ goto cbc_DEPRECATED_5(i); } __code cbc_DEPRECATED_5(INTER i){ goto cbc_DEPRECATED_6(i); } __code cbc_DEPRECATED_6(INTER i){ goto cbc_DEPRECATED_7(i); } __code cbc_DEPRECATED_7(INTER i){ goto cbc_DEPRECATED_8(i); } __code cbc_DEPRECATED_8(INTER i){ goto cbc_DEPRECATED_9(i); } __code cbc_DEPRECATED_9(INTER i){ goto cbc_DEPRECATED_10(i); } __code cbc_DEPRECATED_10(INTER i){ goto cbc_DEPRECATED_11(i); } __code cbc_DEPRECATED_11(INTER i){ goto cbc_DEPRECATED_12(i); } __code cbc_DEPRECATED_12(INTER i){ MVM_exception_throw_adhoc(i.tc, "The getregref_* ops were removed in MoarVM 2017.01."); goto cbc_next(i); } __code cbc_DEPRECATED_13(INTER i){ MVM_exception_throw_adhoc(i.tc, "The continuationclone op was removed in MoarVM 2017.01."); goto cbc_next(i); } __code cbc_DEPRECATED_14(INTER i){ MVM_exception_throw_adhoc(i.tc, "The asyncwritestr op was removed in MoarVM 2017.05."); goto cbc_next(i); } __code cbc_DEPRECATED_15(INTER i){ MVM_exception_throw_adhoc(i.tc, "The asyncwritestrto op was removed in MoarVM 2017.05."); goto cbc_next(i); } __code cbc_DEPRECATED_16(INTER i){ MVM_exception_throw_adhoc(i.tc, "The asyncreadchars op was removed in MoarVM 2017.05."); goto cbc_next(i); } __code cbc_DEPRECATED_17(INTER i){ MVM_exception_throw_adhoc(i.tc, "The setencoding op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_18(INTER i){ MVM_exception_throw_adhoc(i.tc, "The write_fhs op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_19(INTER i){ MVM_exception_throw_adhoc(i.tc, "The say_fhs op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_21(INTER i){ MVM_exception_throw_adhoc(i.tc, "The readlinechomp_fh op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_22(INTER i){ MVM_exception_throw_adhoc(i.tc, "The readall_fh op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_23(INTER i){ MVM_exception_throw_adhoc(i.tc, "The read_fhs op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_24(INTER i){ MVM_exception_throw_adhoc(i.tc, "The setinputlinesep op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_25(INTER i){ MVM_exception_throw_adhoc(i.tc, "The setinputlineseps op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_27(INTER i){ MVM_exception_throw_adhoc(i.tc, "The slurp op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_28(INTER i){ MVM_exception_throw_adhoc(i.tc, "The spew op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_29(INTER i){ MVM_exception_throw_adhoc(i.tc, "The spawn op was removed in MoarVM 2017.07."); goto cbc_next(i); } __code cbc_DEPRECATED_30(INTER i){ MVM_exception_throw_adhoc(i.tc, "The shell op was removed in MoarVM 2017.07."); goto cbc_next(i); } __code cbc_DEPRECATED_31(INTER i){ MVM_exception_throw_adhoc(i.tc, "The syncpipe op was removed in MoarVM 2017.07."); goto cbc_next(i); } __code cbc_DEPRECATED_32(INTER i){ MVM_exception_throw_adhoc(i.tc, "The close_fhi op was removed in MoarVM 2017.07."); goto cbc_next(i); } __code cbc_DEPRECATED_33(INTER i){ MVM_exception_throw_adhoc(i.tc, "The newlexotic op was removed in MoarVM 2017.08."); goto cbc_next(i); } __code cbc_DEPRECATED_34(INTER i){ MVM_exception_throw_adhoc(i.tc, "The lexoticresult op was removed in MoarVM 2017.08."); goto cbc_next(i); } __code cbc_coverage_log(INTER i){ MVMString *filename = MVM_cu_string(i.tc,i.cu, GET_UI32(i.cur_op, 0)); MVMuint32 lineno = GET_UI32(i.cur_op, 4); MVMuint32 cacheidx = GET_UI32(i.cur_op, 8); char *cache = (char *)MVM_BC_get_I64(i.cur_op, 12); MVM_line_coverage_report(i.tc, filename, lineno, cacheidx, cache); i.cur_op += 20; goto cbc_next(i); } __code cbc_breakpoint(INTER i){ MVMuint32 file_idx = GET_UI32(i.cur_op, 0); MVMuint32 line_no = GET_UI32(i.cur_op, 4); MVM_debugserver_breakpoint_check(i.tc, file_idx, line_no); i.cur_op += 8; goto cbc_next(i); } __code cbc_coveragecontrol(INTER i){ MVMuint32 cc = (MVMuint32)GET_REG(i.cur_op, 0,i).i64; if (i.tc->instance->coverage_control && (cc == 0 || cc == 1)) i.tc->instance->coverage_control = cc + 1; i.cur_op += 2; goto cbc_next(i); } __code cbc_return_label (INTER i){ /* Need to clear these pointer pointers since they may be rooted * by some GC procedure. */ i.tc->interp_cur_op = NULL; i.tc->interp_bytecode_start = NULL; i.tc->interp_reg_base = NULL; i.tc->interp_cu = NULL; MVM_barrier(); } __code cbc_op_call_extop (INTER i){ /* Bounds checking? Never heard of that. */ MVMuint8 *op_before = i.cur_op; MVMExtOpRecord *record = &i.cu->body.extops[i.op - MVM_OP_EXT_BASE]; record->func(i.tc, i.cur_op); if (op_before == i.cur_op) i.cur_op += record->operand_bytes; goto cbc_next(i); } void MVM_interp_run1(INTER i){ goto (CODES[i.op])(i); } /* This is the interpreter run loop. We have one of these per thread. */ void MVM_interp_run_cbc(MVMThreadContext *tc) { INTER i = {0,*tc->interp_cur_op,*tc->interp_bytecode_start,*tc->interp_reg_base,*tc->interp_cu,NULL,tc}; tc->interp_cur_op = &i.cur_op; tc->interp_bytecode_start = &i.bytecode_start; tc->interp_reg_base = &i.reg_base; tc->interp_cu = &i.cu; /* Enter runloop. */ runloop: { MVM_interp_run1(i); } }