Ticket #551 (closed bug: fixed)
t/pmc/nci.t: 2 test failures
Description
These two tests began to fail after r38036; bisection suggests r38037. Here are some pastes:
1. Output of my run on Linux/i386 of prove -v t/pmc/nci.t:
ok 65 - arity not ok 66 - nci_vVi - void** out parameter # Failed test 'nci_vVi - void** out parameter' # at t/pmc/nci.t line 2650. # Exited with error code: [SIGNAL 6] # Received: # src/call/pcc.c:978: failed assertion '(st->dest.sig & PARROT_ARG_TYPE_MASK) == PARROT_ARG_PMC' # Backtrace - Obtained 18 stack frames (max trace depth is 32). # (unknown) # Parrot_confess # Parrot_fetch_arg_nci # (unknown) # (unknown) # Parrot_NCI_invoke # Parrot_invokecc_p # (unknown) # (unknown) # (unknown) # (unknown) # Parrot_runops_fromc_args # Parrot_runcode # (unknown) # imcc_run # (unknown) # __libc_start_main # (unknown) # # Expected: # got 10 # ok 67 - nci_ttt - t_tt parameter ok 68 - nci_vfff - v_fff parameter not ok 69 - nci_vV - char** out parameter # Failed test 'nci_vV - char** out parameter' # at t/pmc/nci.t line 2709. # Exited with error code: [SIGNAL 11] # Received: # # Expected: # Hello bright new world # # Looks like you failed 2 tests of 69. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/69 subtests Test Summary Report ------------------- t/pmc/nci (Wstat: 512 Tests: 69 Failed: 2) Failed tests: 66, 69 Non-zero exit status: 2 Files=1, Tests=69, 6 wallclock secs ( 0.00 usr 0.00 sys + 1.30 cusr 0.18 csys = 1.48 CPU) Result: FAIL
2. mikehh's direct call:
mhk@mhk-desktop:~/parrot.t$ ./parrot -t t/pmc/nci_66.pir
0 set S0, "libnci_test" S0="(null)"
3 loadlib P1, S0 P1=PMCNULL S0="libnci_test"
6 dlfunc P3, P1, "nci_vVi", "vVi" P3=PMCNULL P1=ParrotLibrary=PMC(0x9c25538)
11 dlfunc P2, P1, "nci_vp", "vp" P2=PMCNULL P1=ParrotLibrary=PMC(0x9c25538)
16 new P0, PC14 P0=PMCNULL PC14=Key=PMC(0x9c25550)
19 set I0, 10 I0=0
22 set_args PC9 (2), P0, I0 PC9=FixedIntegerArray=PMC(0x9c25580) P0=Pointer=PMC(0x9c1e960) I0=10
26 get_results PC11
28 invokecc P3 P3=NCI=PMC(0x9c1ec60)
Segmentation fault
mhk@mhk-desktop:~/parrot.t$ ./parrot -t t/pmc/nci_69.pir
0 set S1, "libnci_test" S1="(null)"
3 loadlib P0, S1 P0=PMCNULL S1="libnci_test"
6 dlfunc P1, P0, "nci_vV", "vV" P1=PMCNULL P0=ParrotLibrary=PMC(0x97c8550)
11 new P2, PC10 P2=PMCNULL PC10=Key=PMC(0x97c8568)
14 set_args PC4 (1), P2 PC4=FixedIntegerArray=PMC(0x97c8598) P2=Pointer=PMC(0x97c1990)
17 get_results PC7
19 invokecc P1 P1=NCI=PMC(0x97c1c60)
Segmentation fault
3. A diff
cat ~/learn/parrot/38036.38037.diff
Index: src/pmc/pointer.pmc
===================================================================
--- src/pmc/pointer.pmc (revision 38036)
+++ src/pmc/pointer.pmc (revision 38037)
@@ -23,6 +23,8 @@
#include "parrot/parrot.h"
pmclass Pointer need_ext {
+ ATTR void * mark_function;
+ ATTR void * pointer;
/*
@@ -36,6 +38,7 @@
VTABLE void init() {
PObj_custom_mark_SET(SELF);
+ PMC_data(SELF) = mem_allocate_zeroed_typed(Parrot_Pointer_attributes);
}
/*
@@ -50,10 +53,10 @@
VTABLE void mark() {
void (*mark_function)(Interp *, void *) =
- (void (*)(Interp *, void *))D2FPTR(PMC_struct_val(SELF));
-
- if (PMC_data(SELF) && PMC_struct_val(SELF))
- (*mark_function)(INTERP, PMC_data(SELF));
+ (void (*)(Interp *, void *))D2FPTR(PARROT_POINTER(SELF)->mark_function);
+ void * data = PARROT_POINTER(SELF)->pointer;
+ if (data && mark_function)
+ (*mark_function)(INTERP,data);
}
/*
@@ -84,7 +87,7 @@
*/
VTABLE void *get_pointer() {
- return PMC_data(SELF);
+ return PARROT_POINTER(SELF)->pointer;
}
/*
@@ -98,7 +101,7 @@
*/
VTABLE INTVAL get_integer() {
- return (INTVAL)PMC_data(SELF);
+ return (INTVAL)(PARROT_POINTER(SELF)->pointer);
}
/*
@@ -112,7 +115,7 @@
*/
VTABLE FLOATVAL get_number() {
- return (FLOATVAL)(INTVAL)PMC_data(SELF);
+ return (FLOATVAL)(INTVAL)(PARROT_POINTER(SELF)->pointer);
}
/*
@@ -126,7 +129,7 @@
*/
VTABLE STRING *get_repr() {
- return Parrot_sprintf_c(INTERP, "Pointer = 0x%p", PMC_data(SELF));
+ return Parrot_sprintf_c(INTERP, "Pointer = 0x%p", PARROT_POINTER(SELF)->pointer);
}
@@ -141,7 +144,7 @@
*/
VTABLE STRING *get_string() {
- return Parrot_sprintf_c(INTERP, "%s", PMC_data(SELF));
+ return Parrot_sprintf_c(INTERP, "%s", PARROT_POINTER(SELF)->pointer);
}
/*
@@ -170,7 +173,7 @@
VTABLE INTVAL is_same(PMC *pmc2) {
return (INTVAL)(SELF->vtable == pmc2->vtable &&
- PMC_data(SELF) == PMC_data(pmc2));
+ PARROT_POINTER(SELF)->pointer == PARROT_POINTER(pmc2)->pointer);
}
}
Index: tools/build/nativecall.pl
===================================================================
--- tools/build/nativecall.pl (revision 38036)
+++ tools/build/nativecall.pl (revision 38037)
@@ -197,6 +197,7 @@
#include "parrot/oplib/ops.h"
#include "pmc/pmc_managedstruct.h"
#include "pmc/pmc_nci.h"
+#include "pmc/pmc_pointer.h"
#include "nci.str"
#include "jit.h"
@@ -353,7 +354,7 @@
/V/ && do {
push @{$temps_ref}, "PMC *t_$temp_num;";
push @{$extra_preamble_ref}, "t_$temp_num = GET_NCI_P($reg_num);";
- return "(void**)&PMC_data(t_$temp_num)";
+ return "(void**)&PARROT_POINTER(t_$temp_num)->pointer";
};
/[ilIscfdNS]/ && do {
my $ret_type = $sig_table{$_}{return_type};
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

