< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Graph.java

Print this page
rev 52889 : 8214023: Update Graal

*** 1,7 **** /* ! * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 23,35 **** package org.graalvm.compiler.graph; import static org.graalvm.compiler.core.common.GraalOptions.TrackNodeInsertion; - import static org.graalvm.compiler.graph.Graph.SourcePositionTracking.Default; - import static org.graalvm.compiler.graph.Graph.SourcePositionTracking.Track; - import static org.graalvm.compiler.graph.Graph.SourcePositionTracking.UpdateOnly; import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_IGNORED; import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_IGNORED; import java.util.ArrayList; import java.util.Arrays; --- 23,32 ----
*** 73,89 **** Unfrozen, TemporaryFreeze, DeepFreeze } - public enum SourcePositionTracking { - Default, - Ignore, - UpdateOnly, - Track - } - public final String name; /** * The set of nodes in the graph, ordered by {@linkplain #register(Node) registration} time. */ --- 70,79 ----
*** 95,105 **** NodeSourcePosition currentNodeSourcePosition; /** * Records if updating of node source information is required when performing inlining. */ ! protected SourcePositionTracking trackNodeSourcePosition; /** * The number of valid entries in {@link #nodes}. */ int nodesSize; --- 85,95 ---- NodeSourcePosition currentNodeSourcePosition; /** * Records if updating of node source information is required when performing inlining. */ ! protected boolean trackNodeSourcePosition; /** * The number of valid entries in {@link #nodes}. */ int nodesSize;
*** 222,263 **** */ public DebugCloseable withoutNodeSourcePosition() { return new NodeSourcePositionScope(null); } - /** - * Determines if this graph might contain nodes with source information. This is mainly useful - * to short circuit logic for updating those positions after inlining since that requires - * visiting every node in the graph. - */ - public boolean updateNodeSourcePosition() { - return trackNodeSourcePosition == Track || trackNodeSourcePosition == UpdateOnly; - } - public boolean trackNodeSourcePosition() { ! return trackNodeSourcePosition == Track; } public void setTrackNodeSourcePosition() { ! if (trackNodeSourcePosition != Track) { ! assert trackNodeSourcePosition == Default : trackNodeSourcePosition; ! trackNodeSourcePosition = Track; } } ! public static SourcePositionTracking trackNodeSourcePositionDefault(OptionValues options, DebugContext debug) { ! if (GraalOptions.TrackNodeSourcePosition.getValue(options) || debug.isDumpEnabledForMethod()) { ! return Track; ! } ! return Default; } /** * Creates an empty Graph with no name. */ public Graph(OptionValues options, DebugContext debug) { ! this(null, options, debug); } /** * We only want the expensive modification count tracking when assertions are enabled for the * {@link Graph} class. --- 212,241 ---- */ public DebugCloseable withoutNodeSourcePosition() { return new NodeSourcePositionScope(null); } public boolean trackNodeSourcePosition() { ! return trackNodeSourcePosition; } public void setTrackNodeSourcePosition() { ! if (!trackNodeSourcePosition) { ! assert getNodeCount() == 1 : "can't change the value after nodes have been added"; ! trackNodeSourcePosition = true; } } ! public static boolean trackNodeSourcePositionDefault(OptionValues options, DebugContext debug) { ! return (GraalOptions.TrackNodeSourcePosition.getValue(options) || debug.isDumpEnabledForMethod()); } /** * Creates an empty Graph with no name. */ public Graph(OptionValues options, DebugContext debug) { ! this(null, options, debug, false); } /** * We only want the expensive modification count tracking when assertions are enabled for the * {@link Graph} class.
*** 274,290 **** /** * Creates an empty Graph with a given name. * * @param name the name of the graph, used for debugging purposes */ ! public Graph(String name, OptionValues options, DebugContext debug) { nodes = new Node[INITIAL_NODES_SIZE]; iterableNodesFirst = new ArrayList<>(NodeClass.allocatedNodeIterabledIds()); iterableNodesLast = new ArrayList<>(NodeClass.allocatedNodeIterabledIds()); this.name = name; this.options = options; ! this.trackNodeSourcePosition = trackNodeSourcePositionDefault(options, debug); assert debug != null; this.debug = debug; if (isModificationCountsEnabled()) { nodeModCounts = new int[INITIAL_NODES_SIZE]; --- 252,268 ---- /** * Creates an empty Graph with a given name. * * @param name the name of the graph, used for debugging purposes */ ! public Graph(String name, OptionValues options, DebugContext debug, boolean trackNodeSourcePosition) { nodes = new Node[INITIAL_NODES_SIZE]; iterableNodesFirst = new ArrayList<>(NodeClass.allocatedNodeIterabledIds()); iterableNodesLast = new ArrayList<>(NodeClass.allocatedNodeIterabledIds()); this.name = name; this.options = options; ! this.trackNodeSourcePosition = trackNodeSourcePosition || trackNodeSourcePositionDefault(options, debug); assert debug != null; this.debug = debug; if (isModificationCountsEnabled()) { nodeModCounts = new int[INITIAL_NODES_SIZE];
*** 383,396 **** * @param debugForCopy the debug context for the graph copy. This must not be the debug for this * graph if this graph can be accessed from multiple threads (e.g., it's in a cache * accessed by multiple threads). */ protected Graph copy(String newName, Consumer<UnmodifiableEconomicMap<Node, Node>> duplicationMapCallback, DebugContext debugForCopy) { ! Graph copy = new Graph(newName, options, debugForCopy); ! if (trackNodeSourcePosition()) { ! copy.setTrackNodeSourcePosition(); ! } UnmodifiableEconomicMap<Node, Node> duplicates = copy.addDuplicates(getNodes(), this, this.getNodeCount(), (EconomicMap<Node, Node>) null); if (duplicationMapCallback != null) { duplicationMapCallback.accept(duplicates); } return copy; --- 361,371 ---- * @param debugForCopy the debug context for the graph copy. This must not be the debug for this * graph if this graph can be accessed from multiple threads (e.g., it's in a cache * accessed by multiple threads). */ protected Graph copy(String newName, Consumer<UnmodifiableEconomicMap<Node, Node>> duplicationMapCallback, DebugContext debugForCopy) { ! Graph copy = new Graph(newName, options, debugForCopy, trackNodeSourcePosition()); UnmodifiableEconomicMap<Node, Node> duplicates = copy.addDuplicates(getNodes(), this, this.getNodeCount(), (EconomicMap<Node, Node>) null); if (duplicationMapCallback != null) { duplicationMapCallback.accept(duplicates); } return copy;
*** 553,563 **** NODE_ADDED, /** * A node was removed from the graph. */ ! NODE_REMOVED; } /** * Client interested in one or more node related events. */ --- 528,538 ---- NODE_ADDED, /** * A node was removed from the graph. */ ! NODE_REMOVED } /** * Client interested in one or more node related events. */
< prev index next >