changeset 7113:38076efb9062

Do not print code installation failures from Java. Temporarily print dependencies failures from C++. CompilerToVM.installCode resports the installation result.
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 30 Nov 2012 11:11:13 +0100
parents e0fcf7802786
children acfca8c77dd2
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java src/share/vm/graal/graalEnv.cpp
diffstat 4 files changed, 20 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Fri Nov 30 08:30:22 2012 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Fri Nov 30 11:11:13 2012 +0100
@@ -127,6 +127,13 @@
 
     void lookupReferencedTypeInPool(HotSpotResolvedObjectType pool, int cpi, byte opcode);
 
+    // Must be kept in sync with enum in graalEnv.hpp
+    public enum CodeInstallResult {
+        OK,
+        DEPENDENCIES_FAILED,
+        CACHE_FULL
+    }
+
     /**
      * Installs the result of a compilation into the code cache.
      *
@@ -134,10 +141,9 @@
      * @param code if not null, then the code is installed as the non-default compiled code for the associated method
      *            and the details of the installation are written to this object
      * @param info additional information about the installation are written to this object if it is not null
-     * @return the value of {@code code} if installation was successful, null if dependency validation failed or the
-     *         code cache is full
+     * @return the outcome of the installation as a {@link CodeInstallResult}.
      */
-    HotSpotInstalledCode installCode(HotSpotCompilationResult compResult, HotSpotInstalledCode code, HotSpotCodeInfo info);
+    CodeInstallResult installCode(HotSpotCompilationResult compResult, HotSpotInstalledCode code, HotSpotCodeInfo info);
 
     void initializeConfiguration(HotSpotVMConfig config);
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Fri Nov 30 08:30:22 2012 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Fri Nov 30 11:11:13 2012 +0100
@@ -23,8 +23,6 @@
 
 package com.oracle.graal.hotspot.bridge;
 
-import static com.oracle.graal.hotspot.bridge.CompilerToVMImpl.CodeInstallResult.*;
-
 import java.lang.reflect.*;
 
 import com.oracle.graal.api.meta.*;
@@ -36,40 +34,11 @@
  */
 public class CompilerToVMImpl implements CompilerToVM {
 
-    // Must be kept in sync with enum in graalEnv.hpp
-    enum CodeInstallResult {
-        OK,
-        DEPENDENCIES_FAILED,
-        CACHE_FULL
-    }
-
-    /**
-     * Number of successive successful installations.
-     */
-    private long successfulInstallations = MINIMUM_SUCCESSFUL_INSTALLATIONS_PER_FAILURE;
-
-    /**
-     * The minimum expected number of successful code installations between each code
-     * installation failure. Warning messages are printed when the failure rate goes
-     * above this threshold. This usually indicates use of some overly optimistic
-     * assumptions during compilation.
-     */
-    private static final int MINIMUM_SUCCESSFUL_INSTALLATIONS_PER_FAILURE = 2000;
-
     private native int installCode0(HotSpotCompilationResult comp, HotSpotInstalledCode code, HotSpotCodeInfo info);
 
     @Override
-    public HotSpotInstalledCode installCode(HotSpotCompilationResult comp, HotSpotInstalledCode code, HotSpotCodeInfo info) {
-        int result = installCode0(comp, code, info);
-        if (result != OK.ordinal()) {
-            if (successfulInstallations < MINIMUM_SUCCESSFUL_INSTALLATIONS_PER_FAILURE) {
-                System.err.println("Failed to install compiled code for " + comp.method + " [reason: " + CodeInstallResult.values()[result] + "]");
-            }
-            successfulInstallations = 0L;
-        } else {
-            successfulInstallations++;
-        }
-        return code;
+    public CodeInstallResult installCode(HotSpotCompilationResult comp, HotSpotInstalledCode code, HotSpotCodeInfo info) {
+        return CodeInstallResult.values()[installCode0(comp, code, info)];
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Nov 30 08:30:22 2012 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Nov 30 11:11:13 2012 +0100
@@ -52,6 +52,7 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.bridge.*;
+import com.oracle.graal.hotspot.bridge.CompilerToVM.CodeInstallResult;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.hotspot.snippets.*;
@@ -772,7 +773,12 @@
     public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, CodeInfo[] info) {
         HotSpotCodeInfo hsInfo = makeInfo(method, compResult, info);
         HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method;
-        return graalRuntime.getCompilerToVM().installCode(new HotSpotCompilationResult(hotspotMethod, -1, compResult), new HotSpotInstalledCode(hotspotMethod), hsInfo);
+        HotSpotInstalledCode code = new HotSpotInstalledCode(hotspotMethod);
+        CodeInstallResult result = graalRuntime.getCompilerToVM().installCode(new HotSpotCompilationResult(hotspotMethod, -1, compResult), code, hsInfo);
+        if (result != CodeInstallResult.OK) {
+            return null;
+        }
+        return code;
     }
 
     @Override
--- a/src/share/vm/graal/graalEnv.cpp	Fri Nov 30 08:30:22 2012 +0100
+++ b/src/share/vm/graal/graalEnv.cpp	Fri Nov 30 11:11:13 2012 +0100
@@ -392,6 +392,8 @@
   for (Dependencies::DepStream deps(dependencies); deps.next(); ) {
     Klass*  witness = deps.check_dependency();
     if (witness != NULL) {
+      // TODO (gd) remove when thing look stable
+      deps.print_dependency(witness, true);
       return false;
     }
   }