Ticket #365: nci_jit_fix_tt365.patch

File nci_jit_fix_tt365.patch, 2.9 KB (added by cotto, 6 years ago)

patch to stop NCI JIT code from using PMC_struct_val

  • src/pmc/nci.pmc

     
    171171        PObj_flag_SET(private2, SELF); 
    172172    } 
    173173 
     174    VTABLE void *get_pointer() { 
     175        return PARROT_NCI(SELF)->orig_func; 
     176    } 
     177 
    174178    VTABLE void set_pointer_keyed_str(STRING *key, void *func) { 
    175179        Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF); 
    176180        int                             jitted = 0; 
     
    260264        nci_info_ret->pcc_params_signature  = nci_info_self->pcc_params_signature; 
    261265        nci_info_ret->arity                 = nci_info_self->arity; 
    262266        nci_info_ret->jitted                = nci_info_self->jitted; 
    263         PObj_get_FLAGS(ret)    |= (PObj_get_FLAGS(SELF) & 0x7); 
     267        PObj_get_FLAGS(ret)                |= (PObj_get_FLAGS(SELF) & 0x7); 
    264268 
    265269        return ret; 
    266270    } 
     
    312316 
    313317            nci_jit_sub_t jit_func = (nci_jit_sub_t) D2FPTR(nci_info->func); 
    314318 
    315             /* TT #365 - Some i386 jit code depends on this.  If t/pmc/nci.t 
    316              * passes without it, the next line is safe to remove. */ 
    317             PMC_struct_val(SELF) = nci_info->orig_func; 
    318  
    319319            /* Parrot_eprintf(interp, "JITTED %S\n", nci_info->signature); */ 
    320             jit_func(INTERP, SELF, 
    321                 (char *) nci_info->pcc_params_signature->strstart); 
     320            jit_func(INTERP, SELF, (char *) nci_info->pcc_params_signature->strstart); 
    322321        } 
    323322        else { 
    324323            if (PObj_flag_TEST(private2, SELF)) { 
  • src/jit/i386/jit_defs.c

     
    23142314        sig++; 
    23152315    } 
    23162316 
     2317    /* prepare to call VTABLE_get_pointer, set up args */ 
     2318    /* interpreter - movl 8(%ebp), %eax */ 
     2319    emitm_movl_m_r(interp, pc, emit_EAX, emit_EBP, 0, 1, 8); 
     2320    emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1, temp_calls_offset + 0); 
     2321 
     2322    /* pmc - movl 12(%ebp), %eax */ 
     2323    emitm_movl_m_r(interp, pc, emit_EAX, emit_EBP, 0, 1, 12); 
     2324    emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1, temp_calls_offset + 4); 
     2325 
     2326    /* get the get_pointer() pointer from the pmc's vtable */ 
     2327    emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1, offsetof(PMC, vtable)); 
     2328    emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1, offsetof(VTABLE, get_pointer)); 
     2329 
     2330    /* call get_pointer(), result goes into eax */ 
     2331    emitm_callr(pc, emit_EAX); 
    23172332    emitm_addl_i_r(pc, 16, emit_ESP); 
    2318     /* get the pmc from stack - movl 12(%ebp), %eax */ 
    2319     emitm_movl_m_r(interp, pc, emit_EAX, emit_EBP, 0, 1, 12); 
    2320     emitm_callm(pc, emit_EAX, emit_None, emit_None, 0); 
     2333 
     2334    /* call the resulting function pointer */ 
     2335    emitm_callr(pc, emit_EAX); 
    23212336    emitm_subl_i_r(pc, 16, emit_ESP); 
    23222337 
    23232338    /* SAVE OFF EAX */