Mercurial > hg > graal-compiler
diff src/share/vm/runtime/thread.cpp @ 16435:b20d00b2ac2e
fixed deadlock in GraalVM under -Xcomp (JBS:GRAAL-48)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 09 Jul 2014 19:02:29 +0200 |
parents | 84a14e69fa8b |
children | ce6696559683 |
line wrap: on
line diff
--- a/src/share/vm/runtime/thread.cpp Wed Jul 09 10:42:34 2014 +0200 +++ b/src/share/vm/runtime/thread.cpp Wed Jul 09 19:02:29 2014 +0200 @@ -3745,7 +3745,18 @@ #endif // initialize compiler(s) -#if defined(COMPILER1) || defined(COMPILER2) || defined(SHARK) || defined(COMPILERGRAAL) +#if defined(COMPILERGRAAL) + if (Arguments::mode() != Arguments::_comp) { + // Only initialize compilation if not -Xcomp. Deadlock can + // occur during the class initialization below as follows: + // 1. This thread acquires the initialization lock for a class + // and then blocks while waiting for some method to be compiled. + // 2. Graal compilation thread(s) try to access the locked class + // and will block waiting for the initialization lock. This + // prevents the requested compilation in 1 from completing. + CompileBroker::compilation_init(); + } +#elif defined(COMPILER1) || defined(COMPILER2) || defined(SHARK) || defined(COMPILERGRAAL) CompileBroker::compilation_init(); #endif @@ -3759,6 +3770,13 @@ initialize_class(vmSymbols::java_lang_invoke_MethodHandleNatives(), CHECK_0); } +#if defined(COMPILERGRAAL) + if (Arguments::mode() == Arguments::_comp) { + // Do deferred compilation initialization (see above) now. + CompileBroker::compilation_init(); + } +#endif + #if INCLUDE_MANAGEMENT Management::initialize(THREAD); #endif // INCLUDE_MANAGEMENT