# HG changeset patch # User Doug Simon # Date 1384972069 -3600 # Node ID 77fbf02f701ccdc2a9f9359100914cdcc92fb6ad # Parent 514e809bd97df7fc781fdbcfbd9373ee2b3ea187 re-enabled protection against recursive Graal compilation requests with Graal specific _graal_compiling field in JavaThread diff -r 514e809bd97d -r 77fbf02f701c src/share/vm/compiler/compileBroker.cpp --- 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: diff -r 514e809bd97d -r 77fbf02f701c src/share/vm/graal/graalCompiler.cpp --- 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 diff -r 514e809bd97d -r 77fbf02f701c src/share/vm/runtime/thread.cpp --- 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; diff -r 514e809bd97d -r 77fbf02f701c src/share/vm/runtime/thread.hpp --- 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