# HG changeset patch # User Doug Simon # Date 1377021873 -7200 # Node ID d9bcf8789d574d7b7f3e885594716dcda4d9e61d # Parent 0942e34b6c7d0853766fae417741e22cdf2103c4# Parent 1a110b7c03e13c2b73bdc24befc2a3a4b2424d38 Merge. diff -r 1a110b7c03e1 -r d9bcf8789d57 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java --- 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 guardingNonNull(T object); + public static 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, diff -r 1a110b7c03e1 -r d9bcf8789d57 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java --- 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); + } } diff -r 1a110b7c03e1 -r d9bcf8789d57 graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionProcessor.java --- 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) { diff -r 1a110b7c03e1 -r d9bcf8789d57 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java --- 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 GCDebugStartCycle = new OptionValue<>(-1); // Ideal graph visualizer output settings - @Option(help = "") + @Option(help = "Dump IdealGraphVisualizer output in binary format") public static final OptionValue 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 PrintGraphProbabilities = new OptionValue<>(false); - @Option(help = "") + @Option(help = "Enables dumping to the C1Visualizer. Enabling this option implies PrintBackendCFG.") public static final OptionValue PrintCFG = new OptionValue<>(false); + @Option(help = "Enables dumping LIR, register allocation and code generation info to the C1Visualizer.") + public static final OptionValue PrintBackendCFG = new OptionValue<>(true); @Option(help = "") public static final OptionValue PrintIdealGraphFile = new OptionValue<>(false); @Option(help = "") @@ -245,7 +247,7 @@ public static final OptionValue 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 AOTCompilation = new OptionValue<>(false); // Runtime settings diff -r 1a110b7c03e1 -r d9bcf8789d57 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java --- 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 blocks) { + public void printCFG(String label, List 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"); } diff -r 1a110b7c03e1 -r d9bcf8789d57 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java --- 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 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) { diff -r 1a110b7c03e1 -r d9bcf8789d57 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java --- 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 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()); diff -r 1a110b7c03e1 -r d9bcf8789d57 mx/commands.py --- 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."""