diff --git a/src/ops/core_ops.c b/src/ops/core_ops.c index 9985434..91355de 100644 --- a/src/ops/core_ops.c +++ b/src/ops/core_ops.c @@ -69,6 +69,32 @@ extern op_lib_t core_op_lib; +PARROT_WARN_UNUSED_RESULT +PMC * +parrot_pmc_new_from_type(PARROT_INTERP, ARGIN(PMC *key)) +{ + PMC *pmc; + PMC *const classobj = Parrot_oo_get_class(interp, key); + + if (!PMC_IS_NULL(classobj)) + pmc = VTABLE_instantiate(interp, classobj, PMCNULL); + else { + const INTVAL type = Parrot_pmc_get_type(interp, key); + + if (type <= 0) { + Parrot_ex_throw_from_c_args(interp, NULL, + EXCEPTION_NO_CLASS, "Class '%Ss' not found", + VTABLE_get_repr(interp, key)); + } + + pmc = Parrot_pmc_new(interp, type); + } + + return pmc; +} + + + INTVAL core_numops = 1072; /* @@ -22227,24 +22253,7 @@ opcode_t * Parrot_fetch_p_p_p_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22255,24 +22264,7 @@ opcode_t * Parrot_fetch_p_pc_p_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22283,24 +22275,7 @@ opcode_t * Parrot_fetch_p_p_pc_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22311,24 +22286,7 @@ opcode_t * Parrot_fetch_p_pc_pc_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22339,24 +22297,7 @@ opcode_t * Parrot_fetch_p_p_p_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22367,24 +22308,7 @@ opcode_t * Parrot_fetch_p_pc_p_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22395,24 +22319,7 @@ opcode_t * Parrot_fetch_p_p_pc_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22423,24 +22330,7 @@ opcode_t * Parrot_fetch_p_pc_pc_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22451,24 +22341,7 @@ opcode_t * Parrot_fetch_p_p_i_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), IREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22479,24 +22352,7 @@ opcode_t * Parrot_fetch_p_pc_i_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), IREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22507,24 +22363,7 @@ opcode_t * Parrot_fetch_p_p_ic_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), ICONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22535,24 +22374,7 @@ opcode_t * Parrot_fetch_p_pc_ic_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), ICONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22563,24 +22385,7 @@ opcode_t * Parrot_fetch_p_p_i_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), IREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22591,24 +22396,7 @@ opcode_t * Parrot_fetch_p_pc_i_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), IREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22619,24 +22407,7 @@ opcode_t * Parrot_fetch_p_p_ic_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), ICONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22647,24 +22418,7 @@ opcode_t * Parrot_fetch_p_pc_ic_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), ICONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22675,24 +22429,7 @@ opcode_t * Parrot_fetch_p_p_s_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22703,24 +22440,7 @@ opcode_t * Parrot_fetch_p_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22731,24 +22451,7 @@ opcode_t * Parrot_fetch_p_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22759,24 +22462,7 @@ opcode_t * Parrot_fetch_p_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22787,24 +22473,7 @@ opcode_t * Parrot_fetch_p_p_s_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22815,24 +22484,7 @@ opcode_t * Parrot_fetch_p_pc_s_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22843,24 +22495,7 @@ opcode_t * Parrot_fetch_p_p_sc_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22871,24 +22506,7 @@ opcode_t * Parrot_fetch_p_pc_sc_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); } PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); @@ -22899,24 +22517,7 @@ opcode_t * Parrot_vivify_p_p_p_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed(interp, PREG(2), PREG(3), PREG(1)); } @@ -22928,24 +22529,7 @@ opcode_t * Parrot_vivify_p_pc_p_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed(interp, PCONST(2), PREG(3), PREG(1)); } @@ -22957,24 +22541,7 @@ opcode_t * Parrot_vivify_p_p_pc_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed(interp, PREG(2), PCONST(3), PREG(1)); } @@ -22986,24 +22553,7 @@ opcode_t * Parrot_vivify_p_pc_pc_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed(interp, PCONST(2), PCONST(3), PREG(1)); } @@ -23015,24 +22565,7 @@ opcode_t * Parrot_vivify_p_p_p_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed(interp, PREG(2), PREG(3), PREG(1)); } @@ -23044,24 +22577,7 @@ opcode_t * Parrot_vivify_p_pc_p_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed(interp, PCONST(2), PREG(3), PREG(1)); } @@ -23073,24 +22589,7 @@ opcode_t * Parrot_vivify_p_p_pc_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed(interp, PREG(2), PCONST(3), PREG(1)); } @@ -23102,24 +22601,7 @@ opcode_t * Parrot_vivify_p_pc_pc_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed(interp, PCONST(2), PCONST(3), PREG(1)); } @@ -23131,24 +22613,7 @@ opcode_t * Parrot_vivify_p_p_i_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), IREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed_int(interp, PREG(2), IREG(3), PREG(1)); } @@ -23160,24 +22625,7 @@ opcode_t * Parrot_vivify_p_pc_i_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), IREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed_int(interp, PCONST(2), IREG(3), PREG(1)); } @@ -23189,24 +22637,7 @@ opcode_t * Parrot_vivify_p_p_ic_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), ICONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed_int(interp, PREG(2), ICONST(3), PREG(1)); } @@ -23218,24 +22649,7 @@ opcode_t * Parrot_vivify_p_pc_ic_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), ICONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed_int(interp, PCONST(2), ICONST(3), PREG(1)); } @@ -23247,24 +22661,7 @@ opcode_t * Parrot_vivify_p_p_i_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), IREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed_int(interp, PREG(2), IREG(3), PREG(1)); } @@ -23276,24 +22673,7 @@ opcode_t * Parrot_vivify_p_pc_i_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), IREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed_int(interp, PCONST(2), IREG(3), PREG(1)); } @@ -23305,24 +22685,7 @@ opcode_t * Parrot_vivify_p_p_ic_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), ICONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed_int(interp, PREG(2), ICONST(3), PREG(1)); } @@ -23334,24 +22697,7 @@ opcode_t * Parrot_vivify_p_pc_ic_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), ICONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed_int(interp, PCONST(2), ICONST(3), PREG(1)); } @@ -23363,24 +22709,7 @@ opcode_t * Parrot_vivify_p_p_s_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed_str(interp, PREG(2), SREG(3), PREG(1)); } @@ -23392,24 +22721,7 @@ opcode_t * Parrot_vivify_p_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed_str(interp, PCONST(2), SREG(3), PREG(1)); } @@ -23421,24 +22733,7 @@ opcode_t * Parrot_vivify_p_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed_str(interp, PREG(2), SCONST(3), PREG(1)); } @@ -23450,24 +22745,7 @@ opcode_t * Parrot_vivify_p_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PREG(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PREG(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PREG(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PREG(4)); VTABLE_set_pmc_keyed_str(interp, PCONST(2), SCONST(3), PREG(1)); } @@ -23479,24 +22757,7 @@ opcode_t * Parrot_vivify_p_p_s_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed_str(interp, PREG(2), SREG(3), PREG(1)); } @@ -23508,24 +22769,7 @@ opcode_t * Parrot_vivify_p_pc_s_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SREG(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed_str(interp, PCONST(2), SREG(3), PREG(1)); } @@ -23537,24 +22781,7 @@ opcode_t * Parrot_vivify_p_p_sc_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed_str(interp, PREG(2), SCONST(3), PREG(1)); } @@ -23566,24 +22793,7 @@ opcode_t * Parrot_vivify_p_pc_sc_pc(opcode_t *cur_opcode, PARROT_INTERP) { PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SCONST(3)); if (PMC_IS_NULL(PREG(1))) { - PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4)); - - if ((!PMC_IS_NULL(classobj))) { - PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL); - } - else { - const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4)); - - if ((type <= 0)) { - opcode_t * dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 5, EXCEPTION_NO_CLASS, "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4))); - - PARROT_GC_WRITE_BARRIER(interp, CURRENT_CONTEXT(interp)); - return (opcode_t *)dest; - } - - PREG(1) = Parrot_pmc_new(interp, type); - } - + PREG(1) = parrot_pmc_new_from_type(interp, PCONST(4)); VTABLE_set_pmc_keyed_str(interp, PCONST(2), SCONST(3), PREG(1)); } diff --git a/src/ops/experimental.ops b/src/ops/experimental.ops index ec288ac..88a7c89b 100644 --- a/src/ops/experimental.ops +++ b/src/ops/experimental.ops @@ -2,6 +2,34 @@ ** experimental.ops */ +BEGIN_OPS_PREAMBLE + +PARROT_WARN_UNUSED_RESULT +PMC * +parrot_pmc_new_from_type(PARROT_INTERP, ARGIN(PMC *key)) +{ + PMC *pmc; + PMC *const classobj = Parrot_oo_get_class(interp, key); + + if (!PMC_IS_NULL(classobj)) + pmc = VTABLE_instantiate(interp, classobj, PMCNULL); + else { + const INTVAL type = Parrot_pmc_get_type(interp, key); + + if (type <= 0) { + Parrot_ex_throw_from_c_args(interp, NULL, + EXCEPTION_NO_CLASS, "Class '%Ss' not found", + VTABLE_get_repr(interp, key)); + } + + pmc = Parrot_pmc_new(interp, type); + } + + return pmc; +} + +END_OPS_PREAMBLE + =head1 NAME experimental.ops - Experimental Opcodes @@ -84,61 +112,25 @@ uses the type in $4 to create and return a new PMC. inline op fetch(out PMC, in PMC, in PMC, in PMC) :base_core { $1 = VTABLE_get_pmc_keyed(interp, $2, $3); + if (PMC_IS_NULL($1)) { - PMC * const classobj = Parrot_oo_get_class(interp, $4); - if (!PMC_IS_NULL(classobj)) - $1 = VTABLE_instantiate(interp, classobj, PMCNULL); - else { - const INTVAL type = Parrot_pmc_get_type(interp, $4); - if (type <= 0) { - opcode_t *dest = Parrot_ex_throw_from_op_args( - interp, expr NEXT(), EXCEPTION_NO_CLASS, - "Class '%Ss' not found", VTABLE_get_repr(interp, $4)); - goto ADDRESS(dest); - } - - $1 = Parrot_pmc_new(interp, type); - } + $1 = parrot_pmc_new_from_type(interp, $4); } } inline op fetch(out PMC, in PMC, in INT, in PMC) :base_core { $1 = VTABLE_get_pmc_keyed_int(interp, $2, $3); + if (PMC_IS_NULL($1)) { - PMC * const classobj = Parrot_oo_get_class(interp, $4); - if (!PMC_IS_NULL(classobj)) - $1 = VTABLE_instantiate(interp, classobj, PMCNULL); - else { - const INTVAL type = Parrot_pmc_get_type(interp, $4); - if (type <= 0) { - opcode_t *dest = Parrot_ex_throw_from_op_args( - interp, expr NEXT(), EXCEPTION_NO_CLASS, - "Class '%Ss' not found", VTABLE_get_repr(interp, $4)); - goto ADDRESS(dest); - } - - $1 = Parrot_pmc_new(interp, type); - } + $1 = parrot_pmc_new_from_type(interp, $4); } } inline op fetch(out PMC, in PMC, in STR, in PMC) :base_core { $1 = VTABLE_get_pmc_keyed_str(interp, $2, $3); + if (PMC_IS_NULL($1)) { - PMC * const classobj = Parrot_oo_get_class(interp, $4); - if (!PMC_IS_NULL(classobj)) - $1 = VTABLE_instantiate(interp, classobj, PMCNULL); - else { - const INTVAL type = Parrot_pmc_get_type(interp, $4); - if (type <= 0) { - opcode_t *dest = Parrot_ex_throw_from_op_args( - interp, expr NEXT(), EXCEPTION_NO_CLASS, - "Class '%Ss' not found", VTABLE_get_repr(interp, $4)); - goto ADDRESS(dest); - } - - $1 = Parrot_pmc_new(interp, type); - } + $1 = parrot_pmc_new_from_type(interp, $4); } } @@ -157,21 +149,8 @@ inline op vivify(out PMC, in PMC, in PMC, in PMC) :base_core { $1 = VTABLE_get_pmc_keyed(interp, $2, $3); if (PMC_IS_NULL($1)) { - PMC * const classobj = Parrot_oo_get_class(interp, $4); - - if (!PMC_IS_NULL(classobj)) - $1 = VTABLE_instantiate(interp, classobj, PMCNULL); - else { - const INTVAL type = Parrot_pmc_get_type(interp, $4); - if (type <= 0) { - opcode_t *dest = Parrot_ex_throw_from_op_args( - interp, expr NEXT(), EXCEPTION_NO_CLASS, - "Class '%Ss' not found", VTABLE_get_repr(interp, $4)); - goto ADDRESS(dest); - } - - $1 = Parrot_pmc_new(interp, type); - } + $1 = parrot_pmc_new_from_type(interp, $4); + VTABLE_set_pmc_keyed(interp, $2, $3, $1); } } @@ -180,20 +159,7 @@ inline op vivify(out PMC, in PMC, in INT, in PMC) :base_core { $1 = VTABLE_get_pmc_keyed_int(interp, $2, $3); if (PMC_IS_NULL($1)) { - PMC * const classobj = Parrot_oo_get_class(interp, $4); - if (!PMC_IS_NULL(classobj)) - $1 = VTABLE_instantiate(interp, classobj, PMCNULL); - else { - const INTVAL type = Parrot_pmc_get_type(interp, $4); - if (type <= 0) { - opcode_t *dest = Parrot_ex_throw_from_op_args( - interp, expr NEXT(), EXCEPTION_NO_CLASS, - "Class '%Ss' not found", VTABLE_get_repr(interp, $4)); - goto ADDRESS(dest); - } - - $1 = Parrot_pmc_new(interp, type); - } + $1 = parrot_pmc_new_from_type(interp, $4); VTABLE_set_pmc_keyed_int(interp, $2, $3, $1); } @@ -203,20 +169,7 @@ inline op vivify(out PMC, in PMC, in STR, in PMC) :base_core { $1 = VTABLE_get_pmc_keyed_str(interp, $2, $3); if (PMC_IS_NULL($1)) { - PMC * const classobj = Parrot_oo_get_class(interp, $4); - if (!PMC_IS_NULL(classobj)) - $1 = VTABLE_instantiate(interp, classobj, PMCNULL); - else { - const INTVAL type = Parrot_pmc_get_type(interp, $4); - if (type <= 0) { - opcode_t *dest = Parrot_ex_throw_from_op_args( - interp, expr NEXT(), EXCEPTION_NO_CLASS, - "Class '%Ss' not found", VTABLE_get_repr(interp, $4)); - goto ADDRESS(dest); - } - - $1 = Parrot_pmc_new(interp, type); - } + $1 = parrot_pmc_new_from_type(interp, $4); VTABLE_set_pmc_keyed_str(interp, $2, $3, $1); }