On Sun, Dec 15, 2013 at 02:30:14PM +0000, Nicholas Clark wrote: > I hacked up (somewhat literally) the attached 3 patches, to try to help > automate GC debugging for MoarVM. The intent is to be able to change how
Next mole to whack: $ gdb --args /home/nicholas/Sandpit/moar-g/bin/moar nqp.moarvm t/nqp/56-role.t ... Program received signal SIGSEGV, Segmentation fault. 0x00007ffff79e4752 in MVM_gc_collect_free_stables (tc=0x6023f0) at src/gc/collect.c:555 555 st = (MVMSTable *)st_to_free->header.forwarder; Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.107.el6.x86_64 (gdb) where #0 0x00007ffff79e4752 in MVM_gc_collect_free_stables (tc=0x6023f0) at src/gc/collect.c:555 #1 0x00007ffff79dc666 in MVM_gc_enter_from_allocator (tc=0x6023f0) at src/gc/orchestrate.c:373 #2 0x00007ffff79dc83a in MVM_gc_allocate_nursery (tc=0x6023f0, size=40) at src/gc/allocation.c:32 #3 0x00007ffff79dc8bf in MVM_gc_allocate_zeroed (tc=0x6023f0, size=40) at src/gc/allocation.c:49 #4 0x00007ffff79dcb02 in MVM_gc_allocate_object (tc=0x6023f0, st=0x603360) at src/gc/allocation.c:85 #5 0x00007ffff79fcc73 in allocate (tc=0x6023f0, st=0x603360) at src/6model/reprs/P6int.c:22 #6 0x00007ffff79a5998 in MVM_interp_run (tc=0x6023f0, initial_invoke=0x7ffff7a2faaf <toplevel_initial_invoke>, invoke_data=0x750000) at src/core/interp.c:2268 #7 0x00007ffff7a2fbdc in MVM_vm_run_file (instance=0x602010, filename=0x7fffffffe826 "nqp.moarvm") at src/moar.c:157 #8 0x0000000000400d2e in main (argc=3, argv=0x7fffffffe5a8) at src/main.c:137 (gdb) p st_to_free $1 = (MVMSTable *) 0x7ffff6a3a3c0(gdb) p st_to_free->header $2 = {owner = 0, flags = 2, size = 168, forwarder = 0x0, sc = 0x0} (gdb) p st_to_free $3 = (MVMSTable *) 0x7ffff6a3a3c0 (gdb) p tc->nursery_fromspace $4 = (void *) 0x7ffff6892000 (gdb) p tc->nursery_tospace $5 = (void *) 0x7ffff6a92000 So that's st_to_free in fromspace. Presumably it's the STABLE(type) here: OP(box_i): { MVMObject *type = GET_REG(cur_op, 4).o; MVMObject *box = REPR(type)->allocate(tc, STABLE(type)); MVMROOT(tc, box, { if (REPR(box)->initialize) REPR(box)->initialize(tc, STABLE(box), box, OBJECT_BODY(box)); REPR(box)->box_funcs.set_int(tc, STABLE(box), box, OBJECT_BODY(box), GET_REG(cur_op, 2).i64); GET_REG(cur_op, 0).o = box; }); cur_op += 6; goto NEXT; } (Again) I don't know what the correct fix is. Nicholas Clark