538 } |
538 } |
539 } else if (nm->is_not_entrant()) { |
539 } else if (nm->is_not_entrant()) { |
540 // If there are no current activations of this method on the |
540 // If there are no current activations of this method on the |
541 // stack we can safely convert it to a zombie method |
541 // stack we can safely convert it to a zombie method |
542 if (nm->can_not_entrant_be_converted()) { |
542 if (nm->can_not_entrant_be_converted()) { |
543 if (PrintMethodFlushing && Verbose) { |
|
544 tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), nm); |
|
545 } |
|
546 // Clear ICStubs to prevent back patching stubs of zombie or unloaded |
543 // Clear ICStubs to prevent back patching stubs of zombie or unloaded |
547 // nmethods during the next safepoint (see ICStub::finalize). |
544 // nmethods during the next safepoint (see ICStub::finalize). |
548 MutexLocker cl(CompiledIC_lock); |
545 { |
549 nm->clear_ic_stubs(); |
546 MutexLocker cl(CompiledIC_lock); |
550 // Code cache state change is tracked in make_zombie() |
547 nm->clear_ic_stubs(); |
551 nm->make_zombie(); |
548 } |
552 _zombified_count++; |
549 // Acquiring the CompiledIC_lock may block for a safepoint and set the |
553 SWEEP(nm); |
550 // nmethod to zombie (see 'CodeCache::make_marked_nmethods_zombies'). |
|
551 // Check if nmethod is still non-entrant at this point. |
|
552 if (nm->is_not_entrant()) { |
|
553 if (PrintMethodFlushing && Verbose) { |
|
554 tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), nm); |
|
555 } |
|
556 // Code cache state change is tracked in make_zombie() |
|
557 nm->make_zombie(); |
|
558 _zombified_count++; |
|
559 SWEEP(nm); |
|
560 } |
|
561 assert(nm->is_zombie(), "nmethod must be zombie"); |
554 } else { |
562 } else { |
555 // Still alive, clean up its inline caches |
563 // Still alive, clean up its inline caches |
556 MutexLocker cl(CompiledIC_lock); |
564 MutexLocker cl(CompiledIC_lock); |
557 nm->cleanup_inline_caches(); |
565 nm->cleanup_inline_caches(); |
558 SWEEP(nm); |
566 SWEEP(nm); |