bool PyrGC::SanityCheck() { if (!mRunning) return true; //postfl("PyrGC::SanityCheck\n"); bool res = LinkSanity() && ListSanity() // && SanityMarkObj((PyrObject*)mProcess,NULL,0) && SanityMarkObj(mStack,NULL,0) // && SanityClearObj((PyrObject*)mProcess,0) && SanityClearObj(mStack,0) && SanityCheck2() ; //if (!res) DumpInfo(); //if (!res) Debugger(); return res; }
int SanityCheck2(Heap * h) { int sum; Heap * h1; Heap * h2; if(h == NULL_HEAP) { return(TRUE); } h1 = h; do { if(CHILD(h1) != NULL_HEAP) { sum = 0; h2 = CHILD(h1); do { sum += RANK(h2) + 1; h2 = FORWARD(h2); } while(h2 != CHILD(h1)); if(sum != RANK(h1)) { return(FALSE); } if(!SanityCheck2(CHILD(h1))) { return(FALSE); } } h1 = FORWARD(h1); } while(h1 != h); return(TRUE); }