src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphDecoder.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphDecoder.java

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphDecoder.java

Print this page

        

*** 39,49 **** import org.graalvm.compiler.core.common.Fields; import org.graalvm.compiler.core.common.PermanentBailoutException; import org.graalvm.compiler.core.common.util.TypeReader; import org.graalvm.compiler.core.common.util.UnsafeArrayTypeReader; ! import org.graalvm.compiler.debug.Debug; import org.graalvm.compiler.debug.GraalError; import org.graalvm.compiler.graph.Edges; import org.graalvm.compiler.graph.Graph; import org.graalvm.compiler.graph.Node; import org.graalvm.compiler.graph.NodeBitMap; --- 39,49 ---- import org.graalvm.compiler.core.common.Fields; import org.graalvm.compiler.core.common.PermanentBailoutException; import org.graalvm.compiler.core.common.util.TypeReader; import org.graalvm.compiler.core.common.util.UnsafeArrayTypeReader; ! import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.GraalError; import org.graalvm.compiler.graph.Edges; import org.graalvm.compiler.graph.Graph; import org.graalvm.compiler.graph.Node; import org.graalvm.compiler.graph.NodeBitMap;
*** 59,68 **** --- 59,69 ---- import org.graalvm.compiler.nodes.GraphDecoder.MethodScope; import org.graalvm.compiler.nodes.GraphDecoder.ProxyPlaceholder; import org.graalvm.compiler.nodes.calc.FloatingNode; import org.graalvm.compiler.nodes.extended.IntegerSwitchNode; import org.graalvm.compiler.nodes.graphbuilderconf.LoopExplosionPlugin.LoopExplosionKind; + import org.graalvm.compiler.options.OptionValues; import org.graalvm.util.EconomicMap; import org.graalvm.util.EconomicSet; import org.graalvm.util.Equivalence; import jdk.vm.ci.code.Architecture;
*** 339,365 **** } protected final Architecture architecture; /** The target graph where decoded nodes are added to. */ protected final StructuredGraph graph; private final EconomicMap<NodeClass<?>, ArrayDeque<Node>> reusableFloatingNodes; public GraphDecoder(Architecture architecture, StructuredGraph graph) { this.architecture = architecture; this.graph = graph; reusableFloatingNodes = EconomicMap.create(Equivalence.IDENTITY); } @SuppressWarnings("try") public final void decode(EncodedGraph encodedGraph) { ! try (Debug.Scope scope = Debug.scope("GraphDecoder", graph)) { MethodScope methodScope = new MethodScope(null, graph, encodedGraph, LoopExplosionKind.NONE); decode(createInitialLoopScope(methodScope, null)); cleanupGraph(methodScope); assert graph.verify(); } catch (Throwable ex) { ! Debug.handle(ex); } } protected final LoopScope createInitialLoopScope(MethodScope methodScope, FixedWithNextNode startNode) { LoopScope loopScope = new LoopScope(methodScope); --- 340,371 ---- } protected final Architecture architecture; /** The target graph where decoded nodes are added to. */ protected final StructuredGraph graph; + protected final OptionValues options; + protected final DebugContext debug; + private final EconomicMap<NodeClass<?>, ArrayDeque<Node>> reusableFloatingNodes; public GraphDecoder(Architecture architecture, StructuredGraph graph) { this.architecture = architecture; this.graph = graph; + this.options = graph.getOptions(); + this.debug = graph.getDebug(); reusableFloatingNodes = EconomicMap.create(Equivalence.IDENTITY); } @SuppressWarnings("try") public final void decode(EncodedGraph encodedGraph) { ! try (DebugContext.Scope scope = debug.scope("GraphDecoder", graph)) { MethodScope methodScope = new MethodScope(null, graph, encodedGraph, LoopExplosionKind.NONE); decode(createInitialLoopScope(methodScope, null)); cleanupGraph(methodScope); assert graph.verify(); } catch (Throwable ex) { ! debug.handle(ex); } } protected final LoopScope createInitialLoopScope(MethodScope methodScope, FixedWithNextNode startNode) { LoopScope loopScope = new LoopScope(methodScope);
*** 1353,1363 **** this.methodScope = methodScope; } @Override public void run() { ! Debug.dump(Debug.DETAILED_LEVEL, graph, "Before loop detection"); List<Loop> orderedLoops = findLoops(); assert orderedLoops.get(orderedLoops.size() - 1) == irreducibleLoopHandler : "outermost loop must be the last element in the list"; for (Loop loop : orderedLoops) { --- 1359,1370 ---- this.methodScope = methodScope; } @Override public void run() { ! DebugContext debug = graph.getDebug(); ! debug.dump(DebugContext.DETAILED_LEVEL, graph, "Before loop detection"); List<Loop> orderedLoops = findLoops(); assert orderedLoops.get(orderedLoops.size() - 1) == irreducibleLoopHandler : "outermost loop must be the last element in the list"; for (Loop loop : orderedLoops) {
*** 1376,1390 **** if (loop.irreducible) { handleIrreducibleLoop(loop); } else { insertLoopNodes(loop); } ! Debug.dump(Debug.DETAILED_LEVEL, graph, "After handling of loop %s", loop.header); } logIrreducibleLoops(); ! Debug.dump(Debug.DETAILED_LEVEL, graph, "After loop detection"); } private List<Loop> findLoops() { /* Mapping from the loop header node to additional loop information. */ EconomicMap<MergeNode, Loop> unorderedLoops = EconomicMap.create(Equivalence.IDENTITY); --- 1383,1397 ---- if (loop.irreducible) { handleIrreducibleLoop(loop); } else { insertLoopNodes(loop); } ! debug.dump(DebugContext.DETAILED_LEVEL, graph, "After handling of loop %s", loop.header); } logIrreducibleLoops(); ! debug.dump(DebugContext.DETAILED_LEVEL, graph, "After loop detection"); } private List<Loop> findLoops() { /* Mapping from the loop header node to additional loop information. */ EconomicMap<MergeNode, Loop> unorderedLoops = EconomicMap.create(Equivalence.IDENTITY);
*** 1907,1924 **** /** * Print information about irreducible loops, when enabled with -Dgraal.Log=IrreducibleLoops. */ @SuppressWarnings("try") private void logIrreducibleLoops() { ! try (Debug.Scope s = Debug.scope("IrreducibleLoops")) { ! if (Debug.isLogEnabled(Debug.BASIC_LEVEL) && irreducibleLoopSwitch != null) { StringBuilder msg = new StringBuilder("Inserted state machine to remove irreducible loops. Dispatching to the following states: "); String sep = ""; for (int i = 0; i < irreducibleLoopSwitch.keyCount(); i++) { msg.append(sep).append(irreducibleLoopSwitch.keyAt(i).asInt()); sep = ", "; } ! Debug.log(Debug.BASIC_LEVEL, "%s", msg); } } } } --- 1914,1932 ---- /** * Print information about irreducible loops, when enabled with -Dgraal.Log=IrreducibleLoops. */ @SuppressWarnings("try") private void logIrreducibleLoops() { ! DebugContext debug = graph.getDebug(); ! try (DebugContext.Scope s = debug.scope("IrreducibleLoops")) { ! if (debug.isLogEnabled(DebugContext.BASIC_LEVEL) && irreducibleLoopSwitch != null) { StringBuilder msg = new StringBuilder("Inserted state machine to remove irreducible loops. Dispatching to the following states: "); String sep = ""; for (int i = 0; i < irreducibleLoopSwitch.keyCount(); i++) { msg.append(sep).append(irreducibleLoopSwitch.keyAt(i).asInt()); sep = ", "; } ! debug.log(DebugContext.BASIC_LEVEL, "%s", msg); } } } }
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphDecoder.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File