changeset 5018:bf63d72879aa

fixed an issue that prevented java.util.concurrent methods from being compiled
author Christian Haeubl <christian.haeubl@oracle.com>
date Fri, 02 Mar 2012 16:44:36 -0800
parents c2ebd3d559f7
children 836e4fce33ab
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompiler.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java src/share/vm/classfile/vmSymbols.hpp src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalVMToCompiler.cpp src/share/vm/graal/graalVMToCompiler.hpp
diffstat 7 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Thu Mar 01 15:18:32 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Fri Mar 02 16:44:36 2012 -0800
@@ -290,10 +290,10 @@
             maxSize = Math.max(GraalOptions.MaximumTrivialSize, maxSize);
 
             if (info.weight <= maxSize) {
-                Debug.log("inlining (size %f): %s", info.weight, info);
+                Debug.log("inlining (size %f <= %f): %s", info.weight, maxSize, info);
                 return true;
             } else {
-                Debug.log("not inlining (too large %f): %s", info.weight, info);
+                Debug.log("not inlining (too large %f > %f): %s", info.weight, maxSize, info);
                 return false;
             }
         }
@@ -314,10 +314,10 @@
             maxSize = Math.min(GraalOptions.MaximumGreedyInlineSize, Math.max(GraalOptions.MaximumTrivialSize, maxSize));
 
             if (info.weight <= maxSize) {
-                Debug.log("inlining (size %f): %s", info.weight, info);
+                Debug.log("inlining (size %f <= %f): %s", info.weight, maxSize, info);
                 return true;
             } else {
-                Debug.log("not inlining (too large %f): %s", info.weight, info);
+                Debug.log("not inlining (too large %f > %f): %s", info.weight, maxSize, info);
                 return false;
             }
         }
@@ -337,10 +337,10 @@
             maxSize = Math.max(maxSize, GraalOptions.MaximumTrivialSize);
 
             if (info.weight <= maxSize) {
-                Debug.log("inlining (size %f): %s", info.weight, info);
+                Debug.log("inlining (size %f <= %f): %s", info.weight, maxSize, info);
                 return true;
             } else {
-                Debug.log("not inlining (too large %f): %s", info.weight, info);
+                Debug.log("not inlining (too large %f > %f): %s", info.weight, maxSize, info);
                 return false;
             }
         }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompiler.java	Thu Mar 01 15:18:32 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompiler.java	Fri Mar 02 16:44:36 2012 -0800
@@ -32,7 +32,7 @@
  */
 public interface VMToCompiler {
 
-    void compileMethod(HotSpotMethodResolved method, int entryBCI, boolean blocking) throws Throwable;
+    boolean compileMethod(HotSpotMethodResolved method, int entryBCI, boolean blocking) throws Throwable;
 
     void shutdownCompiler() throws Throwable;
 
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Mar 01 15:18:32 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java	Fri Mar 02 16:44:36 2012 -0800
@@ -282,7 +282,7 @@
     }
 
     @Override
-    public void compileMethod(final HotSpotMethodResolved method, final int entryBCI, boolean blocking) throws Throwable {
+    public boolean compileMethod(final HotSpotMethodResolved method, final int entryBCI, boolean blocking) throws Throwable {
         try {
             if (Thread.currentThread() instanceof CompilerThread) {
                 if (method.holder().name().contains("java/util/concurrent")) {
@@ -290,7 +290,7 @@
                     // java.util.concurrent.BlockingQueue is used to implement the compilation worker
                     // queues. If a compiler thread triggers a compilation, then it may be blocked trying
                     // to add something to its own queue.
-                    return;
+                    return false;
                 }
             }
 
@@ -350,8 +350,9 @@
             }
         } catch (RejectedExecutionException e) {
             // The compile queue was already shut down.
-            return;
+            return false;
         }
+        return true;
     }
 
     @Override
--- a/src/share/vm/classfile/vmSymbols.hpp	Thu Mar 01 15:18:32 2012 -0800
+++ b/src/share/vm/classfile/vmSymbols.hpp	Fri Mar 02 16:44:36 2012 -0800
@@ -317,7 +317,7 @@
   template(bootstrap_name,                            "bootstrap")                                                      \
   template(shutdownCompiler_name,                     "shutdownCompiler")                                               \
   template(compileMethod_name,                        "compileMethod")                                                  \
-  template(compileMethod_signature,                   "(Lcom/oracle/max/graal/hotspot/ri/HotSpotMethodResolved;IZ)V")   \
+  template(compileMethod_signature,                   "(Lcom/oracle/max/graal/hotspot/ri/HotSpotMethodResolved;IZ)Z")   \
   template(setOption_name,                            "setOption")                                                      \
   template(setDefaultOptions_name,                    "setDefaultOptions")                                              \
   template(setOption_signature,                       "(Ljava/lang/String;)Z")                                          \
--- a/src/share/vm/graal/graalCompiler.cpp	Thu Mar 01 15:18:32 2012 -0800
+++ b/src/share/vm/graal/graalCompiler.cpp	Fri Mar 02 16:44:36 2012 -0800
@@ -120,9 +120,12 @@
   JavaThread::current()->set_env(NULL);
   JavaThread::current()->set_compiling(true);
   Handle hotspot_method = GraalCompiler::createHotSpotMethodResolved(method, CHECK);
-  VMToCompiler::compileMethod(hotspot_method, entry_bci, blocking);
+  jboolean success = VMToCompiler::compileMethod(hotspot_method, entry_bci, blocking);
   JavaThread::current()->set_compiling(false);
   JavaThread::current()->set_env(current_env);
+  if (success != JNI_TRUE) {
+    method->clear_queued_for_compilation();
+  }
 }
 
 // Compilation entry point for methods
--- a/src/share/vm/graal/graalVMToCompiler.cpp	Thu Mar 01 15:18:32 2012 -0800
+++ b/src/share/vm/graal/graalVMToCompiler.cpp	Fri Mar 02 16:44:36 2012 -0800
@@ -97,10 +97,10 @@
   check_pending_exception("Error while calling setDefaultOptions");
 }
 
-void VMToCompiler::compileMethod(Handle hotspot_method, int entry_bci, jboolean blocking) {
+jboolean VMToCompiler::compileMethod(Handle hotspot_method, int entry_bci, jboolean blocking) {
   assert(!hotspot_method.is_null(), "just checking");
   Thread* THREAD = Thread::current();
-  JavaValue result(T_VOID);
+  JavaValue result(T_BOOLEAN);
   JavaCallArguments args;
   args.push_oop(instance());
   args.push_oop(hotspot_method);
@@ -108,6 +108,7 @@
   args.push_int(blocking);
   JavaCalls::call_interface(&result, vmExitsKlass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD);
   check_pending_exception("Error while calling compileMethod");
+  return result.get_jboolean();
 }
 
 void VMToCompiler::shutdownCompiler() {
--- a/src/share/vm/graal/graalVMToCompiler.hpp	Thu Mar 01 15:18:32 2012 -0800
+++ b/src/share/vm/graal/graalVMToCompiler.hpp	Fri Mar 02 16:44:36 2012 -0800
@@ -50,8 +50,8 @@
   // public static void HotSpotOptions.setDefaultOptions();
   static void setDefaultOptions();
 
-  // 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 boolean compileMethod(long vmId, String name, int entry_bci, boolean blocking);
+  static jboolean compileMethod(Handle hotspot_method, int entry_bci, jboolean blocking);
 
   // public abstract void shutdownCompiler();
   static void shutdownCompiler();