Index: src/nci_test.c =================================================================== --- src/nci_test.c (revision 38164) +++ src/nci_test.c (working copy) @@ -104,7 +104,7 @@ PARROT_EXPORT void nci_vpii(Outer *, int, int); PARROT_EXPORT void nci_vv(void); PARROT_EXPORT void nci_vVi(Opaque**, int); -PARROT_EXPORT void nci_vp(Opaque*); +PARROT_EXPORT void nci_vp(Opaque**); PARROT_EXPORT char * nci_ttt(char *, char *); PARROT_EXPORT void nci_vfff(float, float, float); PARROT_EXPORT void nci_vV(const char **); @@ -1087,7 +1087,7 @@ /* =item C +nci_vp(Opaque**)> Test that a previously generated opaque struct gets passed back to an NCI function correctly. @@ -1097,10 +1097,10 @@ */ PARROT_EXPORT void -nci_vp(Opaque *inOpaque) +nci_vp(Opaque **inOpaque) { - if (inOpaque) - printf("got %d\n", inOpaque->x); + if (*inOpaque) + printf("got %d\n", (*inOpaque)->x); else printf("got null"); } Index: src/pmc/pointer.pmc =================================================================== --- src/pmc/pointer.pmc (revision 38164) +++ src/pmc/pointer.pmc (working copy) @@ -23,8 +23,8 @@ #include "parrot/parrot.h" pmclass Pointer need_ext { - ATTR void * mark_function; - ATTR void * pointer; + ATTR void * mark_function; + ATTR void ** pointer; /* @@ -69,7 +69,7 @@ VTABLE void mark() { void (*mark_function)(Interp *, void *) = (void (*)(Interp *, void *))D2FPTR(PARROT_POINTER(SELF)->mark_function); - void * data = PARROT_POINTER(SELF)->pointer; + void * data = *PARROT_POINTER(SELF)->pointer; if (data && mark_function) (*mark_function)(INTERP, data); } @@ -102,7 +102,7 @@ */ VTABLE void set_pointer(void *ptr) { - PARROT_POINTER(SELF)->pointer = ptr; + *PARROT_POINTER(SELF)->pointer = ptr; } /* @@ -116,7 +116,7 @@ */ VTABLE void *get_pointer() { - return PARROT_POINTER(SELF)->pointer; + return &(PARROT_POINTER(SELF)->pointer); } /* @@ -130,7 +130,7 @@ */ VTABLE INTVAL get_integer() { - return (INTVAL)(PARROT_POINTER(SELF)->pointer); + return (INTVAL)&(PARROT_POINTER(SELF)->pointer); } /* @@ -144,7 +144,7 @@ */ VTABLE FLOATVAL get_number() { - return (FLOATVAL)(INTVAL)(PARROT_POINTER(SELF)->pointer); + return (FLOATVAL)(INTVAL)&(PARROT_POINTER(SELF)->pointer); } /* @@ -158,7 +158,7 @@ */ VTABLE STRING *get_repr() { - return Parrot_sprintf_c(INTERP, "Pointer = 0x%p", PARROT_POINTER(SELF)->pointer); + return Parrot_sprintf_c(INTERP, "Pointer = 0x%p", &PARROT_POINTER(SELF)->pointer); } @@ -166,7 +166,7 @@ =item C -Returns the pointer value as a Parrot string. +Returns the pointer value as a Parrot C. =cut @@ -187,7 +187,7 @@ */ VTABLE INTVAL get_bool() { - return (INTVAL)(PMC_data(SELF) != NULL); + return (INTVAL)(*PARROT_POINTER(SELF)->pointer != NULL); } /* Index: src/jit/i386/jit_defs.c =================================================================== --- src/jit/i386/jit_defs.c (revision 38164) +++ src/jit/i386/jit_defs.c (working copy) @@ -2273,6 +2273,9 @@ emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1, offsetof(VTABLE, get_pointer)); emitm_callr(pc, emit_EAX); emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1, args_offset); + /* reset ESP(4) */ + emitm_lea_m_r(interp, pc, emit_EAX, emit_EBP, 0, 1, st_offset); + emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1, temp_calls_offset + 4); break; case 'b': /* buffer (void*) pass PObj_bufstart(SReg) */ emitm_call_cfunc(pc, get_nci_S); Index: t/pmc/nci.t =================================================================== --- t/pmc/nci.t (revision 38168) +++ t/pmc/nci.t (working copy) @@ -2647,11 +2647,6 @@ 3 OUTPUT -{ - local $TODO = 0; - if ($PConfig{jitcapable}){ - $TODO = "TT #551 - jitted NCI sig with V is broken"; - } pir_output_is( << 'CODE', << 'OUTPUT', "nci_vVi - void** out parameter" ); .sub test :main .local string library_name @@ -2674,7 +2669,6 @@ CODE got 10 OUTPUT -} pir_output_is( << 'CODE', << 'OUTPUT', "nci_ttt - t_tt parameter" ); .sub test :main @@ -2712,11 +2706,6 @@ 1 OUTPUT -{ - local $TODO = 0; - if ($PConfig{jitcapable}){ - $TODO = "TT #551 - jitted NCI sig with V is broken"; - } pir_output_is( << 'CODE', << 'OUTPUT', "nci_vV - char** out parameter" ); .sub test :main .local string library_name @@ -2764,7 +2753,6 @@ It is a beautiful day! Go suck a lemon. OUTPUT -} # Local Variables: # mode: cperl Index: tools/build/nativecall.pl =================================================================== --- tools/build/nativecall.pl (revision 38164) +++ tools/build/nativecall.pl (working copy) @@ -353,11 +353,10 @@ }; /V/ && do { push @{$temps_ref}, "PMC *t_$temp_num;"; - push @{$temps_ref}, "void *v_$temp_num;"; + push @{$temps_ref}, "void **v_$temp_num;"; push @{$extra_preamble_ref}, "t_$temp_num = GET_NCI_P($reg_num);"; - push @{$extra_preamble_ref}, "v_$temp_num = VTABLE_get_pointer(interp, t_$temp_num);"; - push @{$extra_postamble_ref}, "VTABLE_set_pointer(interp, t_$temp_num, v_$temp_num);"; - return "&v_$temp_num"; + push @{$extra_preamble_ref}, "v_$temp_num = (void **) VTABLE_get_pointer(interp, t_$temp_num);"; + return "v_$temp_num"; }; /[ilIscfdNS]/ && do { my $ret_type = $sig_table{$_}{return_type};