diff src/share/vm/compiler/compileBroker.cpp @ 4981:1b8d02e10ee8

Remove the hacks around "is_Compiler_thread" assertions; Graal no longer uses the compiler thread mechanisms; don't create a C++ compilation queue or any compiler threads.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 27 Feb 2012 22:15:05 +0100
parents 532be189cf09
children 957c266d8bc5
line wrap: on
line diff
--- a/src/share/vm/compiler/compileBroker.cpp	Mon Feb 27 21:49:51 2012 +0100
+++ b/src/share/vm/compiler/compileBroker.cpp	Mon Feb 27 22:15:05 2012 +0100
@@ -729,6 +729,8 @@
   int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization);
 #if defined(GRAAL)
   _compilers[0] = new GraalCompiler();
+  c1_count = 0;
+  c2_count = 0;
 #elif defined(COMPILER1)
   if (c1_count > 0) {
     _compilers[0] = new Compiler();
@@ -943,7 +945,7 @@
 // Initialize the compilation queue
 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) {
   EXCEPTION_MARK;
-#if !defined(ZERO) && !defined(SHARK)
+#if !defined(ZERO) && !defined(SHARK) && !defined(GRAAL)
   assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?");
 #endif // !ZERO && !SHARK
   if (c2_compiler_count > 0) {
@@ -1081,6 +1083,14 @@
   if (instanceRefKlass::owns_pending_list_lock(JavaThread::current())) {
     return;
   }
+#ifdef GRAAL
+  if (!JavaThread::current()->is_compiling()) {
+    method->set_queued_for_compilation();
+    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:
   CompileTask* task     = NULL;
@@ -1091,14 +1101,6 @@
   {
     MutexLocker locker(queue->lock(), thread);
 
-#ifdef GRAAL
-    if (JavaThread::current()->is_compiling() && !BackgroundCompilation) {
-      TRACE_graal_1("Recursive compile %s!", method->name_and_sig_as_C_string());
-      method->set_not_compilable();
-      return;
-    }
-#endif
-
     // Make sure the method has not slipped into the queues since
     // last we checked; note that those checks were "fast bail-outs".
     // Here we need to be more careful, see 14012000 below.
@@ -1163,23 +1165,13 @@
     // and in that case it's best to protect both the testing (here) of
     // these bits, and their updating (here and elsewhere) under a
     // common lock.
-#ifndef GRAAL
     task = create_compile_task(queue,
                                compile_id, method,
                                osr_bci, comp_level,
                                hot_method, hot_count, comment,
                                blocking);
-#endif
   }
 
-#ifdef GRAAL
-  if (!JavaThread::current()->is_compiling()) {
-    method->set_queued_for_compilation();
-    GraalCompiler::instance()->compile_method(method, osr_bci, blocking);
-  } else {
-    // Recursive compile request => ignore.
-  }
-#else
   if (blocking) {
     wait_for_completion(task);
   }