diff src/share/vm/runtime/sweeper.cpp @ 23426:682119c4c32e

8058737: CodeCache::find_blob fails with 'unsafe access to zombie method' Summary: Remove active ICStubs from zombie nmethods Reviewed-by: kvn, iveresov
author thartmann
date Thu, 08 Oct 2015 09:37:23 +0200
parents ce8f6bb717c9
children be740540f60c
line wrap: on
line diff
--- a/src/share/vm/runtime/sweeper.cpp	Tue Oct 06 12:18:17 2015 +0200
+++ b/src/share/vm/runtime/sweeper.cpp	Thu Oct 08 09:37:23 2015 +0200
@@ -542,6 +542,10 @@
       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++;