7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.virtual.phases.ea; 24 25 import java.util.ArrayList; 26 27 import org.graalvm.compiler.graph.Node; 28 import org.graalvm.compiler.nodes.ControlSinkNode; 29 import org.graalvm.compiler.nodes.FixedNode; 30 import org.graalvm.compiler.nodes.FixedWithNextNode; 31 import org.graalvm.compiler.nodes.FrameState; 32 import org.graalvm.compiler.nodes.IfNode; 33 import org.graalvm.compiler.nodes.PhiNode; 34 import org.graalvm.compiler.nodes.PiNode; 35 import org.graalvm.compiler.nodes.ProxyNode; 36 import org.graalvm.compiler.nodes.StructuredGraph; 37 import org.graalvm.compiler.nodes.ValueNode; 38 import org.graalvm.compiler.nodes.debug.DynamicCounterNode; 39 import org.graalvm.compiler.nodes.debug.WeakCounterNode; 40 import org.graalvm.compiler.nodes.util.GraphUtil; 41 import org.graalvm.compiler.nodes.virtual.EscapeObjectState; 42 import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase; 43 44 public final class GraphEffectList extends EffectList { 45 46 /** 47 * Determines how many objects are virtualized (positive) or materialized (negative) by this 48 * effect. 49 */ 50 private int virtualizationDelta; 51 52 @Override 53 public void clear() { 54 super.clear(); 55 virtualizationDelta = 0; 56 } 57 58 public void addCounterBefore(String group, String name, int increment, boolean addContext, FixedNode position) { 59 add("add counter", graph -> DynamicCounterNode.addCounterBefore(group, name, increment, addContext, position)); 60 } 61 62 public void addCounterAfter(String group, String name, int increment, boolean addContext, FixedWithNextNode position) { 63 FixedNode nextPosition = position.next(); 64 add("add counter after", graph -> DynamicCounterNode.addCounterBefore(group, name, increment, addContext, nextPosition)); 65 } | 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.virtual.phases.ea; 24 25 import java.util.ArrayList; 26 27 import org.graalvm.compiler.debug.DebugContext; 28 import org.graalvm.compiler.graph.Node; 29 import org.graalvm.compiler.nodes.ControlSinkNode; 30 import org.graalvm.compiler.nodes.FixedNode; 31 import org.graalvm.compiler.nodes.FixedWithNextNode; 32 import org.graalvm.compiler.nodes.FrameState; 33 import org.graalvm.compiler.nodes.IfNode; 34 import org.graalvm.compiler.nodes.PhiNode; 35 import org.graalvm.compiler.nodes.PiNode; 36 import org.graalvm.compiler.nodes.ProxyNode; 37 import org.graalvm.compiler.nodes.StructuredGraph; 38 import org.graalvm.compiler.nodes.ValueNode; 39 import org.graalvm.compiler.nodes.debug.DynamicCounterNode; 40 import org.graalvm.compiler.nodes.debug.WeakCounterNode; 41 import org.graalvm.compiler.nodes.util.GraphUtil; 42 import org.graalvm.compiler.nodes.virtual.EscapeObjectState; 43 import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase; 44 45 public final class GraphEffectList extends EffectList { 46 47 public GraphEffectList(DebugContext debug) { 48 super(debug); 49 } 50 51 /** 52 * Determines how many objects are virtualized (positive) or materialized (negative) by this 53 * effect. 54 */ 55 private int virtualizationDelta; 56 57 @Override 58 public void clear() { 59 super.clear(); 60 virtualizationDelta = 0; 61 } 62 63 public void addCounterBefore(String group, String name, int increment, boolean addContext, FixedNode position) { 64 add("add counter", graph -> DynamicCounterNode.addCounterBefore(group, name, increment, addContext, position)); 65 } 66 67 public void addCounterAfter(String group, String name, int increment, boolean addContext, FixedWithNextNode position) { 68 FixedNode nextPosition = position.next(); 69 add("add counter after", graph -> DynamicCounterNode.addCounterBefore(group, name, increment, addContext, nextPosition)); 70 } |