--- old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinterDumpHandler.java 2017-07-07 09:31:39.000000000 -0700
+++ new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinterDumpHandler.java 2017-07-07 09:31:39.000000000 -0700
@@ -22,7 +22,7 @@
*/
package org.graalvm.compiler.printer;
-import static org.graalvm.compiler.debug.GraalDebugConfig.asJavaMethod;
+import static org.graalvm.compiler.debug.DebugConfig.asJavaMethod;
import java.io.IOException;
import java.lang.management.ManagementFactory;
@@ -36,19 +36,15 @@
import java.util.Map;
import java.util.WeakHashMap;
-import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
-import org.graalvm.compiler.debug.Debug;
-import org.graalvm.compiler.debug.Debug.Scope;
-import org.graalvm.compiler.debug.DebugConfig;
+import org.graalvm.compiler.debug.DebugContext;
import org.graalvm.compiler.debug.DebugDumpHandler;
import org.graalvm.compiler.debug.DebugDumpScope;
-import org.graalvm.compiler.debug.GraalDebugConfig;
-import org.graalvm.compiler.debug.GraalDebugConfig.Options;
+import org.graalvm.compiler.debug.DebugOptions;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.debug.TTY;
-import org.graalvm.compiler.debug.internal.DebugScope;
import org.graalvm.compiler.graph.Graph;
import org.graalvm.compiler.nodes.StructuredGraph;
+import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.phases.contract.NodeCostUtil;
import jdk.vm.ci.meta.JavaMethod;
@@ -58,15 +54,13 @@
/**
* Observes compilation events and uses {@link IdealGraphPrinter} to generate a graph representation
- * that can be inspected with the Ideal Graph Visualizer
- * .
+ * that can be inspected with the Graph Visualizer.
*/
public class GraphPrinterDumpHandler implements DebugDumpHandler {
private static final int FAILURE_LIMIT = 8;
private final GraphPrinterSupplier printerSupplier;
protected GraphPrinter printer;
- private SnippetReflectionProvider snippetReflection;
private List previousInlineContext;
private int[] dumpIds = {};
private int failuresCount;
@@ -76,7 +70,7 @@
@FunctionalInterface
public interface GraphPrinterSupplier {
- GraphPrinter get() throws IOException;
+ GraphPrinter get(Graph graph) throws IOException;
}
/**
@@ -92,20 +86,18 @@
this.sunJavaCommand = System.getProperty("sun.java.command");
}
- private void ensureInitialized() {
+ private void ensureInitialized(Graph graph) {
if (printer == null) {
if (failuresCount >= FAILURE_LIMIT) {
return;
}
previousInlineContext = new ArrayList<>();
inlineContextMap = new WeakHashMap<>();
+ DebugContext debug = graph.getDebug();
try {
- printer = printerSupplier.get();
- if (snippetReflection != null) {
- printer.setSnippetReflectionProvider(snippetReflection);
- }
+ printer = printerSupplier.get(graph);
} catch (IOException e) {
- handleException(e);
+ handleException(debug, e);
}
}
}
@@ -120,13 +112,14 @@
@Override
@SuppressWarnings("try")
- public void dump(Object object, final String format, Object... arguments) {
- if (object instanceof Graph && Options.PrintGraph.getValue(DebugScope.getConfig().getOptions())) {
- ensureInitialized();
+ public void dump(DebugContext debug, Object object, final String format, Object... arguments) {
+ OptionValues options = debug.getOptions();
+ if (object instanceof Graph && DebugOptions.PrintGraph.getValue(options)) {
+ final Graph graph = (Graph) object;
+ ensureInitialized(graph);
if (printer == null) {
return;
}
- final Graph graph = (Graph) object;
// Get all current JavaMethod instances in the context.
List inlineContext = getInlineContext(graph);
@@ -135,21 +128,20 @@
Map