# HG changeset patch # User Lukas Stadler # Date 1406555587 -7200 # Node ID cd25e42d9b22197c10b1f3a8b57c1772ff12e0fa # Parent 6e7311d571ffe588b90313c2f94405304b3b46df rename IntegerBelowThanNode to IntegerBelowNode diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java Mon Jul 28 14:48:11 2014 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java Mon Jul 28 15:53:07 2014 +0200 @@ -350,10 +350,10 @@ @MatchRule("(If (IntegerEquals=compare value Read=access))") @MatchRule("(If (IntegerLessThan=compare value Read=access))") - @MatchRule("(If (IntegerBelowThan=compare value Read=access))") + @MatchRule("(If (IntegerBelow=compare value Read=access))") @MatchRule("(If (IntegerEquals=compare value FloatingRead=access))") @MatchRule("(If (IntegerLessThan=compare value FloatingRead=access))") - @MatchRule("(If (IntegerBelowThan=compare value FloatingRead=access))") + @MatchRule("(If (IntegerBelow=compare value FloatingRead=access))") @MatchRule("(If (FloatEquals=compare value Read=access))") @MatchRule("(If (FloatEquals=compare value FloatingRead=access))") @MatchRule("(If (FloatLessThan=compare value Read=access))") diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Mon Jul 28 14:48:11 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Mon Jul 28 15:53:07 2014 +0200 @@ -74,7 +74,7 @@ @MatchableNode(nodeClass = FloatLessThanNode.class, inputs = {"x", "y"}, commutative = true) @MatchableNode(nodeClass = FloatMulNode.class, inputs = {"x", "y"}, commutative = true) @MatchableNode(nodeClass = IntegerAddNode.class, inputs = {"x", "y"}, commutative = true) -@MatchableNode(nodeClass = IntegerBelowThanNode.class, inputs = {"x", "y"}, commutative = true) +@MatchableNode(nodeClass = IntegerBelowNode.class, inputs = {"x", "y"}, commutative = true) @MatchableNode(nodeClass = IntegerEqualsNode.class, inputs = {"x", "y"}, commutative = true) @MatchableNode(nodeClass = IntegerLessThanNode.class, inputs = {"x", "y"}, commutative = true) @MatchableNode(nodeClass = IntegerMulNode.class, inputs = {"x", "y"}, commutative = true) diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java Mon Jul 28 14:48:11 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java Mon Jul 28 15:53:07 2014 +0200 @@ -243,12 +243,12 @@ @MatchRule("(If (IntegerEquals=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") @MatchRule("(If (IntegerLessThan=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") - @MatchRule("(If (IntegerBelowThan=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") + @MatchRule("(If (IntegerBelow=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") @MatchRule("(If (FloatEquals=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") @MatchRule("(If (FloatLessThan=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") @MatchRule("(If (IntegerEquals=compare value (Read=access (Compression=compress object) ConstantLocation=location)))") @MatchRule("(If (IntegerLessThan=compare value (Read=access (Compression=compress object) ConstantLocation=location)))") - @MatchRule("(If (IntegerBelowThan=compare value (Read=access (Compression=compress object) ConstantLocation=location)))") + @MatchRule("(If (IntegerBelow=compare value (Read=access (Compression=compress object) ConstantLocation=location)))") @MatchRule("(If (FloatEquals=compare value (Read=access (Compression=compress object) ConstantLocation=location)))") @MatchRule("(If (FloatLessThan=compare value (Read=access (Compression=compress object) ConstantLocation=location)))") public ComplexMatchResult ifCompareCompressedMemory(IfNode root, CompareNode compare, CompressionNode compress, ValueNode value, ConstantLocationNode location, Access access) { diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Mon Jul 28 14:48:11 2014 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Mon Jul 28 15:53:07 2014 +0200 @@ -666,7 +666,7 @@ protected void emitBoundsCheck(ValueNode index, ValueNode length) { BlockPlaceholderNode trueSucc = currentGraph.add(new BlockPlaceholderNode(this)); BlockPlaceholderNode falseSucc = currentGraph.add(new BlockPlaceholderNode(this)); - append(new IfNode(currentGraph.unique(new IntegerBelowThanNode(index, length)), trueSucc, falseSucc, 0.99)); + append(new IfNode(currentGraph.unique(new IntegerBelowNode(index, length)), trueSucc, falseSucc, 0.99)); lastInstr = trueSucc; BytecodeExceptionNode exception = currentGraph.add(new BytecodeExceptionNode(metaAccess, ArrayIndexOutOfBoundsException.class, index)); diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java Mon Jul 28 14:48:11 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java Mon Jul 28 15:53:07 2014 +0200 @@ -173,7 +173,7 @@ } LogicNode ifTest = ifNode.condition(); if (!(ifTest instanceof IntegerLessThanNode)) { - if (ifTest instanceof IntegerBelowThanNode) { + if (ifTest instanceof IntegerBelowNode) { Debug.log("Ignored potential Counted loop at %s with |<|", loopBegin); } return false; diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Mon Jul 28 14:48:11 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Mon Jul 28 15:53:07 2014 +0200 @@ -259,14 +259,14 @@ IntegerLessThanNode lessThan2 = (IntegerLessThanNode) ifNode2.condition(); BeginNode falseSucc = ifNode2.falseSuccessor(); BeginNode trueSucc = ifNode2.trueSuccessor(); - IntegerBelowThanNode below = null; + IntegerBelowNode below = null; /* * Convert x >= 0 && x < positive which is represented as !(x < 0) && x < * into an unsigned compare. */ if (lessThan2.getX() == lessThan.getX() && lessThan2.getY().stamp() instanceof IntegerStamp && ((IntegerStamp) lessThan2.getY().stamp()).isPositive() && sameDestination(trueSuccessor(), ifNode2.falseSuccessor)) { - below = graph().unique(new IntegerBelowThanNode(lessThan2.getX(), lessThan2.getY())); + below = graph().unique(new IntegerBelowNode(lessThan2.getX(), lessThan2.getY())); // swap direction BeginNode tmp = falseSucc; falseSucc = trueSucc; @@ -281,7 +281,7 @@ Constant positive = lessThan2.getX().asConstant(); if (positive != null && positive.asLong() > 0 && positive.asLong() < positive.getKind().getMaxValue()) { ConstantNode newLimit = ConstantNode.forIntegerKind(positive.getKind(), positive.asLong() + 1, graph()); - below = graph().unique(new IntegerBelowThanNode(lessThan.getX(), newLimit)); + below = graph().unique(new IntegerBelowNode(lessThan.getX(), newLimit)); } } if (below != null) { diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Mon Jul 28 14:48:11 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Mon Jul 28 15:53:07 2014 +0200 @@ -166,7 +166,7 @@ } else { assert condition == Condition.BT; assert x.getKind().isNumericInteger(); - comparison = new IntegerBelowThanNode(x, y); + comparison = new IntegerBelowNode(x, y); } return comparison; diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowNode.java Mon Jul 28 15:53:07 2014 +0200 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2011, 2014, 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.nodes.calc; + +import com.oracle.graal.compiler.common.calc.*; +import com.oracle.graal.compiler.common.type.*; +import com.oracle.graal.graph.*; +import com.oracle.graal.graph.spi.*; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.util.*; + +@NodeInfo(shortName = "|<|") +public final class IntegerBelowNode extends CompareNode { + + /** + * Constructs a new unsigned integer comparison node. + * + * @param x the instruction producing the first input to the instruction + * @param y the instruction that produces the second input to this instruction + */ + public IntegerBelowNode(ValueNode x, ValueNode y) { + super(x, y); + assert x.stamp() instanceof IntegerStamp; + assert y.stamp() instanceof IntegerStamp; + } + + @Override + public Condition condition() { + return Condition.BT; + } + + @Override + public boolean unorderedIsTrue() { + return false; + } + + @Override + public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { + ValueNode result = super.canonical(tool, forX, forY); + if (result != this) { + return result; + } + if (GraphUtil.unproxify(forX) == GraphUtil.unproxify(forY)) { + return LogicConstantNode.contradiction(); + } else if (forX.stamp() instanceof IntegerStamp && forY.stamp() instanceof IntegerStamp) { + IntegerStamp xStamp = (IntegerStamp) forX.stamp(); + IntegerStamp yStamp = (IntegerStamp) forY.stamp(); + if (yStamp.isPositive()) { + if (xStamp.isPositive() && xStamp.upperBound() < yStamp.lowerBound()) { + return LogicConstantNode.tautology(); + } else if (xStamp.isStrictlyNegative() || xStamp.lowerBound() >= yStamp.upperBound()) { + return LogicConstantNode.contradiction(); + } + } + } + if (forX.isConstant() && forX.asConstant().asLong() == 0) { + // 0 |<| y is the same as 0 != y + return new LogicNegationNode(CompareNode.createCompareNode(Condition.EQ, forX, forY)); + } + return this; + } + + @Override + protected CompareNode duplicateModified(ValueNode newX, ValueNode newY) { + return new IntegerBelowNode(newX, newY); + } +} diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowThanNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowThanNode.java Mon Jul 28 14:48:11 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2011, 2014, 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. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.nodes.calc; - -import com.oracle.graal.compiler.common.calc.*; -import com.oracle.graal.compiler.common.type.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.graph.spi.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.util.*; - -@NodeInfo(shortName = "|<|") -public final class IntegerBelowThanNode extends CompareNode { - - /** - * Constructs a new unsigned integer comparison node. - * - * @param x the instruction producing the first input to the instruction - * @param y the instruction that produces the second input to this instruction - */ - public IntegerBelowThanNode(ValueNode x, ValueNode y) { - super(x, y); - assert x.stamp() instanceof IntegerStamp; - assert y.stamp() instanceof IntegerStamp; - } - - @Override - public Condition condition() { - return Condition.BT; - } - - @Override - public boolean unorderedIsTrue() { - return false; - } - - @Override - public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { - ValueNode result = super.canonical(tool, forX, forY); - if (result != this) { - return result; - } - if (GraphUtil.unproxify(forX) == GraphUtil.unproxify(forY)) { - return LogicConstantNode.contradiction(); - } else if (forX.stamp() instanceof IntegerStamp && forY.stamp() instanceof IntegerStamp) { - IntegerStamp xStamp = (IntegerStamp) forX.stamp(); - IntegerStamp yStamp = (IntegerStamp) forY.stamp(); - if (yStamp.isPositive()) { - if (xStamp.isPositive() && xStamp.upperBound() < yStamp.lowerBound()) { - return LogicConstantNode.tautology(); - } else if (xStamp.isStrictlyNegative() || xStamp.lowerBound() >= yStamp.upperBound()) { - return LogicConstantNode.contradiction(); - } - } - } - if (forX.isConstant() && forX.asConstant().asLong() == 0) { - // 0 |<| y is the same as 0 != y - return new LogicNegationNode(CompareNode.createCompareNode(Condition.EQ, forX, forY)); - } - return this; - } - - @Override - protected CompareNode duplicateModified(ValueNode newX, ValueNode newY) { - return new IntegerBelowThanNode(newX, newY); - } -} diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java Mon Jul 28 14:48:11 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java Mon Jul 28 15:53:07 2014 +0200 @@ -91,7 +91,7 @@ } if (forX.stamp() instanceof IntegerStamp && forY.stamp() instanceof IntegerStamp) { if (IntegerStamp.sameSign((IntegerStamp) forX.stamp(), (IntegerStamp) forY.stamp())) { - return new IntegerBelowThanNode(forX, forY); + return new IntegerBelowNode(forX, forY); } } return this; diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java Mon Jul 28 14:48:11 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java Mon Jul 28 15:53:07 2014 +0200 @@ -446,12 +446,12 @@ } private GuardedStamp computeGuardedStamp(GuardNode guard) { - if (guard.condition() instanceof IntegerBelowThanNode) { + if (guard.condition() instanceof IntegerBelowNode) { if (guard.negated()) { // Not sure how to reason about negated guards return null; } - IntegerBelowThanNode below = (IntegerBelowThanNode) guard.condition(); + IntegerBelowNode below = (IntegerBelowNode) guard.condition(); if (below.getX().getKind() == Kind.Int && below.getX().isConstant() && !below.getY().isConstant()) { Stamp stamp = StampTool.unsignedCompare(below.getX().stamp(), below.getY().stamp()); if (stamp != null) { @@ -520,8 +520,8 @@ } GuardNode existingGuard = null; - if (guard.condition() instanceof IntegerBelowThanNode) { - IntegerBelowThanNode below = (IntegerBelowThanNode) guard.condition(); + if (guard.condition() instanceof IntegerBelowNode) { + IntegerBelowNode below = (IntegerBelowNode) guard.condition(); IntegerStamp xStamp = (IntegerStamp) below.getX().stamp(); IntegerStamp yStamp = (IntegerStamp) below.getY().stamp(); GuardedStamp cstamp = state.valueConstraints.get(below.getX()); diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java Mon Jul 28 14:48:11 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java Mon Jul 28 15:53:07 2014 +0200 @@ -646,7 +646,7 @@ } } - return tool.createGuard(n, graph.unique(new IntegerBelowThanNode(n.index(), arrayLength)), BoundsCheckException, InvalidateReprofile); + return tool.createGuard(n, graph.unique(new IntegerBelowNode(n.index(), arrayLength)), BoundsCheckException, InvalidateReprofile); } protected GuardingNode createNullCheck(ValueNode object, FixedNode before, LoweringTool tool) { diff -r 6e7311d571ff -r cd25e42d9b22 graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Mon Jul 28 14:48:11 2014 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Mon Jul 28 15:53:07 2014 +0200 @@ -355,7 +355,7 @@ if (condition == Condition.EQ || condition == Condition.NE) { comparison = new IntegerEqualsNode(a, b); } else if (condition.isUnsigned()) { - comparison = new IntegerBelowThanNode(a, b); + comparison = new IntegerBelowNode(a, b); } else { comparison = new IntegerLessThanNode(a, b); }