changeset 11380:d9bcf8789d57

Merge.
author Doug Simon <doug.simon@oracle.com>
date Tue, 20 Aug 2013 20:04:33 +0200
parents 0942e34b6c7d (diff) 1a110b7c03e1 (current diff)
children 001c41b01d13
files
diffstat 8 files changed, 60 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java	Tue Aug 20 15:39:58 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java	Tue Aug 20 20:04:33 2013 +0200
@@ -103,7 +103,12 @@
     }
 
     @NodeIntrinsic
-    public static native <T> T guardingNonNull(T object);
+    public static <T> T guardingNonNull(T object) {
+        if (object == null) {
+            throw new NullPointerException();
+        }
+        return object;
+    }
 
     @NodeIntrinsic
     public static native Object guardingPi(Object object, LogicNode condition, @ConstantNodeParameter boolean negateCondition, @ConstantNodeParameter DeoptimizationReason reason,
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java	Tue Aug 20 15:39:58 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java	Tue Aug 20 20:04:33 2013 +0200
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.nodes.java;
 
+import java.lang.reflect.*;
+
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
@@ -61,5 +63,7 @@
     }
 
     @NodeIntrinsic
-    public static native Object newArray(Class<?> componentType, int length);
+    public static Object newArray(Class<?> componentType, int length) {
+        return Array.newInstance(componentType, length);
+    }
 }
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionProcessor.java	Tue Aug 20 15:39:58 2013 +0200
+++ b/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionProcessor.java	Tue Aug 20 20:04:33 2013 +0200
@@ -87,6 +87,15 @@
             return;
         }
 
+        String help = annotation.help();
+        if (help.length() != 0) {
+            char firstChar = help.charAt(0);
+            if (!Character.isUpperCase(firstChar)) {
+                processingEnv.getMessager().printMessage(Kind.ERROR, "Option help text must start with upper case letter", element);
+                return;
+            }
+        }
+
         String optionName = annotation.name();
         if (optionName.equals("")) {
             optionName = fieldName;
@@ -118,7 +127,7 @@
             enclosing = enclosing.getEnclosingElement();
         }
 
