On Tue Jul 05 17:51:46 2016, ug...@cpan.org wrote: > Note that the final decode-base64 candidate shows the correct results > when debugging statements are added > > This gist also shows a small change that makes it produce the correct > values but it still segfaults more often than not > https://gist.github.com/ugexe/baa168a641894a0731595c812724f76d
Having dug into it a little, I'm not sure that the new multi-caching stuff has caused this, so much as uncovered it (perhaps by moving GC collection points). The valgrind output is as follows: ok 1 - decoding the empty string ok 2 - decoding "A" not ok 3 - decoding "Ab" # Failed test 'decoding "Ab"' # at t/01-basic.t line 29 # expected: 'Ab' # got: 'A' not ok 4 - decoding "Abc" # Failed test 'decoding "Abc"' # at t/01-basic.t line 30 # expected: 'Abc' # got: 'A' ==19699== Invalid read of size 8 ==19699== at 0x4FF2B3E: gc_mark (MVMCallCapture.c:51) ==19699== by 0x4FC6BF5: process_worklist (collect.c:313) ==19699== by 0x4FC71A0: MVM_gc_collect (collect.c:129) ==19699== by 0x4FC2735: run_gc (orchestrate.c:304) ==19699== by 0x4FC320D: MVM_gc_enter_from_allocator (orchestrate.c:438) ==19699== by 0x4FC3627: MVM_gc_allocate_nursery (allocation.c:32) ==19699== by 0x4FC39ED: MVM_gc_allocate_frame (allocation.c:99) ==19699== by 0x4FA749F: MVM_frame_force_to_heap (frame.c:657) ==19699== by 0x4FA8BEB: MVM_frame_capturelex (frame.c:1035) ==19699== by 0x4F98D8F: MVM_interp_run (interp.c:1070) ==19699== by 0x505E3F8: MVM_vm_run_file (moar.c:304) ==19699== by 0x401036: main (main.c:191) ==19699== Address 0x658f9d0 is 0 bytes inside a block of size 32 free'd ==19699== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==19699== by 0x4FF2CDA: MVM_free (alloc.h:29) ==19699== by 0x4FF2CDA: gc_free (MVMCallCapture.c:78) ==19699== by 0x4FC72D3: MVM_gc_collect_free_nursery_uncopied (collect.c:580) ==19699== by 0x4FC2976: run_gc (orchestrate.c:328) ==19699== by 0x4FC320D: MVM_gc_enter_from_allocator (orchestrate.c:438) ==19699== by 0x4FC3627: MVM_gc_allocate_nursery (allocation.c:32) ==19699== by 0x4FC39ED: MVM_gc_allocate_frame (allocation.c:99) ==19699== by 0x4FA749F: MVM_frame_force_to_heap (frame.c:657) ==19699== by 0x4FA8D4C: MVM_frame_takeclosure (frame.c:1051) ==19699== by 0xEA66105: ??? ==19699== by 0x50342B8: MVM_jit_enter_code (compile.c:136) ==19699== by 0x4F938F0: MVM_interp_run (interp.c:5456) ==19699== ==19699== Invalid read of size 1 ==19699== at 0x4FF2A7D: gc_mark (MVMCallCapture.c:55) ==19699== by 0x4FC6BF5: process_worklist (collect.c:313) ==19699== by 0x4FC71A0: MVM_gc_collect (collect.c:129) ==19699== by 0x4FC2735: run_gc (orchestrate.c:304) ==19699== by 0x4FC320D: MVM_gc_enter_from_allocator (orchestrate.c:438) ==19699== by 0x4FC3627: MVM_gc_allocate_nursery (allocation.c:32) ==19699== by 0x4FC39ED: MVM_gc_allocate_frame (allocation.c:99) ==19699== by 0x4FA749F: MVM_frame_force_to_heap (frame.c:657) ==19699== by 0x4FA8BEB: MVM_frame_capturelex (frame.c:1035) ==19699== by 0x4F98D8F: MVM_interp_run (interp.c:1070) ==19699== by 0x505E3F8: MVM_vm_run_file (moar.c:304) ==19699== by 0x401036: main (main.c:191) ==19699== Address 0xb36cc70 is 0 bytes inside a block of size 1 free'd ==19699== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==19699== by 0x4FF2CD1: MVM_free (alloc.h:29) ==19699== by 0x4FF2CD1: gc_free (MVMCallCapture.c:77) ==19699== by 0x4FC72D3: MVM_gc_collect_free_nursery_uncopied (collect.c:580) ==19699== by 0x4FC2976: run_gc (orchestrate.c:328) ==19699== by 0x4FC320D: MVM_gc_enter_from_allocator (orchestrate.c:438) ==19699== by 0x4FC3627: MVM_gc_allocate_nursery (allocation.c:32) ==19699== by 0x4FC39ED: MVM_gc_allocate_frame (allocation.c:99) ==19699== by 0x4FA749F: MVM_frame_force_to_heap (frame.c:657) ==19699== by 0x4FA8D4C: MVM_frame_takeclosure (frame.c:1051) ==19699== by 0xEA66105: ??? ==19699== by 0x50342B8: MVM_jit_enter_code (compile.c:136) ==19699== by 0x4F938F0: MVM_interp_run (interp.c:5456) ==19699== not ok 5 - decoding "Abcd" Which is suggestive of some kind of memory corruption (seemingly due to over-sharing or a premature free) inside of the argument capture. Still trying to figure out exactly what leads to this.