diff src/share/vm/graal/graalCompiler.cpp @ 15487:07fac8558d7b

update state flag after initialization to allow other compiler threads to execute
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Fri, 02 May 2014 17:03:10 -0700
parents a20be10ad437
children 9c66a589ef63
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompiler.cpp	Fri May 02 16:12:07 2014 -0700
+++ b/src/share/vm/graal/graalCompiler.cpp	Fri May 02 17:03:10 2014 -0700
@@ -58,12 +58,18 @@
   NOT_LP64(error("check TLAB allocation code for address space conflicts"));
 
   BufferBlob* buffer_blob = initialize_buffer_blob();
-  if (buffer_blob == NULL) {
-    // If we are called from JNI_CreateJavaVM we cannot use set_state yet because it takes a lock.
-    // set_state(failed);
-  } else {
-    // set_state(initialized);
+#ifdef COMPILERGRAAL
+  if (!UseGraalCompilationQueue) {
+    // This path is used for initialization both by the native queue and the graal queue
+    // but set_state acquired a lock which might not be safe during JVM_CreateJavaVM, so
+    // only update the state flag for the native queue.
+    if (buffer_blob == NULL) {
+      set_state(failed);
+    } else {
+      set_state(initialized);
+    }
   }
+#endif
 
   JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment();
   jclass klass = env->FindClass("com/oracle/graal/hotspot/bridge/CompilerToVMImpl");