changeset 10516:d7915089dde3

8152861: VM crash on assert: locked methods shouldn't be flushed Summary: Check if nmethod is locked by JVMTI before flushing. Reviewed-by: kvn
author thartmann
date Wed, 30 Mar 2016 08:04:59 +0200
parents 1dac19bbc173
children a264a8ff29b0
files src/share/vm/runtime/sweeper.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/sweeper.cpp	Wed Mar 30 08:00:51 2016 +0200
+++ b/src/share/vm/runtime/sweeper.cpp	Wed Mar 30 08:04:59 2016 +0200
@@ -631,7 +631,10 @@
       // Code cache state change is tracked in make_zombie()
       nm->make_zombie();
       SWEEP(nm);
-      if (nm->is_osr_method()) {
+      // The nmethod may have been locked by JVMTI after being made zombie (see
+      // JvmtiDeferredEvent::compiled_method_unload_event()). If so, we cannot
+      // flush the osr nmethod directly but have to wait for a later sweeper cycle.
+      if (nm->is_osr_method() && !nm->is_locked_by_vm()) {
         // No inline caches will ever point to osr methods, so we can just remove it.
         // Make sure that we unregistered the nmethod with the heap and flushed all
         // dependencies before removing the nmethod (done in make_zombie()).