diff c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java @ 1456:cb03c46412a4

Merge.
author Doug Simon <doug.simon@oracle.com>
date Fri, 12 Nov 2010 16:17:55 +0100
parents 8cfe3537a0d3
children 1845386f5403
line wrap: on
line diff
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java	Fri Nov 12 16:11:41 2010 +0100
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java	Fri Nov 12 16:17:55 2010 +0100
@@ -23,6 +23,7 @@
 
 import java.io.*;
 import java.lang.reflect.*;
+import java.util.*;
 
 import com.sun.c1x.*;
 import com.sun.cri.ci.*;
@@ -38,6 +39,16 @@
 
     public static boolean compileMethods = true;
 
+    /**
+     * Default option configuration for C1X.
+     */
+    static {
+        C1XOptions.setOptimizationLevel(3);
+        C1XOptions.OptInlineExcept = false;
+        C1XOptions.OptInlineSynchronized = false;
+        C1XOptions.UseDeopt = false;
+    }
+
     @Override
     public boolean setOption(String option) {
         if (option.length() == 0) {
@@ -102,6 +113,8 @@
         return true;
     }
 
+    private static Set<String> compiledMethods = new HashSet<String>();
+
     @Override
     public void compileMethod(long methodVmId, String name, int entryBCI) throws Throwable {
 
@@ -113,11 +126,25 @@
             Compiler compiler = Compiler.getInstance();
             HotSpotMethodResolved riMethod = new HotSpotMethodResolved(methodVmId, name);
             CiResult result = compiler.getCompiler().compileMethod(riMethod, -1, null);
+            String qualifiedName = CiUtil.toJavaName(riMethod.holder()) + "::" + riMethod.name();
+            compiledMethods.add(qualifiedName);
 
             if (result.bailout() != null) {
                 StringWriter out = new StringWriter();
                 result.bailout().printStackTrace(new PrintWriter(out));
+                Throwable cause = result.bailout().getCause();
                 Logger.info("Bailout:\n" + out.toString());
+                if (cause != null) {
+                    Logger.info("Trace for cause: ");
+                    for (StackTraceElement e : cause.getStackTrace()) {
+                        String current = e.getClassName() + "::" + e.getMethodName();
+                        String type = "";
+                        if (compiledMethods.contains(current)) {
+                            type = "compiled";
+                        }
+                        Logger.info(String.format("%-10s %3d %s", type, e.getLineNumber(), current));
+                    }
+                }
                 Compiler.getVMEntries().recordBailout(result.bailout().getMessage());
             } else {
                 Logger.log("Compilation result: " + result.targetMethod());