Ticket #8209: assert.patch

File assert.patch, 1.3 KB (added by akio, 2 years ago)

adds an ASSERT

  • rts/Capability.c

    diff --git a/rts/Capability.c b/rts/Capability.c
    index 811df58..c789af6 100644
    a b initCapability( Capability *cap, nat i ) 
    249249    cap->spark_stats.converted  = 0;
    250250    cap->spark_stats.gcd        = 0;
    251251    cap->spark_stats.fizzled    = 0;
     252    cap->sanity = 1;
    252253#endif
    253254    cap->total_allocated        = 0;
    254255
    moreCapabilities (nat from USED_IF_THREADS, nat to USED_IF_THREADS) 
    354355
    355356        if (from > 0) {
    356357            memcpy(capabilities, old_capabilities, from * sizeof(Capability));
     358            for (i = 0; i < from; i++) {
     359                old_capabilities[i].sanity = 0;
     360            }
    357361        }
    358362    }
    359363
    waitForReturnCapability (Capability **pCap, Task *task) 
    628632
    629633    debugTrace(DEBUG_sched, "returning; I want capability %d", cap->no);
    630634
     635    write_barrier();
     636    ASSERT(cap->sanity);
     637
    631638    if (!cap->running_task) {
    632639        // It's free; just grab it
    633640        cap->running_task = task;
  • rts/Capability.h

    diff --git a/rts/Capability.h b/rts/Capability.h
    index 3348f88..f881a48 100644
    a b struct Capability_ { 
    121121
    122122    // Stats on spark creation/conversion
    123123    SparkCounters spark_stats;
     124
     125    int sanity;
    124126#endif
    125127    // Total words allocated by this cap since rts start
    126128    W_ total_allocated;