-        info.options.add(new OptionInfo(optionName, annotation.help(), optionType, declaringClass, field));
+        info.options.add(new OptionInfo(optionName, help, optionType, declaringClass, field));
     }
 
     private void createFiles(OptionsInfo info) {
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Tue Aug 20 15:39:58 2013 +0200
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Tue Aug 20 20:04:33 2013 +0200
@@ -146,12 +146,14 @@
     @Option(help = "")
     public static final OptionValue<Integer> GCDebugStartCycle = new OptionValue<>(-1);
     // Ideal graph visualizer output settings
-    @Option(help = "")
+    @Option(help = "Dump IdealGraphVisualizer output in binary format")
     public static final OptionValue<Boolean> PrintBinaryGraphs = new OptionValue<>(true);
-    @Option(help = "outputs probabilities for fixed nodes during binary graph dumping")
+    @Option(help = "Output probabilities for fixed nodes during binary graph dumping")
     public static final OptionValue<Boolean> PrintGraphProbabilities = new OptionValue<>(false);
-    @Option(help = "")
+    @Option(help = "Enables dumping to the C1Visualizer. Enabling this option implies PrintBackendCFG.")
     public static final OptionValue<Boolean> PrintCFG = new OptionValue<>(false);
+    @Option(help = "Enables dumping LIR, register allocation and code generation info to the C1Visualizer.")
+    public static final OptionValue<Boolean> PrintBackendCFG = new OptionValue<>(true);
     @Option(help = "")
     public static final OptionValue<Boolean> PrintIdealGraphFile = new OptionValue<>(false);
     @Option(help = "")
@@ -245,7 +247,7 @@
     public static final OptionValue<Double> MinTableSwitchDensity = new OptionValue<>(0.5);
 
     // Ahead of time compilation
-    @Option(help = "configure compiler to emit code compatible with AOT requirements for HotSpot")
+    @Option(help = "Configure compiler to emit code  compatible with AOT requirements for HotSpot")
     public static final OptionValue<Boolean> AOTCompilation = new OptionValue<>(false);
 
     // Runtime settings
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Tue Aug 20 15:39:58 2013 +0200
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Tue Aug 20 20:04:33 2013 +0200
@@ -127,7 +127,7 @@
      * @param label A label describing the compilation phase that produced the control flow graph.
      * @param blocks The list of blocks to be printed.
      */
-    public void printCFG(String label, List<Block> blocks) {
+    public void printCFG(String label, List<Block> blocks, boolean printNodes) {
         if (lir == null) {
             latestScheduling = new NodeMap<>(cfg.getNodeToBlock());
             for (Block block : blocks) {
@@ -149,7 +149,7 @@
         begin("cfg");
         out.print("name \"").print(label).println('"');
         for (Block block : blocks) {
-            printBlock(block);
+            printBlock(block, printNodes);
         }
         end("cfg");
 
@@ -185,7 +185,7 @@
         }
     }
 
-    private void printBlock(Block block) {
+    private void printBlock(Block block, boolean printNodes) {
         begin("block");
 
         out.print("name \"").print(blockToString(block)).println('"');
@@ -231,7 +231,9 @@
             out.print("loop_depth ").println(block.getLoop().depth);
         }
 
-        printNodes(block);
+        if (printNodes) {
+            printNodes(block);
+        }
         printLIR(block);
         end("block");
     }
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Tue Aug 20 15:39:58 2013 +0200
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Tue Aug 20 20:04:33 2013 +0200
@@ -47,6 +47,12 @@
     private File cfgFile;
     private JavaMethod curMethod;
     private List<String> curDecorators = Collections.emptyList();
+    private final boolean dumpFrontend;
+    private Object previousObject;
+
+    public CFGPrinterObserver(boolean dumpFrontend) {
+        this.dumpFrontend = dumpFrontend;
+    }
 
     @Override
     public void dump(Object object, String message) {
@@ -100,8 +106,16 @@
     private static final long timestamp = System.currentTimeMillis();
     private static final AtomicInteger uniqueId = new AtomicInteger();
 
+    private static boolean isFrontendObject(Object object) {
+        return object instanceof Graph || object instanceof BciBlockMapping;
+    }
+
     public void dumpSandboxed(Object object, String message) {
 
+        if (!dumpFrontend && isFrontendObject(object)) {
+            return;
+        }
+
         if (cfgPrinter == null) {
             cfgFile = new File("compilations-" + timestamp + "_" + uniqueId.incrementAndGet() + ".cfg");
             try {
@@ -143,14 +157,17 @@
             }
 
         } else if (object instanceof LIR) {
-            cfgPrinter.printCFG(message, cfgPrinter.lir.codeEmittingOrder());
+            // No need to print the HIR nodes again if this is not the first
+            // time dumping the same LIR since the HIR will not have changed.
+            boolean printNodes = previousObject != object;
+            cfgPrinter.printCFG(message, cfgPrinter.lir.codeEmittingOrder(), printNodes);
 
         } else if (object instanceof StructuredGraph) {
             if (cfgPrinter.cfg == null) {
                 StructuredGraph graph = (StructuredGraph) object;
                 cfgPrinter.cfg = ControlFlowGraph.compute(graph, true, true, true, false);
             }
-            cfgPrinter.printCFG(message, Arrays.asList(cfgPrinter.cfg.getBlocks()));
+            cfgPrinter.printCFG(message, Arrays.asList(cfgPrinter.cfg.getBlocks()), true);
 
         } else if (object instanceof CompilationResult) {
             final CompilationResult compResult = (CompilationResult) object;
@@ -168,6 +185,8 @@
         cfgPrinter.lirGenerator = null;
         cfgPrinter.cfg = null;
         cfgPrinter.flush();
+
+        previousObject = object;
     }
 
     private static boolean isCompilationResultAndInstalledCode(Object object) {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java	Tue Aug 20 15:39:58 2013 +0200
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java	Tue Aug 20 20:04:33 2013 +0200
@@ -37,11 +37,11 @@
         Debug.enable();
         List<DebugDumpHandler> dumpHandlers = new ArrayList<>();
         dumpHandlers.add(new GraphPrinterDumpHandler());
-        if (PrintCFG.getValue()) {
-            if (PrintBinaryGraphs.getValue()) {
-                TTY.println("CFG dumping slows down PrintBinaryGraphs: use -G:-PrintCFG to disable it");
+        if (PrintCFG.getValue() || PrintBackendCFG.getValue()) {
+            if (PrintBinaryGraphs.getValue() && PrintCFG.getValue()) {
+                TTY.println("Complete C1Visualizer dumping slows down PrintBinaryGraphs: use -G:-PrintCFG to disable it");
             }
-            dumpHandlers.add(new CFGPrinterObserver());
+            dumpHandlers.add(new CFGPrinterObserver(PrintCFG.getValue()));
         }
         if (DecompileAfterPhase.getValue() != null) {
             dumpHandlers.add(new DecompilerDebugDumpHandler());
--- a/mx/commands.py	Tue Aug 20 15:39:58 2013 +0200
+++ b/mx/commands.py	Tue Aug 20 20:04:33 2013 +0200
@@ -444,7 +444,7 @@
     print _jdk(build, installGraalJar=False)
 
 def buildvars(args):
-    """Describes the variables that can be set by the -D option to the 'mx build' commmand"""
+    """describe the variables that can be set by the -D option to the 'mx build' commmand"""
 
     buildVars = {
         'ALT_BOOTDIR' : 'The location of the bootstrap JDK installation (default: ' + mx.java().jdk + ')',
@@ -1063,7 +1063,7 @@
     mx.log('  ' + str(total.duration))
     
 def deoptalot(args):
-    """Bootstrap a fastdebug Graal VM with DeoptimizeALot and VerifyOops on
+    """bootstrap a fastdebug Graal VM with DeoptimizeALot and VerifyOops on
 
     If the first argument is a number, the process will be repeated
     this number of times. All other arguments are passed to the VM."""