Ticket #1393: tt_1393_debug_changes3.diff

File tt_1393_debug_changes3.diff, 4.6 KB (added by lithos, 5 years ago)

changes used to reproduce and diagnose jkeenan's test fail

  • src/ops/object.ops

     
    140140        PObj_get_FLAGS(interp->current_cont) |= SUB_FLAG_TAILCALL; 
    141141        /* Detach continuation from current CallContext to avoid marking dead object. */ 
    142142        /* RetContinuation will kill itself after invoke */ 
     143fprintf(stderr, "tailcallmethod PMC STR %d %d\n", 
     144        (interp->current_cont->vtable->base_type == enum_class_RetContinuation), 
     145        Parrot_pcc_do_run_ops(interp, method_pmc)); 
    143146        if (interp->current_cont->vtable->base_type == enum_class_RetContinuation 
    144147            && Parrot_pcc_do_run_ops(interp, method_pmc)) { 
    145148            PMC * const ctx             = CURRENT_CONTEXT(interp); 
     
    148151            Parrot_pcc_set_continuation(interp, ctx, PMCNULL); 
    149152        } 
    150153        interp->current_object = object; 
     154fprintf(stderr, "tailcallmethod PMC STR invoking with continuation %p\n", 
     155        (void*)interp->current_cont); 
    151156        dest = (opcode_t *)VTABLE_invoke(interp, method_pmc, next); 
    152157    } 
    153158    goto ADDRESS(dest); 
  • src/pmc/retcontinuation.pmc

     
    8484 
    8585        /* recycle this PMC and make sure it doesn't get marked */ 
    8686        if (!PMC_IS_NULL(from_ctx)) 
     87        { 
     88            fprintf(stderr,"%s:%d: resetting continuation (SELF=%p) in context %p\n", 
     89                    __FILE__, __LINE__, (void*)SELF, (void*)from_ctx); 
    8790            Parrot_pcc_set_continuation(interp, from_ctx, NULL); 
     91        } 
     92        fprintf(stderr,"%s:%d: freeing myself (SELF=%p)\n", 
     93                __FILE__, __LINE__, (void*)SELF); 
    8894        Parrot_gc_free_pmc_header(interp, SELF); 
     95        Parrot_gc_mark_and_sweep(interp, 0); 
    8996 
    9097        if (INTERP->code != seg) 
    9198            Parrot_switch_to_cs(INTERP, seg, 1); 
  • src/pmc/sub.pmc

     
    2121#include "parrot/oplib/ops.h" 
    2222#include "sub.str" 
    2323 
     24static unsigned debug_counter = 0; 
     25 
    2426static void 
    2527print_sub_name(PARROT_INTERP, ARGIN_NULLOK(PMC *sub)) 
    2628{ 
     
    395397        Parrot_pcc_init_context(INTERP, context, caller_ctx); 
    396398 
    397399        Parrot_pcc_set_sub(interp, context, SELF); 
     400        fprintf(stderr, "%d: %s:%d: setting continuation %p in context %p\n", 
     401                debug_counter++, __FILE__, __LINE__, (void*)ccont, (void*)context); 
     402#if 0 
     403        if (debug_counter-1 == 2515) 
     404            abort(); 
     405#endif 
    398406        Parrot_pcc_set_continuation(interp, context, ccont); 
    399407        Parrot_pcc_set_constants(interp, context, sub->seg->const_table->constants); 
    400408 
  • src/gc/api.c

     
    242242{ 
    243243    ASSERT_ARGS(Parrot_gc_mark_PMC_alive_fun) 
    244244    if (!PMC_IS_NULL(obj)) { 
     245        if (!PObj_is_PMC_TEST(obj)) 
     246            fprintf(stderr, "object at %p is not a PMC\n", (void*)obj); 
    245247        PARROT_ASSERT(PObj_is_PMC_TEST(obj)); 
    246248 
    247249        if (PObj_is_live_or_free_TESTALL(obj)) 
  • src/sub.c

     
    6666    ASSERT_ARGS(new_ret_continuation_pmc) 
    6767    PMC* const continuation = pmc_new(interp, enum_class_RetContinuation); 
    6868    VTABLE_set_pointer(interp, continuation, address); 
     69    fprintf(stderr, "new ret continuation %p\n", (void*)continuation); 
    6970    return continuation; 
    7071} 
    7172 
  • src/call/context_accessors.c

     
    1616 
    1717#include "parrot/parrot.h" 
    1818 
     19static unsigned debug_counter = 0; 
     20 
    1921/* HEADERIZER HFILE: include/parrot/context.h */ 
    2022 
    2123/* HEADERIZER BEGIN: static */ 
     
    371373Parrot_pcc_set_continuation_func(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN_NULLOK(PMC *_continuation)) 
    372374{ 
    373375    ASSERT_ARGS(Parrot_pcc_set_continuation_func) 
     376    if (_continuation && _continuation->vtable->base_type == enum_class_RetContinuation) 
     377    { 
     378        fprintf(stderr, "%d: setting continuation %p in context %p\n", 
     379                debug_counter++, (void*)_continuation, (void*)ctx); 
     380    } 
    374381    Parrot_Context *c = get_context_struct_fast(interp, ctx); 
    375382    c->current_cont = _continuation; 
    376383}