comparison src/share/vm/code/nmethod.cpp @ 13071:e2509677809c

8023037: Race between ciEnv::register_method and nmethod::make_not_entrant_or_zombie Reviewed-by: kvn, iveresov
author vlivanov
date Fri, 08 Nov 2013 01:13:11 -0800
parents 268e7a2178d7
children 78da3894b86f
comparison
equal deleted inserted replaced
13047:be525e91f65b 13071:e2509677809c
616 } 616 }
617 617
618 // record this nmethod as dependent on this klass 618 // record this nmethod as dependent on this klass
619 InstanceKlass::cast(klass)->add_dependent_nmethod(nm); 619 InstanceKlass::cast(klass)->add_dependent_nmethod(nm);
620 } 620 }
621 } 621 NOT_PRODUCT(nmethod_stats.note_nmethod(nm));
622 NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_nmethod(nm)); 622 if (PrintAssembly) {
623 if (PrintAssembly && nm != NULL) { 623 Disassembler::decode(nm);
624 Disassembler::decode(nm); 624 }
625 } 625 }
626 } 626 }
627 627 // Do verification and logging outside CodeCache_lock.
628 // verify nmethod
629 debug_only(if (nm) nm->verify();) // might block
630
631 if (nm != NULL) { 628 if (nm != NULL) {
629 // Safepoints in nmethod::verify aren't allowed because nm hasn't been installed yet.
630 DEBUG_ONLY(nm->verify();)
632 nm->log_new_nmethod(); 631 nm->log_new_nmethod();
633 } 632 }
634
635 // done
636 return nm; 633 return nm;
637 } 634 }
638 635
639 636
640 // For native wrappers 637 // For native wrappers
2393 verify_scopes(); 2390 verify_scopes();
2394 } 2391 }
2395 2392
2396 2393
2397 void nmethod::verify_interrupt_point(address call_site) { 2394 void nmethod::verify_interrupt_point(address call_site) {
2398 // This code does not work in release mode since 2395 // Verify IC only when nmethod installation is finished.
2399 // owns_lock only is available in debug mode. 2396 bool is_installed = (method()->code() == this) // nmethod is in state 'alive' and installed
2400 CompiledIC* ic = NULL; 2397 || !this->is_in_use(); // nmethod is installed, but not in 'alive' state
2401 Thread *cur = Thread::current(); 2398 if (is_installed) {
2402 if (CompiledIC_lock->owner() == cur || 2399 Thread *cur = Thread::current();
2403 ((cur->is_VM_thread() || cur->is_ConcurrentGC_thread()) && 2400 if (CompiledIC_lock->owner() == cur ||
2404 SafepointSynchronize::is_at_safepoint())) { 2401 ((cur->is_VM_thread() || cur->is_ConcurrentGC_thread()) &&
2405 ic = CompiledIC_at(this, call_site); 2402 SafepointSynchronize::is_at_safepoint())) {
2406 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); 2403 CompiledIC_at(this, call_site);
2407 } else { 2404 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
2408 MutexLocker ml_verify (CompiledIC_lock); 2405 } else {
2409 ic = CompiledIC_at(this, call_site); 2406 MutexLocker ml_verify (CompiledIC_lock);
2410 } 2407 CompiledIC_at(this, call_site);
2411 PcDesc* pd = pc_desc_at(ic->end_of_call()); 2408 }
2409 }
2410
2411 PcDesc* pd = pc_desc_at(nativeCall_at(call_site)->return_address());
2412 assert(pd != NULL, "PcDesc must exist"); 2412 assert(pd != NULL, "PcDesc must exist");
2413 for (ScopeDesc* sd = new ScopeDesc(this, pd->scope_decode_offset(), 2413 for (ScopeDesc* sd = new ScopeDesc(this, pd->scope_decode_offset(),
2414 pd->obj_decode_offset(), pd->should_reexecute(), 2414 pd->obj_decode_offset(), pd->should_reexecute(),
2415 pd->return_oop()); 2415 pd->return_oop());
2416 !sd->is_top(); sd = sd->sender()) { 2416 !sd->is_top(); sd = sd->sender()) {