Index: src/pmc/nci.pmc =================================================================== --- src/pmc/nci.pmc (revision 37934) +++ src/pmc/nci.pmc (working copy) @@ -171,6 +171,10 @@ PObj_flag_SET(private2, SELF); } + VTABLE void *get_pointer() { + return PARROT_NCI(SELF)->orig_func; + } + VTABLE void set_pointer_keyed_str(STRING *key, void *func) { Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF); int jitted = 0; @@ -260,7 +264,7 @@ nci_info_ret->pcc_params_signature = nci_info_self->pcc_params_signature; nci_info_ret->arity = nci_info_self->arity; nci_info_ret->jitted = nci_info_self->jitted; - PObj_get_FLAGS(ret) |= (PObj_get_FLAGS(SELF) & 0x7); + PObj_get_FLAGS(ret) |= (PObj_get_FLAGS(SELF) & 0x7); return ret; } @@ -312,13 +316,8 @@ nci_jit_sub_t jit_func = (nci_jit_sub_t) D2FPTR(nci_info->func); - /* TT #365 - Some i386 jit code depends on this. If t/pmc/nci.t - * passes without it, the next line is safe to remove. */ - PMC_struct_val(SELF) = nci_info->orig_func; - /* Parrot_eprintf(interp, "JITTED %S\n", nci_info->signature); */ - jit_func(INTERP, SELF, - (char *) nci_info->pcc_params_signature->strstart); + jit_func(INTERP, SELF, (char *) nci_info->pcc_params_signature->strstart); } else { if (PObj_flag_TEST(private2, SELF)) { Index: src/jit/i386/jit_defs.c =================================================================== --- src/jit/i386/jit_defs.c (revision 37934) +++ src/jit/i386/jit_defs.c (working copy) @@ -2314,10 +2314,25 @@ sig++; } + /* prepare to call VTABLE_get_pointer, set up args */ + /* interpreter - movl 8(%ebp), %eax */ + emitm_movl_m_r(interp, pc, emit_EAX, emit_EBP, 0, 1, 8); + emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1, temp_calls_offset + 0); + + /* pmc - movl 12(%ebp), %eax */ + emitm_movl_m_r(interp, pc, emit_EAX, emit_EBP, 0, 1, 12); + emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1, temp_calls_offset + 4); + + /* get the get_pointer() pointer from the pmc's vtable */ + emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1, offsetof(PMC, vtable)); + emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1, offsetof(VTABLE, get_pointer)); + + /* call get_pointer(), result goes into eax */ + emitm_callr(pc, emit_EAX); emitm_addl_i_r(pc, 16, emit_ESP); - /* get the pmc from stack - movl 12(%ebp), %eax */ - emitm_movl_m_r(interp, pc, emit_EAX, emit_EBP, 0, 1, 12); - emitm_callm(pc, emit_EAX, emit_None, emit_None, 0); + + /* call the resulting function pointer */ + emitm_callr(pc, emit_EAX); emitm_subl_i_r(pc, 16, emit_ESP); /* SAVE OFF EAX */