/* * Free memory * It may be called during interrupt disable. In this case, need to wait * until interrupt is enabled and until free. */ LOCAL void ifree( void *ptr, IMACB *imacb ) { QUEUE *aq; UW imask; DI(imask); /* Exclusive control by interrupt disable */ SpinLock(&MemLockObj); aq = (QUEUE*)ptr - 1; clrAreaFlag(aq, AREA_USE); if ( !chkAreaFlag(aq->next, AREA_END|AREA_USE) ) { /* Merge with free area in after location */ removeFreeQue(aq->next + 1); removeAreaQue(aq->next); } if ( !chkAreaFlag(aq, AREA_TOP) && !chkAreaFlag(aq->prev, AREA_USE) ) { /* Merge with free area in front location */ aq = aq->prev; removeFreeQue(aq + 1); removeAreaQue(aq->next); } /* If the whole page is free, then free the page. * However, do not free the page if it is called during * interrupt disabled. */ if ( !isDI(imask) && chkAreaFlag(aq, AREA_TOP) && chkAreaFlag(aq->next, AREA_END) ) { /* Free pages */ removeAreaQue(aq->next); removeAreaQue(aq); SpinUnlock(&MemLockObj); EI(imask); RelSysMemBlk(aq); DI(imask); SpinLock(&MemLockObj); } else { /* Register free area to FreeQue */ appendFreeArea(aq, imacb); } SpinUnlock(&MemLockObj); EI(imask); }
bool nmethod::verify() { bool r = true; ResourceMark rm; r &= OopNCode::verify2("nmethod"); if (insts() != (char*)(this + 1)) { error1("nmethod at 0x%lx has incorrect insts pointer", this); r = false; } if (!Memory->code->contains(this)) { error1("nmethod at 0x%lx not in zone", this); r = false; } if (!zoneLink.verify_list_integrity()) { lprintf("\tof zoneLink of nmethod 0x%lx\n", this); r = false; } { FOR_MY_CODETABLE_ENTRIES(e) if (e->nm != this) { error1("bad code table link for nmethod %#lx\n", this); r = false; } } bool isAligned = (frame_size & (frame_word_alignment-1)) == 0; if (!isAligned) { lprintf("nmethod at %#lx: frame size is not multiple of %d words\n", (long unsigned)this, frame_word_alignment); r = false; } if (codeTableLink != NULL) { nmethod *tableResult = isDebug() ? Memory->code->debugTable->lookup(key) : Memory->code->table ->lookup(key); if (tableResult != this) { error1("nmethod at %#lx: code table lookup failed", this); r = false; } } if (!key.verify()) { lprintf("\tof key of nmethod 0x%lx\n", this); r = false; } { FOR_MY_CODETABLE_ENTRIES(e) if (!e->key.verify()) { lprintf("\tof code table key %#lx of nmethod 0x%lx\n", (long unsigned)&e->key, (long unsigned)this); r = false; } } if (!linkedSends.verify_list_integrity()) { lprintf("\tof linkedSends of nmethod 0x%lx\n", this); r = false; } if (!diLink.verify_list_integrity()) { lprintf("\tof diLink of nmethod 0x%lx\n", this); r = false; } r &= scopes->verify(); for (PcDesc* p = pcs(); p < pcsEnd(); p++) { if (! p->verify(this)) { lprintf("\t\tin nmethod at %#lx (pcs)\n", this); r = false; } } // more checks in ncode::verify called above bool shouldBeDI = diLink.notEmpty(); for (addrDesc* l = locs(); l < locsEnd(); l++) { if (l->isDIDesc()) { shouldBeDI = true; } } if (shouldBeDI && !isDI()) { error1("nmethod %#lx should be marked isDI", this); r = false; } else if (!shouldBeDI && isDI()) { error1("nmethod %#lx should not be marked isDI", this); r = false; } if (! key.receiverMap()->is_block() ) { for (nmln* d = deps(); d < depsEnd(); d++) { if (! d->verify_list_integrity()) { lprintf("\tin nmethod at %#lx (deps)\n", this); r = false; } } } if (frame_chain != NoFrameChain) { error1("nmethod %#lx has non-zero frame chain value", this); r = false; } if (findNMethod( instsEnd() - oopSize) != this) { error1("findNMethod did not find this nmethod (%#lx)", this); r = false; } return r; }
void nmethod::print() { ResourceMark rm; printIndent(); lprintf("(nmethod*)%#lx", this); if (scopes->root()->isDataAccessScope()) { lprintf(" (data access)"); } else if (scopes->root()->isDataAssignmentScope()) { lprintf(" (data assignment)"); } else { lprintf(" for method %#lx", method()); } lprintf(" { "); if (isYoung()) lprintf("YOUNG "); switch (compiler()) { case NIC: lprintf("NIC "); if (isImpureNIC()) lprintf("impure "); break; case SIC: lprintf("SIC level %ld ", level()); break; default: lprintf("!?!unknown compiler!?! "); break; } if (version()) lprintf("v%d ", version()); if (isDI()) lprintf("DI "); if (isZombie()) lprintf("zombie "); if (isInvalid()) lprintf("INVALID "); if (isDebug()) lprintf("DEBUG "); if (isToBeRecompiled()) lprintf("TBR "); if (isUncommon() || isUncommonRecompiled()) lprintf("UNCOMMON "); lprintf("}:\n"); lprintf( "incoming_arg_count = %d\n", incoming_arg_count() ); print_platform_specific_data(); Indent ++; key.print(); printIndent(); lprintf("code table link: %#lx\n", codeTableLink); printIndent(); lprintf("remember link: "); rememberLink.print(); lprintf("\n"); printIndent(); lprintf("linked sends: "); linkedSends.print(); lprintf("\n"); printIndent(); lprintf("di link: "); diLink.print(); lprintf("\n"); printIndent(); lprintf("instructions (%ld bytes): %#lx,%#lx/i / x/%ldi %#lx\n", instsLen(), insts(), instsEnd() - oopSize, instsLen() / oopSize, insts()); printIndent(); lprintf("p ((nmethod*)%#lx)->printCode() \n", this); scopes->print(); // printLocs(); // printDeps(); Indent --; }