Index: src/ops/core.ops =================================================================== --- src/ops/core.ops (revision 43396) +++ src/ops/core.ops (working copy) @@ -467,6 +467,8 @@ Parrot_pcc_merge_signature_for_tailcall(interp, parent_call_sig, this_call_sig); SUB_FLAG_TAILCALL_SET(interp->current_cont); + fprintf(stderr, "%s:%d: tailcall sub %p with continuation %p\n", + __FILE__, __LINE__, (void*)p, (void*)interp->current_cont); dest = VTABLE_invoke(interp, p, dest); goto ADDRESS(dest); } Index: src/pmc/retcontinuation.pmc =================================================================== --- src/pmc/retcontinuation.pmc (revision 43396) +++ src/pmc/retcontinuation.pmc (working copy) @@ -84,7 +84,13 @@ /* recycle this PMC and make sure it doesn't get marked */ if (!PMC_IS_NULL(from_ctx)) + { + fprintf(stderr,"%s:%d: resetting continuation (SELF=%p) in context %p\n", + __FILE__, __LINE__, (void*)SELF, (void*)from_ctx); Parrot_pcc_set_continuation(interp, from_ctx, NULL); + } + fprintf(stderr,"%s:%d: freeing myself (SELF=%p)\n", + __FILE__, __LINE__, (void*)SELF); Parrot_gc_free_pmc_header(interp, SELF); if (INTERP->code != seg) Index: src/pmc/sub.pmc =================================================================== --- src/pmc/sub.pmc (revision 43396) +++ src/pmc/sub.pmc (working copy) @@ -21,6 +21,8 @@ #include "parrot/oplib/ops.h" #include "sub.str" +static unsigned debug_counter = 0; + static void print_sub_name(PARROT_INTERP, ARGIN_NULLOK(PMC *sub)) { @@ -379,8 +381,19 @@ ccont = INTERP->current_cont; INTERP->current_cont = NULL; + fprintf(stderr, "%d: %s:%d: sub %p invoked with ccont %p\n", + debug_counter++, __FILE__, __LINE__, (void*)SELF, (void*)ccont); + +#if 0 + if (debug_counter-1 == 1592) + abort(); +#endif + if (ccont == NEED_CONTINUATION) + { ccont = new_ret_continuation_pmc(interp, (opcode_t *)next); + fprintf(stderr, "created ret continuation %p\n", (void*)ccont); + } PARROT_ASSERT(!PMC_IS_NULL(ccont)); @@ -395,6 +408,8 @@ Parrot_pcc_init_context(INTERP, context, caller_ctx); Parrot_pcc_set_sub(interp, context, SELF); + fprintf(stderr, "%s:%d: setting continuation %p in context %p\n", + __FILE__, __LINE__, (void*)ccont, (void*)context); Parrot_pcc_set_continuation(interp, context, ccont); Parrot_pcc_set_constants(interp, context, sub->seg->const_table->constants); Index: src/gc/api.c =================================================================== --- src/gc/api.c (revision 43396) +++ src/gc/api.c (working copy) @@ -94,6 +94,8 @@ #include "parrot/gc_api.h" #include "gc_private.h" +static unsigned debug_counter = 0; + /* HEADERIZER HFILE: include/parrot/gc_api.h */ /* HEADERIZER BEGIN: static */ @@ -401,6 +403,13 @@ pmc->vtable = NULL; PMC_data(pmc) = NULL; + fprintf(stderr, "%d: created pmc %p\n", debug_counter++, (void*)pmc); + +#if 0 + if (debug_counter-1 == 28455) + abort(); +#endif + return pmc; } @@ -421,6 +430,13 @@ Fixed_Size_Pool * const pool = (PObj_constant_TEST(pmc)) ? interp->mem_pools->constant_pmc_pool : interp->mem_pools->pmc_pool; + fprintf(stderr, "%d: free pmc %p\n", debug_counter++, (void*)pmc); + +#if 0 + if (debug_counter-1 == 28480) + abort(); +#endif + Parrot_pmc_destroy(interp, pmc); PObj_flags_SETTO((PObj *)pmc, PObj_on_free_list_FLAG);