comparison src/share/vm/code/nmethod.cpp @ 14435:da862781b584

Merge
author kvn
date Thu, 21 Nov 2013 12:30:35 -0800
parents 2b8e28fdf503 78da3894b86f
children 4cdf4f71177d
comparison
equal deleted inserted replaced
14434:318d0622a6d7 14435:da862781b584
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
1260 // The Method* is gone at this point 1257 // The Method* is gone at this point
1261 assert(_method == NULL, "Tautology"); 1258 assert(_method == NULL, "Tautology");
1262 1259
1263 set_osr_link(NULL); 1260 set_osr_link(NULL);
1264 //set_scavenge_root_link(NULL); // done by prune_scavenge_root_nmethods 1261 //set_scavenge_root_link(NULL); // done by prune_scavenge_root_nmethods
1265 NMethodSweeper::notify(); 1262 NMethodSweeper::report_state_change(this);
1266 } 1263 }
1267 1264
1268 void nmethod::invalidate_osr_method() { 1265 void nmethod::invalidate_osr_method() {
1269 assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); 1266 assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod");
1270 // Remove from list of active nmethods 1267 // Remove from list of active nmethods
1294 if (PrintCompilation && _state != unloaded) { 1291 if (PrintCompilation && _state != unloaded) {
1295 print_on(tty, _state == zombie ? "made zombie" : "made not entrant"); 1292 print_on(tty, _state == zombie ? "made zombie" : "made not entrant");
1296 } 1293 }
1297 } 1294 }
1298 1295
1299 // Common functionality for both make_not_entrant and make_zombie 1296 /**
1297 * Common functionality for both make_not_entrant and make_zombie
1298 */
1300 bool nmethod::make_not_entrant_or_zombie(unsigned int state) { 1299 bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
1301 assert(state == zombie || state == not_entrant, "must be zombie or not_entrant"); 1300 assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
1302 assert(!is_zombie(), "should not already be a zombie"); 1301 assert(!is_zombie(), "should not already be a zombie");
1303 1302
1304 // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below. 1303 // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
1418 1417
1419 if (TraceCreateZombies) { 1418 if (TraceCreateZombies) {
1420 tty->print_cr("nmethod <" INTPTR_FORMAT "> code made %s", this, (state == not_entrant) ? "not entrant" : "zombie"); 1419 tty->print_cr("nmethod <" INTPTR_FORMAT "> code made %s", this, (state == not_entrant) ? "not entrant" : "zombie");
1421 } 1420 }
1422 1421
1423 // Make sweeper aware that there is a zombie method that needs to be removed 1422 NMethodSweeper::report_state_change(this);
1424 NMethodSweeper::notify();
1425
1426 return true; 1423 return true;
1427 } 1424 }
1428 1425
1429 void nmethod::flush() { 1426 void nmethod::flush() {
1430 // Note that there are no valid oops in the nmethod anymore. 1427 // Note that there are no valid oops in the nmethod anymore.
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()) {