# HG changeset patch # User Lukas Stadler # Date 1403525514 -7200 # Node ID 0993768dfc8ec8247fde4d4dd9101a729ef89dc6 # Parent c903c4e693bfecac0ce2219afe67b517c27c8656 new UnaryNode base class diff -r c903c4e693bf -r 0993768dfc8e 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 Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java Mon Jun 23 14:11:54 2014 +0200 @@ -417,7 +417,7 @@ return builder -> { LIRKind writeKind = getLIRGeneratorTool().getLIRKind(root.value().stamp()); Value address = root.location().generateAddress(builder, getLIRGeneratorTool(), operand(root.object())); - Value v = operand(narrow.getInput()); + Value v = operand(narrow.getValue()); getLIRGeneratorTool().emitStore(writeKind, address, v, state(root)); return null; }; diff -r c903c4e693bf -r 0993768dfc8e 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 Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Mon Jun 23 14:11:54 2014 +0200 @@ -55,19 +55,19 @@ * This class traverses the HIR instructions and generates LIR instructions from them. */ @MatchableNode(nodeClass = ConstantNode.class, shareable = true) -@MatchableNode(nodeClass = FloatConvertNode.class, inputs = {"input"}) +@MatchableNode(nodeClass = FloatConvertNode.class, inputs = {"value"}) @MatchableNode(nodeClass = FloatSubNode.class, inputs = {"x", "y"}) @MatchableNode(nodeClass = FloatingReadNode.class, inputs = {"object", "location"}) @MatchableNode(nodeClass = IfNode.class, inputs = {"condition"}) @MatchableNode(nodeClass = IntegerSubNode.class, inputs = {"x", "y"}) @MatchableNode(nodeClass = LeftShiftNode.class, inputs = {"x", "y"}) -@MatchableNode(nodeClass = NarrowNode.class, inputs = {"input"}) +@MatchableNode(nodeClass = NarrowNode.class, inputs = {"value"}) @MatchableNode(nodeClass = ReadNode.class, inputs = {"object", "location"}) @MatchableNode(nodeClass = ReinterpretNode.class, inputs = {"value"}) -@MatchableNode(nodeClass = SignExtendNode.class, inputs = {"input"}) +@MatchableNode(nodeClass = SignExtendNode.class, inputs = {"value"}) @MatchableNode(nodeClass = UnsignedRightShiftNode.class, inputs = {"x", "y"}) @MatchableNode(nodeClass = WriteNode.class, inputs = {"object", "location", "value"}) -@MatchableNode(nodeClass = ZeroExtendNode.class, inputs = {"input"}) +@MatchableNode(nodeClass = ZeroExtendNode.class, inputs = {"value"}) @MatchableNode(nodeClass = AndNode.class, inputs = {"x", "y"}, commutative = true) @MatchableNode(nodeClass = FloatAddNode.class, inputs = {"x", "y"}, commutative = true) @MatchableNode(nodeClass = FloatEqualsNode.class, inputs = {"x", "y"}, commutative = true) diff -r c903c4e693bf -r 0993768dfc8e 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 Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java Mon Jun 23 14:11:54 2014 +0200 @@ -63,7 +63,7 @@ result = ((PiNode) result).getOriginalNode(); } if (result instanceof CompressionNode) { - result = ((CompressionNode) result).getInput(); + result = ((CompressionNode) result).getValue(); } return result; } @@ -223,7 +223,7 @@ boolean canFormCompressedMemory(CompressionNode compress, ConstantLocationNode location) { HotSpotVMConfig config = HotSpotGraalRuntime.runtime().getConfig(); if (config.useCompressedOops && compress.getEncoding().shift <= 3 && NumUtil.isInt(location.getDisplacement())) { - Stamp compressedStamp = compress.getInput().stamp(); + Stamp compressedStamp = compress.getValue().stamp(); if (compressedStamp instanceof NarrowOopStamp) { return true; } else if (compressedStamp instanceof IntegerStamp) { @@ -236,7 +236,7 @@ private AMD64AddressValue makeCompressedAddress(CompressionNode compress, ConstantLocationNode location) { assert canFormCompressedMemory(compress, location); - AMD64AddressValue address = getGen().emitAddress(getGen().getProviders().getRegisters().getHeapBaseRegister().asValue(), location.getDisplacement(), operand(compress.getInput()), + AMD64AddressValue address = getGen().emitAddress(getGen().getProviders().getRegisters().getHeapBaseRegister().asValue(), location.getDisplacement(), operand(compress.getValue()), 1 << compress.getEncoding().shift); return address; } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotNodeLIRBuilder.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotNodeLIRBuilder.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotNodeLIRBuilder.java Mon Jun 23 14:11:54 2014 +0200 @@ -32,7 +32,7 @@ * This interface defines the contract a HotSpot backend LIR generator needs to fulfill in addition * to abstract methods from {@link LIRGenerator} and {@link NodeLIRBuilderTool}. */ -@MatchableNode(nodeClass = CompressionNode.class, inputs = {"input"}) +@MatchableNode(nodeClass = CompressionNode.class, inputs = {"value"}) public interface HotSpotNodeLIRBuilder { void emitPatchReturnAddress(ValueNode address); diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -152,12 +152,12 @@ @Override public Node canonical(CanonicalizerTool tool) { - if (getInput().isConstant()) { - return ConstantNode.forConstant(stamp(), evalConst(getInput().asConstant()), tool.getMetaAccess(), graph()); - } else if (getInput() instanceof CompressionNode) { - CompressionNode other = (CompressionNode) getInput(); + if (getValue().isConstant()) { + return ConstantNode.forConstant(stamp(), evalConst(getValue().asConstant()), tool.getMetaAccess(), graph()); + } else if (getValue() instanceof CompressionNode) { + CompressionNode other = (CompressionNode) getValue(); if (op != other.op && encoding.equals(other.encoding)) { - return other.getInput(); + return other.getValue(); } } return this; @@ -167,8 +167,8 @@ public void generate(NodeLIRBuilderTool gen) { HotSpotLIRGenerator hsGen = (HotSpotLIRGenerator) gen.getLIRGeneratorTool(); boolean nonNull; - if (getInput().stamp() instanceof AbstractObjectStamp) { - nonNull = StampTool.isObjectNonNull(getInput().stamp()); + if (getValue().stamp() instanceof AbstractObjectStamp) { + nonNull = StampTool.isObjectNonNull(getValue().stamp()); } else { // metaspace pointers are never null nonNull = true; @@ -177,10 +177,10 @@ Value result; switch (op) { case Compress: - result = hsGen.emitCompress(gen.operand(getInput()), encoding, nonNull); + result = hsGen.emitCompress(gen.operand(getValue()), encoding, nonNull); break; case Uncompress: - result = hsGen.emitUncompress(gen.operand(getInput()), encoding, nonNull); + result = hsGen.emitUncompress(gen.operand(getValue()), encoding, nonNull); break; default: throw GraalInternalError.shouldNotReachHere(); diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -35,17 +35,12 @@ /** * A node that attaches a type profile to a proxied input node. */ -public final class TypeProfileProxyNode extends FloatingNode implements Canonicalizable, IterableNodeType, ValueProxy { +public final class TypeProfileProxyNode extends UnaryNode implements Canonicalizable, IterableNodeType, ValueProxy { - @Input private ValueNode object; private final JavaTypeProfile profile; private transient ResolvedJavaType lastCheckedType; private transient JavaTypeProfile lastCheckedProfile; - public ValueNode getObject() { - return object; - } - public static ValueNode create(ValueNode object, JavaTypeProfile profile) { if (StampTool.isExactType(object)) { return object; @@ -61,9 +56,8 @@ return object.graph().addWithoutUnique(new TypeProfileProxyNode(object, profile)); } - private TypeProfileProxyNode(ValueNode object, JavaTypeProfile profile) { - super(object.stamp()); - this.object = object; + private TypeProfileProxyNode(ValueNode value, JavaTypeProfile profile) { + super(value.stamp(), value); this.profile = profile; } @@ -73,16 +67,16 @@ @Override public boolean inferStamp() { - return updateStamp(object.stamp()); + return updateStamp(getValue().stamp()); } @Override public Node canonical(CanonicalizerTool tool) { - if (StampTool.isExactType(object)) { + if (StampTool.isExactType(getValue())) { // The profile is useless - we know the type! - return object; - } else if (object instanceof TypeProfileProxyNode) { - TypeProfileProxyNode other = (TypeProfileProxyNode) object; + return getValue(); + } else if (getValue() instanceof TypeProfileProxyNode) { + TypeProfileProxyNode other = (TypeProfileProxyNode) getValue(); JavaTypeProfile otherProfile = other.getProfile(); if (otherProfile == lastCheckedProfile) { // We have already incorporated the knowledge about this profile => abort. @@ -93,33 +87,33 @@ if (newProfile.equals(otherProfile)) { // We are useless - just use the other proxy node. Debug.log("Canonicalize with other proxy node."); - return object; + return getValue(); } if (newProfile != this.profile) { Debug.log("Improved profile via other profile."); - return TypeProfileProxyNode.create(object, newProfile); + return TypeProfileProxyNode.create(getValue(), newProfile); } - } else if (StampTool.typeOrNull(object) != null) { - ResolvedJavaType type = StampTool.typeOrNull(object); + } else if (StampTool.typeOrNull(getValue()) != null) { + ResolvedJavaType type = StampTool.typeOrNull(getValue()); ResolvedJavaType uniqueConcrete = type.findUniqueConcreteSubtype(); if (uniqueConcrete != null) { // Profile is useless => remove. Debug.log("Profile useless, there is enough static type information available."); - return object; + return getValue(); } if (Objects.equals(type, lastCheckedType)) { // We have already incorporate the knowledge about this type => abort. return this; } lastCheckedType = type; - JavaTypeProfile newProfile = this.profile.restrict(type, StampTool.isObjectNonNull(object)); + JavaTypeProfile newProfile = this.profile.restrict(type, StampTool.isObjectNonNull(getValue())); if (newProfile != this.profile) { Debug.log("Improved profile via static type information."); if (newProfile.getTypes().length == 0) { // Only null profiling is not beneficial enough to keep the node around. - return object; + return getValue(); } - return TypeProfileProxyNode.create(object, newProfile); + return TypeProfileProxyNode.create(getValue(), newProfile); } } return this; @@ -127,6 +121,6 @@ @Override public ValueNode getOriginalNode() { - return object; + return getValue(); } } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -71,7 +71,7 @@ if (x() instanceof SignExtendNode) { SignExtendNode ext = (SignExtendNode) x(); if (rawY == ((1L << ext.getInputBits()) - 1)) { - ValueNode result = graph().unique(new ZeroExtendNode(ext.getInput(), ext.getResultBits())); + ValueNode result = graph().unique(new ZeroExtendNode(ext.getValue(), ext.getResultBits())); return result; } } diff -r c903c4e693bf -r 0993768dfc8e 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 Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -115,8 +115,8 @@ } else if (x() instanceof ConvertNode && y() instanceof ConvertNode) { ConvertNode convertX = (ConvertNode) x(); ConvertNode convertY = (ConvertNode) y(); - if (convertX.preservesOrder(condition()) && convertY.preservesOrder(condition()) && convertX.getInput().stamp().isCompatible(convertY.getInput().stamp())) { - return graph().unique(duplicateModified(convertX.getInput(), convertY.getInput())); + if (convertX.preservesOrder(condition()) && convertY.preservesOrder(condition()) && convertX.getValue().stamp().isCompatible(convertY.getValue().stamp())) { + return graph().unique(duplicateModified(convertX.getValue(), convertY.getValue())); } } @@ -137,9 +137,9 @@ ConstantNode newConstant = canonicalConvertConstant(tool, convert, constant); if (newConstant != null) { if (mirrored) { - return graph().unique(duplicateModified(newConstant, convert.getInput())); + return graph().unique(duplicateModified(newConstant, convert.getValue())); } else { - return graph().unique(duplicateModified(convert.getInput(), newConstant)); + return graph().unique(duplicateModified(convert.getValue(), newConstant)); } } } @@ -150,7 +150,7 @@ if (convert.preservesOrder(condition())) { Constant reverseConverted = convert.reverse(constant); if (convert.convert(reverseConverted).equals(constant)) { - return ConstantNode.forConstant(convert.getInput().stamp(), reverseConverted, tool.getMetaAccess(), convert.graph()); + return ConstantNode.forConstant(convert.getValue().stamp(), reverseConverted, tool.getMetaAccess(), convert.graph()); } } return null; diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -31,17 +31,10 @@ /** * Represents a conversion between primitive types. */ -public abstract class ConvertNode extends FloatingNode implements ArithmeticOperation { - - @Input private ValueNode input; +public abstract class ConvertNode extends UnaryNode implements ArithmeticOperation { - protected ConvertNode(Stamp stamp, ValueNode input) { - super(stamp); - this.input = input; - } - - public ValueNode getInput() { - return input; + protected ConvertNode(Stamp stamp, ValueNode value) { + super(stamp, value); } public abstract Constant convert(Constant c); diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatConvertNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatConvertNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatConvertNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -95,7 +95,7 @@ @Override public boolean inferStamp() { - return updateStamp(createStamp(op, getInput())); + return updateStamp(createStamp(op, getValue())); } private static Constant convert(FloatConvert op, Constant value) { @@ -148,12 +148,12 @@ @Override public Node canonical(CanonicalizerTool tool) { - if (getInput().isConstant()) { - return ConstantNode.forPrimitive(evalConst(getInput().asConstant()), graph()); - } else if (getInput() instanceof FloatConvertNode) { - FloatConvertNode other = (FloatConvertNode) getInput(); + if (getValue().isConstant()) { + return ConstantNode.forPrimitive(evalConst(getValue().asConstant()), graph()); + } else if (getValue() instanceof FloatConvertNode) { + FloatConvertNode other = (FloatConvertNode) getValue(); if (other.isLossless() && other.op == this.op.reverse()) { - return other.getInput(); + return other.getValue(); } } return this; @@ -164,6 +164,6 @@ } public void generate(NodeMappableLIRBuilder builder, ArithmeticLIRGenerator gen) { - builder.setResult(this, gen.emitFloatConvert(op, builder.operand(getInput()))); + builder.setResult(this, gen.emitFloatConvert(op, builder.operand(getValue()))); } } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -82,9 +82,9 @@ } } if (x() instanceof NegateNode) { - return IntegerArithmeticNode.sub(graph(), y(), ((NegateNode) x()).x()); + return IntegerArithmeticNode.sub(graph(), y(), ((NegateNode) x()).getValue()); } else if (y() instanceof NegateNode) { - return IntegerArithmeticNode.sub(graph(), x(), ((NegateNode) y()).x()); + return IntegerArithmeticNode.sub(graph(), x(), ((NegateNode) y()).getValue()); } return this; } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -45,8 +45,8 @@ } public int getInputBits() { - if (getInput().stamp() instanceof IntegerStamp) { - return ((IntegerStamp) getInput().stamp()).getBits(); + if (getValue().stamp() instanceof IntegerStamp) { + return ((IntegerStamp) getValue().stamp()).getBits(); } else { return 0; } @@ -61,12 +61,12 @@ } protected ValueNode canonicalConvert() { - if (getInput().stamp() instanceof IntegerStamp) { - int inputBits = ((IntegerStamp) getInput().stamp()).getBits(); + if (getValue().stamp() instanceof IntegerStamp) { + int inputBits = ((IntegerStamp) getValue().stamp()).getBits(); if (inputBits == resultBits) { - return getInput(); - } else if (getInput().isConstant()) { - Constant ret = evalConst(getInput().asConstant()); + return getValue(); + } else if (getValue().isConstant()) { + Constant ret = evalConst(getValue().asConstant()); return ConstantNode.forIntegerBits(resultBits, ret.asLong(), graph()); } } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -112,7 +112,7 @@ return BinaryNode.reassociate(this, ValueNode.isConstantPredicate()); } if (y() instanceof NegateNode) { - return IntegerArithmeticNode.add(graph(), x(), ((NegateNode) y()).x()); + return IntegerArithmeticNode.add(graph(), x(), ((NegateNode) y()).getValue()); } return this; } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NarrowNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NarrowNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NarrowNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -68,31 +68,31 @@ return ret; } - if (getInput() instanceof NarrowNode) { + if (getValue() instanceof NarrowNode) { // zzzzzzzz yyyyxxxx -(narrow)-> yyyyxxxx -(narrow)-> xxxx // ==> zzzzzzzz yyyyxxxx -(narrow)-> xxxx - NarrowNode other = (NarrowNode) getInput(); - return graph().unique(new NarrowNode(other.getInput(), getResultBits())); - } else if (getInput() instanceof IntegerConvertNode) { + NarrowNode other = (NarrowNode) getValue(); + return graph().unique(new NarrowNode(other.getValue(), getResultBits())); + } else if (getValue() instanceof IntegerConvertNode) { // SignExtendNode or ZeroExtendNode - IntegerConvertNode other = (IntegerConvertNode) getInput(); + IntegerConvertNode other = (IntegerConvertNode) getValue(); if (getResultBits() == other.getInputBits()) { // xxxx -(extend)-> yyyy xxxx -(narrow)-> xxxx // ==> no-op - return other.getInput(); + return other.getValue(); } else if (getResultBits() < other.getInputBits()) { // yyyyxxxx -(extend)-> zzzzzzzz yyyyxxxx -(narrow)-> xxxx // ==> yyyyxxxx -(narrow)-> xxxx - return graph().unique(new NarrowNode(other.getInput(), getResultBits())); + return graph().unique(new NarrowNode(other.getValue(), getResultBits())); } else { if (other instanceof SignExtendNode) { // sxxx -(sign-extend)-> ssssssss sssssxxx -(narrow)-> sssssxxx // ==> sxxx -(sign-extend)-> sssssxxx - return graph().unique(new SignExtendNode(other.getInput(), getResultBits())); + return graph().unique(new SignExtendNode(other.getValue(), getResultBits())); } else if (other instanceof ZeroExtendNode) { // xxxx -(zero-extend)-> 00000000 00000xxx -(narrow)-> 0000xxxx // ==> xxxx -(zero-extend)-> 0000xxxx - return graph().unique(new ZeroExtendNode(other.getInput(), getResultBits())); + return graph().unique(new ZeroExtendNode(other.getValue(), getResultBits())); } } } @@ -102,11 +102,11 @@ @Override public boolean inferStamp() { - return updateStamp(StampTool.narrowingConversion(getInput().stamp(), getResultBits())); + return updateStamp(StampTool.narrowingConversion(getValue().stamp(), getResultBits())); } @Override public void generate(NodeMappableLIRBuilder builder, ArithmeticLIRGenerator gen) { - builder.setResult(this, gen.emitNarrow(builder.operand(getInput()), getResultBits())); + builder.setResult(this, gen.emitNarrow(builder.operand(getValue()), getResultBits())); } } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -34,27 +34,20 @@ /** * The {@code NegateNode} node negates its operand. */ -public final class NegateNode extends FloatingNode implements Canonicalizable, ArithmeticLIRLowerable, NarrowableArithmeticNode { - - @Input private ValueNode x; - - public ValueNode x() { - return x; - } +public final class NegateNode extends UnaryNode implements Canonicalizable, ArithmeticLIRLowerable, NarrowableArithmeticNode { @Override public boolean inferStamp() { - return updateStamp(StampTool.negate(x().stamp())); + return updateStamp(StampTool.negate(getValue().stamp())); } /** * Creates new NegateNode instance. * - * @param x the instruction producing the value that is input to this instruction + * @param value the instruction producing the value that is input to this instruction */ - public NegateNode(ValueNode x) { - super(StampTool.negate(x.stamp())); - this.x = x; + public NegateNode(ValueNode value) { + super(StampTool.negate(value.stamp()), value); } public Constant evalConst(Constant... inputs) { @@ -76,14 +69,14 @@ @Override public Node canonical(CanonicalizerTool tool) { - if (x().isConstant()) { - return ConstantNode.forPrimitive(evalConst(x.asConstant()), graph()); + if (getValue().isConstant()) { + return ConstantNode.forPrimitive(evalConst(getValue().asConstant()), graph()); } - if (x() instanceof NegateNode) { - return ((NegateNode) x()).x(); + if (getValue() instanceof NegateNode) { + return ((NegateNode) getValue()).getValue(); } - if (x() instanceof IntegerSubNode) { - IntegerSubNode sub = (IntegerSubNode) x; + if (getValue() instanceof IntegerSubNode) { + IntegerSubNode sub = (IntegerSubNode) getValue(); return IntegerArithmeticNode.sub(graph(), sub.y(), sub.x()); } return this; @@ -91,6 +84,6 @@ @Override public void generate(NodeMappableLIRBuilder builder, ArithmeticLIRGenerator gen) { - builder.setResult(this, gen.emitNegate(builder.operand(x()))); + builder.setResult(this, gen.emitNegate(builder.operand(getValue()))); } } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NotNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NotNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NotNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -34,17 +34,11 @@ /** * Binary negation of long or integer values. */ -public final class NotNode extends FloatingNode implements Canonicalizable, ArithmeticLIRLowerable, NarrowableArithmeticNode { - - @Input private ValueNode x; - - public ValueNode x() { - return x; - } +public final class NotNode extends UnaryNode implements Canonicalizable, ArithmeticLIRLowerable, NarrowableArithmeticNode { @Override public boolean inferStamp() { - return updateStamp(StampTool.not(x().stamp())); + return updateStamp(StampTool.not(getValue().stamp())); } @Override @@ -59,23 +53,22 @@ * @param x the instruction producing the value that is input to this instruction */ public NotNode(ValueNode x) { - super(StampTool.not(x.stamp())); - this.x = x; + super(StampTool.not(x.stamp()), x); } @Override public Node canonical(CanonicalizerTool tool) { - if (x().isConstant()) { - return ConstantNode.forPrimitive(evalConst(x().asConstant()), graph()); + if (getValue().isConstant()) { + return ConstantNode.forPrimitive(evalConst(getValue().asConstant()), graph()); } - if (x() instanceof NotNode) { - return ((NotNode) x()).x(); + if (getValue() instanceof NotNode) { + return ((NotNode) getValue()).getValue(); } return this; } @Override public void generate(NodeMappableLIRBuilder builder, ArithmeticLIRGenerator gen) { - builder.setResult(this, gen.emitNot(builder.operand(x()))); + builder.setResult(this, gen.emitNot(builder.operand(getValue()))); } } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -36,22 +36,15 @@ * of a primitive value to some other incompatible stamp. The new stamp must have the same width as * the old stamp. */ -public class ReinterpretNode extends FloatingNode implements Canonicalizable, ArithmeticLIRLowerable { - - @Input private ValueNode value; - - public ValueNode value() { - return value; - } +public class ReinterpretNode extends UnaryNode implements Canonicalizable, ArithmeticLIRLowerable { private ReinterpretNode(Kind to, ValueNode value) { this(StampFactory.forKind(to), value); } public ReinterpretNode(Stamp to, ValueNode value) { - super(to); + super(to, value); assert to instanceof PrimitiveStamp; - this.value = value; } public Constant evalConst(Constant... inputs) { @@ -89,15 +82,15 @@ @Override public Node canonical(CanonicalizerTool tool) { - if (value.isConstant()) { - return ConstantNode.forPrimitive(evalConst(value.asConstant()), graph()); + if (getValue().isConstant()) { + return ConstantNode.forPrimitive(evalConst(getValue().asConstant()), graph()); } - if (stamp().isCompatible(value.stamp())) { - return value; + if (stamp().isCompatible(getValue().stamp())) { + return getValue(); } - if (value instanceof ReinterpretNode) { - ReinterpretNode reinterpret = (ReinterpretNode) value; - return value.graph().unique(new ReinterpretNode(stamp(), reinterpret.value())); + if (getValue() instanceof ReinterpretNode) { + ReinterpretNode reinterpret = (ReinterpretNode) getValue(); + return getValue().graph().unique(new ReinterpretNode(stamp(), reinterpret.getValue())); } return this; } @@ -105,7 +98,7 @@ @Override public void generate(NodeMappableLIRBuilder builder, ArithmeticLIRGenerator gen) { LIRKind kind = gen.getLIRKind(stamp()); - builder.setResult(this, gen.emitReinterpret(kind, builder.operand(value()))); + builder.setResult(this, gen.emitReinterpret(kind, builder.operand(getValue()))); } public static ValueNode reinterpret(Kind toKind, ValueNode value) { diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SignExtendNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SignExtendNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SignExtendNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -74,26 +74,26 @@ return ret; } - if (getInput() instanceof SignExtendNode) { + if (getValue() instanceof SignExtendNode) { // sxxx -(sign-extend)-> ssss sxxx -(sign-extend)-> ssssssss sssssxxx // ==> sxxx -(sign-extend)-> ssssssss sssssxxx - SignExtendNode other = (SignExtendNode) getInput(); - return graph().unique(new SignExtendNode(other.getInput(), getResultBits())); - } else if (getInput() instanceof ZeroExtendNode) { - ZeroExtendNode other = (ZeroExtendNode) getInput(); + SignExtendNode other = (SignExtendNode) getValue(); + return graph().unique(new SignExtendNode(other.getValue(), getResultBits())); + } else if (getValue() instanceof ZeroExtendNode) { + ZeroExtendNode other = (ZeroExtendNode) getValue(); if (other.getResultBits() > other.getInputBits()) { // sxxx -(zero-extend)-> 0000 sxxx -(sign-extend)-> 00000000 0000sxxx // ==> sxxx -(zero-extend)-> 00000000 0000sxxx - return graph().unique(new ZeroExtendNode(other.getInput(), getResultBits())); + return graph().unique(new ZeroExtendNode(other.getValue(), getResultBits())); } } - if (getInput().stamp() instanceof IntegerStamp) { - IntegerStamp inputStamp = (IntegerStamp) getInput().stamp(); + if (getValue().stamp() instanceof IntegerStamp) { + IntegerStamp inputStamp = (IntegerStamp) getValue().stamp(); if ((inputStamp.upMask() & (1L << (getInputBits() - 1))) == 0L) { // 0xxx -(sign-extend)-> 0000 0xxx // ==> 0xxx -(zero-extend)-> 0000 0xxx - return graph().unique(new ZeroExtendNode(getInput(), getResultBits())); + return graph().unique(new ZeroExtendNode(getValue(), getResultBits())); } } @@ -102,11 +102,11 @@ @Override public boolean inferStamp() { - return updateStamp(StampTool.signExtend(getInput().stamp(), getResultBits())); + return updateStamp(StampTool.signExtend(getValue().stamp(), getResultBits())); } @Override public void generate(NodeMappableLIRBuilder builder, ArithmeticLIRGenerator gen) { - builder.setResult(this, gen.emitSignExtend(builder.operand(getInput()), getInputBits(), getResultBits())); + builder.setResult(this, gen.emitSignExtend(builder.operand(getValue()), getInputBits(), getResultBits())); } } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnaryNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnaryNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, 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.type.*; +import com.oracle.graal.nodes.*; + +/** + * The {@code UnaryNode} class is the base of arithmetic and bit logic operations with exactly one + * input. + */ +public abstract class UnaryNode extends FloatingNode { + + @Input private ValueNode value; + + public ValueNode getValue() { + return value; + } + + /** + * Creates a new UnaryNode instance. + * + * @param stamp the result type of this instruction + * @param value the input instruction + */ + public UnaryNode(Stamp stamp, ValueNode value) { + super(stamp); + this.value = value; + } +} diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ZeroExtendNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ZeroExtendNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ZeroExtendNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -84,22 +84,22 @@ return ret; } - if (getInput() instanceof ZeroExtendNode) { + if (getValue() instanceof ZeroExtendNode) { // xxxx -(zero-extend)-> 0000 xxxx -(zero-extend)-> 00000000 0000xxxx // ==> xxxx -(zero-extend)-> 00000000 0000xxxx - ZeroExtendNode other = (ZeroExtendNode) getInput(); - return graph().unique(new ZeroExtendNode(other.getInput(), getResultBits())); + ZeroExtendNode other = (ZeroExtendNode) getValue(); + return graph().unique(new ZeroExtendNode(other.getValue(), getResultBits())); } - if (getInput() instanceof NarrowNode) { - NarrowNode narrow = (NarrowNode) getInput(); - Stamp inputStamp = narrow.getInput().stamp(); + if (getValue() instanceof NarrowNode) { + NarrowNode narrow = (NarrowNode) getValue(); + Stamp inputStamp = narrow.getValue().stamp(); if (inputStamp instanceof IntegerStamp && inputStamp.isCompatible(stamp())) { IntegerStamp istamp = (IntegerStamp) inputStamp; long mask = IntegerStamp.defaultMask(PrimitiveStamp.getBits(narrow.stamp())); if (((istamp.upMask() | istamp.downMask()) & ~mask) == 0) { // The original value is in the range of the masked zero extended result so // simply return the original input. - return narrow.getInput(); + return narrow.getValue(); } } } @@ -109,11 +109,11 @@ @Override public boolean inferStamp() { - return updateStamp(StampTool.zeroExtend(getInput().stamp(), getResultBits())); + return updateStamp(StampTool.zeroExtend(getValue().stamp(), getResultBits())); } @Override public void generate(NodeMappableLIRBuilder builder, ArithmeticLIRGenerator gen) { - builder.setResult(this, gen.emitZeroExtend(builder.operand(getInput()), getInputBits(), getResultBits())); + builder.setResult(this, gen.emitZeroExtend(builder.operand(getValue()), getInputBits(), getResultBits())); } } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -39,14 +39,12 @@ * This node represents the boxing of a primitive value. This corresponds to a call to the valueOf * methods in Integer, Long, etc. */ -public class BoxNode extends FloatingNode implements VirtualizableAllocation, Lowerable, Canonicalizable { +public class BoxNode extends UnaryNode implements VirtualizableAllocation, Lowerable, Canonicalizable { - @Input private ValueNode value; private final Kind boxingKind; public BoxNode(ValueNode value, ResolvedJavaType resultType, Kind boxingKind) { - super(StampFactory.exactNonNull(resultType)); - this.value = value; + super(StampFactory.exactNonNull(resultType), value); this.boxingKind = boxingKind; } @@ -54,10 +52,6 @@ return boxingKind; } - public ValueNode getValue() { - return value; - } - @Override public void lower(LoweringTool tool) { tool.getLowerer().lower(this, tool); diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -30,14 +30,12 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; -public class UnboxNode extends FloatingNode implements Virtualizable, Lowerable, Canonicalizable { +public class UnboxNode extends UnaryNode implements Virtualizable, Lowerable, Canonicalizable { - @Input private ValueNode value; private final Kind boxingKind; public UnboxNode(ValueNode value, Kind boxingKind) { - super(StampFactory.forKind(boxingKind.getStackKind())); - this.value = value; + super(StampFactory.forKind(boxingKind.getStackKind()), value); this.boxingKind = boxingKind; } @@ -45,10 +43,6 @@ return boxingKind; } - public ValueNode getValue() { - return value; - } - @Override public void lower(LoweringTool tool) { tool.getLowerer().lower(this, tool); @@ -56,7 +50,7 @@ @Override public void virtualize(VirtualizerTool tool) { - State state = tool.getObjectState(value); + State state = tool.getObjectState(getValue()); if (state != null && state.getState() == EscapeState.Virtual) { ResolvedJavaType objectType = state.getVirtualObject().type(); ResolvedJavaType expectedType = tool.getMetaAccessProvider().lookupJavaType(boxingKind.toBoxedJavaClass()); @@ -68,14 +62,14 @@ @Override public Node canonical(CanonicalizerTool tool) { - if (value.isConstant()) { - Constant constant = value.asConstant(); + if (getValue().isConstant()) { + Constant constant = getValue().asConstant(); Constant unboxed = tool.getConstantReflection().unboxPrimitive(constant); if (unboxed != null && unboxed.getKind() == boxingKind) { return ConstantNode.forConstant(unboxed, tool.getMetaAccess(), graph()); } - } else if (value instanceof BoxNode) { - BoxNode box = (BoxNode) value; + } else if (getValue() instanceof BoxNode) { + BoxNode box = (BoxNode) getValue(); if (boxingKind == box.getBoxingKind()) { return box.getValue(); } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CleanTypeProfileProxyPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CleanTypeProfileProxyPhase.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CleanTypeProfileProxyPhase.java Mon Jun 23 14:11:54 2014 +0200 @@ -30,7 +30,7 @@ @Override protected void run(StructuredGraph graph) { for (TypeProfileProxyNode proxy : graph.getNodes(TypeProfileProxyNode.class)) { - graph.replaceFloating(proxy, proxy.getObject()); + graph.replaceFloating(proxy, proxy.getValue()); } assert graph.getNodes(TypeProfileProxyNode.class).count() == 0; } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/EquationalReasoner.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/EquationalReasoner.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/EquationalReasoner.java Mon Jun 23 14:11:54 2014 +0200 @@ -629,7 +629,7 @@ } TypeProfileProxyNode profile = (TypeProfileProxyNode) object; ObjectStamp outgoinStamp = (ObjectStamp) profile.stamp(); - ObjectStamp payloadStamp = (ObjectStamp) profile.getObject().stamp(); + ObjectStamp payloadStamp = (ObjectStamp) profile.getValue().stamp(); if (payloadStamp.nonNull() && !outgoinStamp.nonNull()) { profile.setStamp(FlowUtil.asNonNullStamp(outgoinStamp)); } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java --- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java Mon Jun 23 14:11:54 2014 +0200 @@ -181,8 +181,8 @@ StructuredGraph graph = convert.graph(); Arguments args = new Arguments(key, graph.getGuardsStage(), tool.getLoweringStage()); - args.add("input", convert.getInput()); - args.add("result", graph.unique(new AMD64FloatConvertNode(convert.stamp(), convert.getOp(), convert.getInput()))); + args.add("input", convert.getValue()); + args.add("result", graph.unique(new AMD64FloatConvertNode(convert.stamp(), convert.getOp(), convert.getValue()))); SnippetTemplate template = template(args); Debug.log("Lowering %s in %s: node=%s, template=%s, arguments=%s", convert.getOp(), graph, convert, template, args); diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java --- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -36,15 +36,13 @@ * of the {@link FloatConvertNode} which, on AMD64 needs a {@link AMD64FloatConvertNode} plus some * fixup code that handles the corner cases that differ between AMD64 and Java. */ -public class AMD64FloatConvertNode extends FloatingNode implements ArithmeticLIRLowerable { +public class AMD64FloatConvertNode extends UnaryNode implements ArithmeticLIRLowerable { private final FloatConvert op; - @Input private ValueNode value; public AMD64FloatConvertNode(Stamp stamp, FloatConvert op, ValueNode value) { - super(stamp); + super(stamp, value); this.op = op; - this.value = value; } public Constant evalConst(Constant... inputs) { @@ -53,6 +51,6 @@ } public void generate(NodeMappableLIRBuilder builder, ArithmeticLIRGenerator gen) { - builder.setResult(this, gen.emitFloatConvert(op, builder.operand(value))); + builder.setResult(this, gen.emitFloatConvert(op, builder.operand(getValue()))); } } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java Mon Jun 23 14:11:54 2014 +0200 @@ -114,7 +114,7 @@ SignExtendNode convert = (SignExtendNode) location.getIndex(); Assert.assertEquals(convert.getInputBits(), 32); Assert.assertEquals(convert.getResultBits(), 64); - Assert.assertEquals(graph.getParameter(1), convert.getInput()); + Assert.assertEquals(graph.getParameter(1), convert.getValue()); } else { Assert.assertEquals(graph.getParameter(1), location.getIndex()); } @@ -138,7 +138,7 @@ SignExtendNode convert = (SignExtendNode) location.getIndex(); Assert.assertEquals(convert.getInputBits(), 32); Assert.assertEquals(convert.getResultBits(), 64); - Assert.assertEquals(graph.getParameter(1), convert.getInput()); + Assert.assertEquals(graph.getParameter(1), convert.getValue()); } else { Assert.assertEquals(graph.getParameter(1), location.getIndex()); } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Mon Jun 23 14:11:54 2014 +0200 @@ -125,7 +125,7 @@ SignExtendNode convert = (SignExtendNode) location.getIndex(); Assert.assertEquals(convert.getInputBits(), 32); Assert.assertEquals(convert.getResultBits(), 64); - Assert.assertEquals(graph.getParameter(1), convert.getInput()); + Assert.assertEquals(graph.getParameter(1), convert.getValue()); } else { Assert.assertEquals(graph.getParameter(1), location.getIndex()); } @@ -154,7 +154,7 @@ SignExtendNode convert = (SignExtendNode) location.getIndex(); Assert.assertEquals(convert.getInputBits(), 32); Assert.assertEquals(convert.getResultBits(), 64); - Assert.assertEquals(graph.getParameter(1), convert.getInput()); + Assert.assertEquals(graph.getParameter(1), convert.getValue()); } else { Assert.assertEquals(graph.getParameter(1), location.getIndex()); } diff -r c903c4e693bf -r 0993768dfc8e 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 Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java Mon Jun 23 14:11:54 2014 +0200 @@ -580,7 +580,7 @@ SignExtendNode extend = (SignExtendNode) offset; if (extend.getResultBits() == 64) { signExtend = true; - offset = extend.getInput(); + offset = extend.getValue(); } } if (offset instanceof IntegerAddNode) { diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitCountNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitCountNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitCountNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -30,19 +30,16 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; -public class BitCountNode extends FloatingNode implements LIRLowerable, Canonicalizable { - - @Input private ValueNode value; +public class BitCountNode extends UnaryNode implements LIRLowerable, Canonicalizable { public BitCountNode(ValueNode value) { - super(StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits())); - this.value = value; + super(StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits()), value); } @Override public Node canonical(CanonicalizerTool tool) { - if (value.isConstant()) { - Constant c = value.asConstant(); + if (getValue().isConstant()) { + Constant c = getValue().asConstant(); if (c.getKind() == Kind.Int) { return ConstantNode.forInt(Integer.bitCount(c.asInt()), graph()); } else if (c.getKind() == Kind.Long) { @@ -64,7 +61,7 @@ @Override public void generate(NodeLIRBuilderTool gen) { - Value result = gen.getLIRGeneratorTool().emitBitCount(gen.operand(value)); + Value result = gen.getLIRGeneratorTool().emitBitCount(gen.operand(getValue())); gen.setResult(this, result); } } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanForwardNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanForwardNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanForwardNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -30,19 +30,16 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; -public class BitScanForwardNode extends FloatingNode implements LIRLowerable, Canonicalizable { - - @Input private ValueNode value; +public class BitScanForwardNode extends UnaryNode implements LIRLowerable, Canonicalizable { public BitScanForwardNode(ValueNode value) { - super(StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits())); - this.value = value; + super(StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits()), value); } @Override public Node canonical(CanonicalizerTool tool) { - if (value.isConstant()) { - Constant c = value.asConstant(); + if (getValue().isConstant()) { + Constant c = getValue().asConstant(); if (c.getKind() == Kind.Int) { return ConstantNode.forInt(Integer.numberOfTrailingZeros(c.asInt()), graph()); } else if (c.getKind() == Kind.Long) { @@ -71,7 +68,7 @@ @Override public void generate(NodeLIRBuilderTool gen) { - Value result = gen.getLIRGeneratorTool().emitBitScanForward(gen.operand(value)); + Value result = gen.getLIRGeneratorTool().emitBitScanForward(gen.operand(getValue())); gen.setResult(this, result); } } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanReverseNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanReverseNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanReverseNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -30,19 +30,16 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; -public class BitScanReverseNode extends FloatingNode implements LIRLowerable, Canonicalizable { - - @Input private ValueNode value; +public class BitScanReverseNode extends UnaryNode implements LIRLowerable, Canonicalizable { public BitScanReverseNode(ValueNode value) { - super(StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits())); - this.value = value; + super(StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits()), value); } @Override public Node canonical(CanonicalizerTool tool) { - if (value.isConstant()) { - Constant c = value.asConstant(); + if (getValue().isConstant()) { + Constant c = getValue().asConstant(); if (c.getKind() == Kind.Int) { return ConstantNode.forInt(31 - Integer.numberOfLeadingZeros(c.asInt()), graph()); } else if (c.getKind() == Kind.Long) { @@ -78,7 +75,7 @@ @Override public void generate(NodeLIRBuilderTool gen) { - Value result = gen.getLIRGeneratorTool().emitBitScanReverse(gen.operand(value)); + Value result = gen.getLIRGeneratorTool().emitBitScanReverse(gen.operand(getValue())); gen.setResult(this, result); } diff -r c903c4e693bf -r 0993768dfc8e graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReverseBytesNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReverseBytesNode.java Fri Jun 20 12:09:46 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReverseBytesNode.java Mon Jun 23 14:11:54 2014 +0200 @@ -30,20 +30,17 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; -public class ReverseBytesNode extends FloatingNode implements LIRLowerable, Canonicalizable { - - @Input private ValueNode value; +public class ReverseBytesNode extends UnaryNode implements LIRLowerable, Canonicalizable { public ReverseBytesNode(ValueNode value) { - super(StampFactory.forKind(value.getKind())); + super(StampFactory.forKind(value.getKind()), value); assert getKind().isNumericInteger(); - this.value = value; } @Override public Node canonical(CanonicalizerTool tool) { - if (value.isConstant()) { - long v = value.asConstant().asLong(); + if (getValue().isConstant()) { + long v = getValue().asConstant().asLong(); if (getKind().getStackKind() == Kind.Int) { return ConstantNode.forInt(Integer.reverseBytes((int) v), graph()); } else if (getKind() == Kind.Long) { @@ -65,7 +62,7 @@ @Override public void generate(NodeLIRBuilderTool gen) { - Value result = gen.getLIRGeneratorTool().emitByteSwap(gen.operand(value)); + Value result = gen.getLIRGeneratorTool().emitByteSwap(gen.operand(getValue())); gen.setResult(this, result); } }