1692
1693 // Ensure that all metadata is still alive
1694 verify_metadata_loaders(low_boundary, is_alive);
1695 }
1696
1697 template <class CompiledICorStaticCall>
1698 static bool clean_if_nmethod_is_unloaded(CompiledICorStaticCall *ic, address addr, BoolObjectClosure *is_alive, nmethod* from) {
1699 // Ok, to lookup references to zombies here
1700 CodeBlob *cb = CodeCache::find_blob_unsafe(addr);
1701 if (cb != NULL && cb->is_nmethod()) {
1702 nmethod* nm = (nmethod*)cb;
1703
1704 if (nm->unloading_clock() != nmethod::global_unloading_clock()) {
1705 // The nmethod has not been processed yet.
1706 return true;
1707 }
1708
1709 // Clean inline caches pointing to both zombie and not_entrant methods
1710 if (!nm->is_in_use() || (nm->method()->code() != nm)) {
1711 ic->set_to_clean();
1712 assert(ic->is_clean(), err_msg("nmethod " PTR_FORMAT "not clean %s", from, from->method()->name_and_sig_as_C_string()));
1713 }
1714 }
1715
1716 return false;
1717 }
1718
1719 static bool clean_if_nmethod_is_unloaded(CompiledIC *ic, BoolObjectClosure *is_alive, nmethod* from) {
1720 return clean_if_nmethod_is_unloaded(ic, ic->ic_destination(), is_alive, from);
1721 }
1722
1723 static bool clean_if_nmethod_is_unloaded(CompiledStaticCall *csc, BoolObjectClosure *is_alive, nmethod* from) {
1724 return clean_if_nmethod_is_unloaded(csc, csc->destination(), is_alive, from);
1725 }
1726
1727 bool nmethod::unload_if_dead_at(RelocIterator* iter_at_oop, BoolObjectClosure *is_alive, bool unloading_occurred) {
1728 assert(iter_at_oop->type() == relocInfo::oop_type, "Wrong relocation type");
1729
1730 oop_Relocation* r = iter_at_oop->oop_reloc();
1731 // Traverse those oops directly embedded in the code.
1732 // Other oops (oop_index>0) are seen as part of scopes_oops.
2523 }
2524 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
2525 };
2526
2527 void nmethod::verify() {
2528
2529 // Hmm. OSR methods can be deopted but not marked as zombie or not_entrant
2530 // seems odd.
2531
2532 if (is_zombie() || is_not_entrant() || is_unloaded())
2533 return;
2534
2535 // Make sure all the entry points are correctly aligned for patching.
2536 NativeJump::check_verified_entry_alignment(entry_point(), verified_entry_point());
2537
2538 // assert(method()->is_oop(), "must be valid");
2539
2540 ResourceMark rm;
2541
2542 if (!CodeCache::contains(this)) {
2543 fatal(err_msg("nmethod at " INTPTR_FORMAT " not in zone", this));
2544 }
2545
2546 if(is_native_method() )
2547 return;
2548
2549 nmethod* nm = CodeCache::find_nmethod(verified_entry_point());
2550 if (nm != this) {
2551 fatal(err_msg("findNMethod did not find this nmethod (" INTPTR_FORMAT ")",
2552 this));
2553 }
2554
2555 for (PcDesc* p = scopes_pcs_begin(); p < scopes_pcs_end(); p++) {
2556 if (! p->verify(this)) {
2557 tty->print_cr("\t\tin nmethod at " INTPTR_FORMAT " (pcs)", this);
2558 }
2559 }
2560
2561 VerifyOopsClosure voc(this);
2562 oops_do(&voc);
2563 assert(voc.ok(), "embedded oops must be OK");
2564 verify_scavenge_root_oops();
2565
2566 verify_scopes();
2567 }
2568
2569
2570 void nmethod::verify_interrupt_point(address call_site) {
2571 // Verify IC only when nmethod installation is finished.
2572 bool is_installed = (method()->code() == this) // nmethod is in state 'in_use' and installed
|
1692
1693 // Ensure that all metadata is still alive
1694 verify_metadata_loaders(low_boundary, is_alive);
1695 }
1696
1697 template <class CompiledICorStaticCall>
1698 static bool clean_if_nmethod_is_unloaded(CompiledICorStaticCall *ic, address addr, BoolObjectClosure *is_alive, nmethod* from) {
1699 // Ok, to lookup references to zombies here
1700 CodeBlob *cb = CodeCache::find_blob_unsafe(addr);
1701 if (cb != NULL && cb->is_nmethod()) {
1702 nmethod* nm = (nmethod*)cb;
1703
1704 if (nm->unloading_clock() != nmethod::global_unloading_clock()) {
1705 // The nmethod has not been processed yet.
1706 return true;
1707 }
1708
1709 // Clean inline caches pointing to both zombie and not_entrant methods
1710 if (!nm->is_in_use() || (nm->method()->code() != nm)) {
1711 ic->set_to_clean();
1712 assert(ic->is_clean(), "nmethod " PTR_FORMAT "not clean %s", from, from->method()->name_and_sig_as_C_string());
1713 }
1714 }
1715
1716 return false;
1717 }
1718
1719 static bool clean_if_nmethod_is_unloaded(CompiledIC *ic, BoolObjectClosure *is_alive, nmethod* from) {
1720 return clean_if_nmethod_is_unloaded(ic, ic->ic_destination(), is_alive, from);
1721 }
1722
1723 static bool clean_if_nmethod_is_unloaded(CompiledStaticCall *csc, BoolObjectClosure *is_alive, nmethod* from) {
1724 return clean_if_nmethod_is_unloaded(csc, csc->destination(), is_alive, from);
1725 }
1726
1727 bool nmethod::unload_if_dead_at(RelocIterator* iter_at_oop, BoolObjectClosure *is_alive, bool unloading_occurred) {
1728 assert(iter_at_oop->type() == relocInfo::oop_type, "Wrong relocation type");
1729
1730 oop_Relocation* r = iter_at_oop->oop_reloc();
1731 // Traverse those oops directly embedded in the code.
1732 // Other oops (oop_index>0) are seen as part of scopes_oops.
2523 }
2524 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
2525 };
2526
2527 void nmethod::verify() {
2528
2529 // Hmm. OSR methods can be deopted but not marked as zombie or not_entrant
2530 // seems odd.
2531
2532 if (is_zombie() || is_not_entrant() || is_unloaded())
2533 return;
2534
2535 // Make sure all the entry points are correctly aligned for patching.
2536 NativeJump::check_verified_entry_alignment(entry_point(), verified_entry_point());
2537
2538 // assert(method()->is_oop(), "must be valid");
2539
2540 ResourceMark rm;
2541
2542 if (!CodeCache::contains(this)) {
2543 fatal("nmethod at " INTPTR_FORMAT " not in zone", this);
2544 }
2545
2546 if(is_native_method() )
2547 return;
2548
2549 nmethod* nm = CodeCache::find_nmethod(verified_entry_point());
2550 if (nm != this) {
2551 fatal("findNMethod did not find this nmethod (" INTPTR_FORMAT ")", this);
2552 }
2553
2554 for (PcDesc* p = scopes_pcs_begin(); p < scopes_pcs_end(); p++) {
2555 if (! p->verify(this)) {
2556 tty->print_cr("\t\tin nmethod at " INTPTR_FORMAT " (pcs)", this);
2557 }
2558 }
2559
2560 VerifyOopsClosure voc(this);
2561 oops_do(&voc);
2562 assert(voc.ok(), "embedded oops must be OK");
2563 verify_scavenge_root_oops();
2564
2565 verify_scopes();
2566 }
2567
2568
2569 void nmethod::verify_interrupt_point(address call_site) {
2570 // Verify IC only when nmethod installation is finished.
2571 bool is_installed = (method()->code() == this) // nmethod is in state 'in_use' and installed
|