On Monday 21 April 2008 20:22:51 Seneca Cunningham wrote:
> parrot crashes while generating src/Grammar_gen.pir. The last build
> attempted (on a different copy of the source tree) worked and was done
> right after the commits to get OpenGL working on OS X happened. This
> happens with both "make -j2" and a plain "make".
>
> ../../parrot -o TGE/Tree.pbc --output-pbc TGE/Tree.pir
> ../../parrot -o ../../runtime/parrot/library/TGE.pbc --output-pbc TGE.pir
> make -C compilers/nqp
> ../../parrot
> /opt/src/perl6/build-20080421-b/runtime/parrot/library/PGE/Perl6Grammar.pir
> \
> --output=src/Grammar_gen.pir src/Grammar.pg
> make[1]: *** [nqp.pbc] Bus error
> make: *** [compilers.dummy] Error 2
> herodotus:build-20080421-b seneca$
>
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_PROTECTION_FAILURE at address: 0x00000019
> 0x0069092c in pobject_lives (interp=0x1709de0, obj=0x11) at
> src/gc/dod.c:190 190 if (PObj_is_live_or_free_TESTALL(obj))
> (gdb) bt
> #0 0x0069092c in pobject_lives (interp=0x1709de0, obj=0x11) at
> src/gc/dod.c:190 #1 0x006e09dc in mark_stack (interp=0x1709de0,
> chunk=0x11) at src/stacks.c:66 #2 0x00850340 in Parrot_Continuation_mark
> (interp=0x1709de0,
> pmc=0x248f3e0) at continuation.pmc:89
chunk should never be 0x11. Does this patch fix things for you?
If not, you might set a watchpoint on cc->dynamic_state to see when it gets
set to 0x11, as that'll show where we have a pointer go awry. (I fear that
it may be one of the PMC_int_val( xxx )++ or -- bits in stack_push or
stack_pop.)
-- c
=== src/pmc/continuation.pmc
==================================================================
--- src/pmc/continuation.pmc (revision 27098)
+++ src/pmc/continuation.pmc (local)
@@ -111,6 +111,10 @@
#endif
if (cc->from_ctx)
Parrot_free_context(interp, cc->from_ctx, 0);
+
+ if (cc->dynamic_state)
+ PMC_int_val((PObj *)cc->dynamic_state)--;
+
mem_sys_free(cc);
PMC_struct_val(SELF) = NULL;
}
@@ -136,6 +140,8 @@
PMC_struct_val(ret) = cc;
PMC_pmc_val(ret) = PMC_pmc_val(SELF);
+ PMC_int_val((PObj *)cc->dynamic_state)++;
+
return ret;
}
@@ -174,6 +180,8 @@
cc->dynamic_state = INTERP->dynamic_env;
cc->runloop_id = INTERP->current_runloop_id;
+ PMC_int_val((PObj *)cc->dynamic_state)++;
+
if (pos && (*pos == PARROT_OP_get_results_pc))
cc->current_results = pos;
else