changeset 3651:a31028282e3e

Support blocking compilation.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 16 Nov 2011 23:35:03 +0100
parents 0e8a2a629afb
children aac12c75f805
files src/share/vm/classfile/vmSymbols.hpp src/share/vm/compiler/compileBroker.cpp src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalCompiler.hpp src/share/vm/graal/graalVMExits.cpp src/share/vm/graal/graalVMExits.hpp
diffstat 6 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/vmSymbols.hpp	Wed Nov 16 21:27:28 2011 +0100
+++ b/src/share/vm/classfile/vmSymbols.hpp	Wed Nov 16 23:35:03 2011 +0100
@@ -306,7 +306,7 @@
   template(shutdownCompiler_name,                     "shutdownCompiler")                                               \
   template(compileMethod_name,                        "compileMethod")                                                  \
   template(pollJavaQueue_name,                        "pollJavaQueue")                                                  \
-  template(compileMethod_signature,                   "(Lcom/oracle/max/graal/hotspot/HotSpotMethodResolved;I)V")       \
+  template(compileMethod_signature,                   "(Lcom/oracle/max/graal/hotspot/HotSpotMethodResolved;IZ)V")      \
   template(setOption_name,                            "setOption")                                                      \
   template(setDefaultOptions_name,                    "setDefaultOptions")                                              \
   template(setOption_signature,                       "(Ljava/lang/String;)Z")                                          \
--- a/src/share/vm/compiler/compileBroker.cpp	Wed Nov 16 21:27:28 2011 +0100
+++ b/src/share/vm/compiler/compileBroker.cpp	Wed Nov 16 23:35:03 2011 +0100
@@ -1125,8 +1125,11 @@
 
   if (!JavaThread::current()->is_compiling()) {
     method->set_queued_for_compilation();
-    GraalCompiler::instance()->compile_method(method, osr_bci);
+    GraalCompiler::instance()->compile_method(method, osr_bci, blocking);
+  } else {
+    // Recursive compile request => ignore.
   }
+
   /*if (blocking) {
     wait_for_completion(task);
   }*/
--- a/src/share/vm/graal/graalCompiler.cpp	Wed Nov 16 21:27:28 2011 +0100
+++ b/src/share/vm/graal/graalCompiler.cpp	Wed Nov 16 23:35:03 2011 +0100
@@ -81,11 +81,11 @@
       }
     }
     VMExits::startCompiler();
-  }
   
-  _initialized = true;
-  if (BootstrapGraal) {
-    VMExits::bootstrap();
+    _initialized = true;
+    if (BootstrapGraal) {
+      VMExits::bootstrap();
+    }
   }
 }
 
@@ -104,32 +104,28 @@
   }
 }
 
-void GraalCompiler::compile_method(methodHandle method, int entry_bci) {
+void GraalCompiler::compile_method(methodHandle method, int entry_bci, jboolean blocking) {
   EXCEPTION_CONTEXT
-    if (!_initialized) return;
+  if (!_initialized) {
+    method->clear_queued_for_compilation();
+    method->invocation_counter()->reset();
+    method->backedge_counter()->reset();
+    return;
+  }
   assert(_initialized, "must already be initialized");
   ResourceMark rm;
   ciEnv* current_env = JavaThread::current()->env();
   JavaThread::current()->set_env(NULL);
   JavaThread::current()->set_compiling(true);
   Handle hotspot_method = GraalCompiler::createHotSpotMethodResolved(method, CHECK);
-  VMExits::compileMethod(hotspot_method, entry_bci);
+  VMExits::compileMethod(hotspot_method, entry_bci, blocking);
   JavaThread::current()->set_compiling(false);
   JavaThread::current()->set_env(current_env);
 }
 
 // Compilation entry point for methods
 void GraalCompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
-  VM_ENTRY_MARK;
-  ResourceMark rm;
-  HandleMark hm;
-
-  TRACE_graal_2("GraalCompiler::compile_method");
-
-  
-  compile_method((methodOop)target->get_oop(), entry_bci);
-
-  TRACE_graal_2("GraalCompiler::compile_method exit");
+  ShouldNotReachHere();
 }
 
 void GraalCompiler::exit() {
--- a/src/share/vm/graal/graalCompiler.hpp	Wed Nov 16 21:27:28 2011 +0100
+++ b/src/share/vm/graal/graalCompiler.hpp	Wed Nov 16 23:35:03 2011 +0100
@@ -54,7 +54,7 @@
   // Compilation entry point for methods
   virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci);
 
-  void compile_method(methodHandle target, int entry_bci);
+  void compile_method(methodHandle target, int entry_bci, jboolean blocking);
 
   // Print compilation timers and statistics
   virtual void print_timers();
--- a/src/share/vm/graal/graalVMExits.cpp	Wed Nov 16 21:27:28 2011 +0100
+++ b/src/share/vm/graal/graalVMExits.cpp	Wed Nov 16 23:35:03 2011 +0100
@@ -97,7 +97,7 @@
   check_pending_exception("Error while calling setDefaultOptions");
 }
 
-void VMExits::compileMethod(Handle hotspot_method, int entry_bci) {
+void VMExits::compileMethod(Handle hotspot_method, int entry_bci, jboolean blocking) {
   assert(!hotspot_method.is_null(), "just checking");
   Thread* THREAD = Thread::current();
   JavaValue result(T_VOID);
@@ -105,6 +105,7 @@
   args.push_oop(instance());
   args.push_oop(hotspot_method);
   args.push_int(entry_bci);
+  args.push_int(blocking);
   JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD);
   check_pending_exception("Error while calling compileMethod");
 }
--- a/src/share/vm/graal/graalVMExits.hpp	Wed Nov 16 21:27:28 2011 +0100
+++ b/src/share/vm/graal/graalVMExits.hpp	Wed Nov 16 23:35:03 2011 +0100
@@ -50,8 +50,8 @@
   // public static void HotSpotOptions.setDefaultOptions();
   static void setDefaultOptions();
 
-  // public abstract void compileMethod(long vmId, String name, int entry_bci);
-  static void compileMethod(Handle hotspot_method, int entry_bci);
+  // public abstract void compileMethod(long vmId, String name, int entry_bci, boolean blocking);
+  static void compileMethod(Handle hotspot_method, int entry_bci, jboolean blocking);
 
   // public abstract void shutdownCompiler();
   static void shutdownCompiler();