changeset 13089:77fbf02f701c

re-enabled protection against recursive Graal compilation requests with Graal specific _graal_compiling field in JavaThread
author Doug Simon <doug.simon@oracle.com>
date Wed, 20 Nov 2013 19:27:49 +0100
parents 514e809bd97d
children 4fcc7d778e0f
files src/share/vm/compiler/compileBroker.cpp src/share/vm/graal/graalCompiler.cpp src/share/vm/runtime/thread.cpp src/share/vm/runtime/thread.hpp
diffstat 4 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/compiler/compileBroker.cpp	Wed Nov 20 15:58:58 2013 +0100
+++ b/src/share/vm/compiler/compileBroker.cpp	Wed Nov 20 19:27:49 2013 +0100
@@ -1143,8 +1143,11 @@
     return;
   }
 #ifdef GRAALVM
-  // Detect recursive request in Java
-  GraalCompiler::instance()->compile_method(method, osr_bci, is_compile_blocking(method, osr_bci));
+  if (!JavaThread::current()->is_graal_compiling()) {
+    GraalCompiler::instance()->compile_method(method, osr_bci, is_compile_blocking(method, osr_bci));
+  } else {
+    // Recursive compile request => ignore.
+  }
 #else
 
   // Outputs from the following MutexLocker block:
--- a/src/share/vm/graal/graalCompiler.cpp	Wed Nov 20 15:58:58 2013 +0100
+++ b/src/share/vm/graal/graalCompiler.cpp	Wed Nov 20 19:27:49 2013 +0100
@@ -180,8 +180,10 @@
 
   assert(_initialized, "must already be initialized");
   ResourceMark rm;
+  thread->set_is_graal_compiling(true);
   Handle holder = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK);
   VMToCompiler::compileMethod(method(), holder, entry_bci, blocking);
+  thread->set_is_graal_compiling(false);
 }
 
 // Compilation entry point for methods
--- a/src/share/vm/runtime/thread.cpp	Wed Nov 20 15:58:58 2013 +0100
+++ b/src/share/vm/runtime/thread.cpp	Wed Nov 20 19:27:49 2013 +0100
@@ -1481,6 +1481,8 @@
   _stack_guard_state = stack_guard_unused;
 #ifdef GRAAL
   _graal_alternate_call_target = NULL;
+  _graal_implicit_exception_pc = NULL;
+  _graal_compiling = false;
 #if GRAAL_COUNTERS_SIZE > 0
   for (int i = 0; i < GRAAL_COUNTERS_SIZE; i++) {
     _graal_counters[i] = 0;
--- a/src/share/vm/runtime/thread.hpp	Wed Nov 20 15:58:58 2013 +0100
+++ b/src/share/vm/runtime/thread.hpp	Wed Nov 20 19:27:49 2013 +0100
@@ -920,6 +920,7 @@
 #ifdef GRAAL
   address   _graal_alternate_call_target;
   address   _graal_implicit_exception_pc;  // pc at which the most recent implicit exception occurred
+  bool      _graal_compiling;
 
   // number of counters, increase as needed. 0 == disabled
 #define GRAAL_COUNTERS_SIZE (0)
@@ -1301,6 +1302,8 @@
 #ifdef GRAAL
   void set_graal_alternate_call_target(address a) { _graal_alternate_call_target = a; }
   void set_graal_implicit_exception_pc(address a) { _graal_implicit_exception_pc = a; }
+  bool is_graal_compiling()                       { return _graal_compiling;          }
+  void set_is_graal_compiling(bool b)             { _graal_compiling = b;             }
 #endif
 
   // Exception handling for compiled methods