src/hotspot/share/interpreter/interpreterRuntime.cpp
changeset 47804 fa06ab2a0570
parent 47770 32d741a2b271
child 48555 9c56c953d8db
--- a/src/hotspot/share/interpreter/interpreterRuntime.cpp	Tue Nov 07 08:47:47 2017 +0100
+++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp	Tue Nov 07 14:13:18 2017 -0800
@@ -921,6 +921,14 @@
     int bci = method->bci_from(last_frame.bcp());
     nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false);
   }
+  if (nm != NULL && thread->is_interp_only_mode()) {
+    // Normally we never get an nm if is_interp_only_mode() is true, because
+    // policy()->event has a check for this and won't compile the method when
+    // true. However, it's possible for is_interp_only_mode() to become true
+    // during the compilation. We don't want to return the nm in that case
+    // because we want to continue to execute interpreted.
+    nm = NULL;
+  }
 #ifndef PRODUCT
   if (TraceOnStackReplacement) {
     if (nm != NULL) {