src/share/vm/code/nmethod.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot-comp Cdiff src/share/vm/code/nmethod.cpp

src/share/vm/code/nmethod.cpp

Print this page
rev 5618 : 8023037: Race between ciEnv::register_method and nmethod::make_not_entrant_or_zombie
Reviewed-by: ?

*** 624,634 **** Disassembler::decode(nm); } } // verify nmethod ! debug_only(if (nm) nm->verify();) // might block if (nm != NULL) { nm->log_new_nmethod(); } --- 624,634 ---- Disassembler::decode(nm); } } // verify nmethod ! debug_only(if (nm != NULL) nm->verify(/*allow_safepoints=*/ false);) if (nm != NULL) { nm->log_new_nmethod(); }
*** 2349,2359 **** (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm)); } virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } }; ! void nmethod::verify() { // Hmm. OSR methods can be deopted but not marked as zombie or not_entrant // seems odd. if( is_zombie() || is_not_entrant() ) --- 2349,2359 ---- (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm)); } virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } }; ! void nmethod::verify(bool allow_safepoints) { // Hmm. OSR methods can be deopted but not marked as zombie or not_entrant // seems odd. if( is_zombie() || is_not_entrant() )
*** 2388,2414 **** VerifyOopsClosure voc(this); oops_do(&voc); assert(voc.ok(), "embedded oops must be OK"); verify_scavenge_root_oops(); ! verify_scopes(); } ! void nmethod::verify_interrupt_point(address call_site) { ! // This code does not work in release mode since ! // owns_lock only is available in debug mode. CompiledIC* ic = NULL; Thread *cur = Thread::current(); if (CompiledIC_lock->owner() == cur || ((cur->is_VM_thread() || cur->is_ConcurrentGC_thread()) && SafepointSynchronize::is_at_safepoint())) { ic = CompiledIC_at(this, call_site); CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); ! } else { MutexLocker ml_verify (CompiledIC_lock); ic = CompiledIC_at(this, call_site); } PcDesc* pd = pc_desc_at(ic->end_of_call()); assert(pd != NULL, "PcDesc must exist"); for (ScopeDesc* sd = new ScopeDesc(this, pd->scope_decode_offset(), pd->obj_decode_offset(), pd->should_reexecute(), --- 2388,2417 ---- VerifyOopsClosure voc(this); oops_do(&voc); assert(voc.ok(), "embedded oops must be OK"); verify_scavenge_root_oops(); ! verify_scopes(allow_safepoints); } ! void nmethod::verify_interrupt_point(address call_site, bool allow_safepoints) { CompiledIC* ic = NULL; Thread *cur = Thread::current(); if (CompiledIC_lock->owner() == cur || ((cur->is_VM_thread() || cur->is_ConcurrentGC_thread()) && SafepointSynchronize::is_at_safepoint())) { ic = CompiledIC_at(this, call_site); CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); ! } else if (allow_safepoints) { MutexLocker ml_verify (CompiledIC_lock); ic = CompiledIC_at(this, call_site); + } else { + // CompiledIC verification requires CompiledIC_lock, but there's no way + // to grab it when safepoints are forbidden. Attempts to grab CompiledIC_lock + // w/o safepoint checks lead to deadlocks. + return; } PcDesc* pd = pc_desc_at(ic->end_of_call()); assert(pd != NULL, "PcDesc must exist"); for (ScopeDesc* sd = new ScopeDesc(this, pd->scope_decode_offset(), pd->obj_decode_offset(), pd->should_reexecute(),
*** 2416,2440 **** !sd->is_top(); sd = sd->sender()) { sd->verify(); } } ! void nmethod::verify_scopes() { if( !method() ) return; // Runtime stubs have no scope if (method()->is_native()) return; // Ignore stub methods. // iterate through all interrupt point // and verify the debug information is valid. RelocIterator iter((nmethod*)this); while (iter.next()) { address stub = NULL; switch (iter.type()) { case relocInfo::virtual_call_type: ! verify_interrupt_point(iter.addr()); break; case relocInfo::opt_virtual_call_type: stub = iter.opt_virtual_call_reloc()->static_stub(); ! verify_interrupt_point(iter.addr()); break; case relocInfo::static_call_type: stub = iter.static_call_reloc()->static_stub(); //verify_interrupt_point(iter.addr()); break; --- 2419,2443 ---- !sd->is_top(); sd = sd->sender()) { sd->verify(); } } ! void nmethod::verify_scopes(bool allow_safepoints) { if( !method() ) return; // Runtime stubs have no scope if (method()->is_native()) return; // Ignore stub methods. // iterate through all interrupt point // and verify the debug information is valid. RelocIterator iter((nmethod*)this); while (iter.next()) { address stub = NULL; switch (iter.type()) { case relocInfo::virtual_call_type: ! verify_interrupt_point(iter.addr(), allow_safepoints); break; case relocInfo::opt_virtual_call_type: stub = iter.opt_virtual_call_reloc()->static_stub(); ! verify_interrupt_point(iter.addr(), allow_safepoints); break; case relocInfo::static_call_type: stub = iter.static_call_reloc()->static_stub(); //verify_interrupt_point(iter.addr()); break;
src/share/vm/code/nmethod.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File