< prev index next >

src/share/vm/compiler/compileBroker.cpp

Print this page
rev 10285 : 8150646: Add support for blocking compiles through whitebox API

@@ -946,11 +946,11 @@
       // The compilation falls outside the allowed range.
       return;
     }
 
     // Should this thread wait for completion of the compile?
-    blocking = is_compile_blocking();
+    blocking = is_compile_blocking(method, comp_level);
 
 #if INCLUDE_JVMCI
     if (UseJVMCICompiler) {
       if (blocking) {
         // Don't allow blocking compiles for requests triggered by JVMCI.

@@ -1307,13 +1307,19 @@
 
 /**
  * Should the current thread block until this compilation request
  * has been fulfilled?
  */
-bool CompileBroker::is_compile_blocking() {
+bool CompileBroker::is_compile_blocking(const methodHandle& method, int comp_level) {
   assert(!InstanceRefKlass::owns_pending_list_lock(JavaThread::current()), "possible deadlock");
-  return !BackgroundCompilation;
+
+  bool backgroundCompilation;
+  DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler(comp_level));
+  backgroundCompilation = directive->BackgroundCompilationOption;
+  DirectivesStack::release(directive);
+
+  return !backgroundCompilation;
 }
 
 
 // ------------------------------------------------------------------
 // CompileBroker::preload_classes
< prev index next >