diff options
Diffstat (limited to 'src/share/vm/runtime/sweeper.cpp')
-rw-r--r-- | src/share/vm/runtime/sweeper.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/share/vm/runtime/sweeper.cpp b/src/share/vm/runtime/sweeper.cpp index 4eba81deb..b4954ff86 100644 --- a/src/share/vm/runtime/sweeper.cpp +++ b/src/share/vm/runtime/sweeper.cpp @@ -538,10 +538,14 @@ int NMethodSweeper::process_nmethod(nmethod *nm) { } else if (nm->is_not_entrant()) { // If there are no current activations of this method on the // stack we can safely convert it to a zombie method - if (nm->can_not_entrant_be_converted()) { + if (nm->can_convert_to_zombie()) { if (PrintMethodFlushing && Verbose) { tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), nm); } + // Clear ICStubs to prevent back patching stubs of zombie or unloaded + // nmethods during the next safepoint (see ICStub::finalize). + MutexLocker cl(CompiledIC_lock); + nm->clear_ic_stubs(); // Code cache state change is tracked in make_zombie() nm->make_zombie(); _zombified_count++; @@ -567,6 +571,12 @@ int NMethodSweeper::process_nmethod(nmethod *nm) { release_nmethod(nm); _flushed_count++; } else { + { + // Clean ICs of unloaded nmethods as well because they may reference other + // unloaded nmethods that may be flushed earlier in the sweeper cycle. + MutexLocker cl(CompiledIC_lock); + nm->cleanup_inline_caches(); + } // Code cache state change is tracked in make_zombie() nm->make_zombie(); _zombified_count++; |