Mercurial > hg > Members > anatofuz > MoarVM
view src/core/cbc-interp.cbc @ 43:f750745c94ab
add CbCLLVMMakefile
author | anatofuz |
---|---|
date | Fri, 30 Nov 2018 14:07:07 +0900 |
parents | a25406f7da51 |
children | 47f12bb731b8 |
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; __code cbc_next(INTERP i){ __code (*c)(INTERP); //printf("count=%d op=%d\n", op_count++, *i->cur_op); c = CODES[NEXT_OP(i)]; i->tc->gc_status=0; goto c(i); } __code cbc_no_op(INTERP i){ goto cbc_next(i); } __code cbc_const_i8(INTERP i){ goto cbc_const_i16(i); } __code cbc_const_i16(INTERP i){ goto cbc_const_i32(i); } __code cbc_const_i32(INTERP i){ MVM_exception_throw_adhoc(i->tc, "const_iX NYI"); goto cbc_const_i64(i); } __code cbc_const_i64(INTERP 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(INTERP i){ MVM_exception_throw_adhoc(i->tc, "const_n32 NYI"); goto cbc_const_n64(i); } __code cbc_const_n64(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ goto cbc_bindlex_ng(i); } __code cbc_bindlex_ng(INTERP i){ MVM_exception_throw_adhoc(i->tc, "get/bindlex_ng NYI"); goto cbc_getdynlex(i); } __code cbc_getdynlex(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ static MVMObject *value; value = GET_REG(i->cur_op, 0,i).o; if (MVM_spesh_log_is_logging(i->tc)) { do { MVM_gc_root_temp_push(i->tc, (MVMCollectable **)&(value)); // This is invoke call elimination MVM_spesh_log_return_type(i->tc, value); MVM_gc_root_temp_pop(i->tc); } while (0); } 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ GET_REG(i->cur_op, 0,i).i64++; i->cur_op += 2; goto cbc_next(i); } __code cbc_inc_u(INTERP i){ GET_REG(i->cur_op, 0,i).u64++; i->cur_op += 2; goto cbc_next(i); } __code cbc_dec_i(INTERP i){ GET_REG(i->cur_op, 0,i).i64--; i->cur_op += 2; goto cbc_next(i); } __code cbc_dec_u(INTERP i){ GET_REG(i->cur_op, 0,i).u64--; i->cur_op += 2; goto cbc_next(i); } __code cbc_band_i(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ static 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(INTERP 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(INTERP 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(INTERP i){ GET_REG(i->cur_op, 0,i).s = NULL; i->cur_op += 2; goto cbc_next(i); } __code cbc_isnull_s(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ GET_REG(i->cur_op, 0,i).o = i->tc->instance->VMNull; i->cur_op += 2; goto cbc_next(i); } __code cbc_isnull(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ static MVMObject *value; 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ GET_REG(i->cur_op, 0,i).o = i->tc->instance->KnowHOW; i->cur_op += 2; goto cbc_next(i); } __code cbc_knowhowattr(INTERP i){ GET_REG(i->cur_op, 0,i).o = i->tc->instance->KnowHOWAttribute; i->cur_op += 2; goto cbc_next(i); } __code cbc_newtype(INTERP 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(INTERP 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(INTERP i){ static MVMObject *iter; MVMObject *cache; MVMSTable *stable; iter = MVM_iter(i->tc, GET_REG(i->cur_op, 2,i).o); 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)) { static MVMRegister result; //invoke elimination was failed codesegment 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ MVM_hll_enter_compilee_mode(i->tc); goto cbc_next(i); } __code cbc_usecompilerhllconfig(INTERP i){ MVM_hll_leave_compilee_mode(i->tc); goto cbc_next(i); } __code cbc_iter(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ MVMObject * const cr = GET_REG(i->cur_op, 2,i).o; static MVMCode *ncr; //invoke tail call elimination 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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); } __code cbc_setcontspec(INTERP 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); static char *waste[] = { NULL, NULL }; if (cc == NULL) { static char *c_name; //char *c_name = MVM_string_utf8_encode_C_string(i->tc, name); invoke elimination codesegment 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; goto cbc_next(i); } __code cbc_sha1(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ //lasterror //MVMObject * const sc = GET_REG(i->cur_op, 0,i).o; static MVMObject * sc; 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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 =i->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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ MVM_exception_throw_adhoc(i->tc, "append is not supported"); goto cbc_next(i); } __code cbc_rename_f(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ goto cbc_encodefromcodes(i); } __code cbc_encodefromcodes(INTERP i){ MVM_exception_throw_adhoc(i->tc, "NYI"); goto cbc_print(i); } __code cbc_print(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ MVM_thread_yield(i->tc); goto cbc_next(i); } __code cbc_currentthread(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ MVM_gc_enter_from_allocator(i->tc); goto cbc_next(i); } __code cbc_nativecallglobal(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ MVM_exception_throw_adhoc(i->tc, "NYI"); goto cbc_normalizecodes(i); } __code cbc_normalizecodes(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ goto cbc_getlexref_i16(i); } __code cbc_getlexref_i16(INTERP i){ goto cbc_getlexref_i8(i); } __code cbc_getlexref_i8(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ goto cbc_getlexref_u32(i); } __code cbc_getlexref_u32(INTERP i){ goto cbc_getlexref_u16(i); } __code cbc_getlexref_u16(INTERP i){ goto cbc_getlexref_u8(i); } __code cbc_getlexref_u8(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ GET_REG(i->cur_op, 0,i).o = i->tc->last_payload; i->cur_op += 2; goto cbc_next(i); } __code cbc_cancelnotify(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ GET_REG(i->cur_op, 0,i).i32 = MVM_platform_cpu_count(); i->cur_op += 2; goto cbc_next(i); } __code cbc_decodertakecharseof(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ MVM_barrier(); goto cbc_next(i); } __code cbc_nativeinvoke_v(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ MVM_profile_log_exit(i->tc); goto cbc_next(i); } __code cbc_prof_allocated(INTERP 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(INTERP 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(INTERP i){ goto cbc_DEPRECATED_5(i); } __code cbc_DEPRECATED_5(INTERP i){ goto cbc_DEPRECATED_6(i); } __code cbc_DEPRECATED_6(INTERP i){ goto cbc_DEPRECATED_7(i); } __code cbc_DEPRECATED_7(INTERP i){ goto cbc_DEPRECATED_8(i); } __code cbc_DEPRECATED_8(INTERP i){ goto cbc_DEPRECATED_9(i); } __code cbc_DEPRECATED_9(INTERP i){ goto cbc_DEPRECATED_10(i); } __code cbc_DEPRECATED_10(INTERP i){ goto cbc_DEPRECATED_11(i); } __code cbc_DEPRECATED_11(INTERP i){ goto cbc_DEPRECATED_12(i); } __code cbc_DEPRECATED_12(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The getregref_* ops were removed in MoarVM 2017.01."); goto cbc_next(i); } __code cbc_DEPRECATED_13(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The continuationclone op was removed in MoarVM 2017.01."); goto cbc_next(i); } __code cbc_DEPRECATED_14(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The asyncwritestr op was removed in MoarVM 2017.05."); goto cbc_next(i); } __code cbc_DEPRECATED_15(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The asyncwritestrto op was removed in MoarVM 2017.05."); goto cbc_next(i); } __code cbc_DEPRECATED_16(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The asyncreadchars op was removed in MoarVM 2017.05."); goto cbc_next(i); } __code cbc_DEPRECATED_17(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The setencoding op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_18(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP 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(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The setinputlinesep op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_25(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The setinputlineseps op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_27(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The slurp op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_28(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The spew op was removed in MoarVM 2017.06."); goto cbc_next(i); } __code cbc_DEPRECATED_29(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The spawn op was removed in MoarVM 2017.07."); goto cbc_next(i); } __code cbc_DEPRECATED_30(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The shell op was removed in MoarVM 2017.07."); goto cbc_next(i); } __code cbc_DEPRECATED_31(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The syncpipe op was removed in MoarVM 2017.07."); goto cbc_next(i); } __code cbc_DEPRECATED_32(INTERP 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(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The newlexotic op was removed in MoarVM 2017.08."); goto cbc_next(i); } __code cbc_DEPRECATED_34(INTERP i){ MVM_exception_throw_adhoc(i->tc, "The lexoticresult op was removed in MoarVM 2017.08."); goto cbc_next(i); } __code cbc_coverage_log(INTERP 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(INTERP 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(INTERP 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 (INTERP 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 (INTERP 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(INTERP i){ goto (CODES[(i->op = *(MVMuint16 *)(i->cur_op), i->cur_op += 2, i->op)])(i); } /* This is the interpreter run loop. We have one of these per thread. */ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContext *, void *), void *invoke_data) { #if MVM_CGOTO #endif INTER inter = {0,NULL,NULL,NULL,NULL,NULL,tc}; INTERP i = &inter; /* Stash addresses of current op, register base and SC deref base * in the TC; this will be used by anything that needs to switch * the current place we're interpreting. */ 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; /* With everything set up, do the initial invocation (exactly what this does * varies depending on if this is starting a new thread or is the top-level * program entry point). */ initial_invoke(tc, invoke_data); /* Set jump point, for if we arrive back in the interpreter from an * exception thrown from C code. */ setjmp(tc->interp_jump); /* Enter runloop. */ runloop: { //MVMuint16 op; #if MVM_TRACING if (tracing_enabled) { char *trace_line; trace_line = MVM_exception_backtrace_line(tc, tc->cur_frame, 0, i->cur_op); fprintf(stderr, "Op %d%s\n", (int)*((MVMuint16 *)i->cur_op), trace_line); /* slow tracing is slow. Feel free to speed it. */ MVM_free(trace_line); } #endif /* The ops should be in the same order here as in the oplist file, so * the compiler can can optimise the switch properly */ //DISPATCH(NEXT_OP(i)) //goto (CODES[(i->op = *(MVMuint16 *)(i->cur_op), i->cur_op += 2, i->op)])(i); MVM_interp_run1(i); } } void MVM_interp_enable_tracing() { tracing_enabled = 1; }