# HG changeset patch # User Lukas Stadler # Date 1403706917 -7200 # Node ID b558af6ff4bca2f4aae41bb0042bcda625e1ef68 # Parent dcaf26339f7c45c725cb9e2e3c8ef12f687ed432 don't pass stamps to arithmetic node constructors diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Wed Jun 25 16:35:17 2014 +0200 @@ -25,10 +25,9 @@ import org.junit.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.loop.phases.*; -import com.oracle.graal.nodes.calc.*; +import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.virtual.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.schedule.*; @@ -279,7 +278,7 @@ @SuppressWarnings("unused") public static void testNewNodeSnippet() { - new IntegerAddNode(new IntegerStamp(32, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, 0xFFFFFFFF), null, null); + new ValueAnchorNode(null); } /** diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Wed Jun 25 16:35:17 2014 +0200 @@ -386,7 +386,7 @@ ReadNode readArray = graph.add(new ReadNode(thread, arrayLocation, StampFactory.forKind(wordKind), BarrierType.NONE)); ConstantLocationNode location = ConstantLocationNode.create(LocationIdentity.ANY_LOCATION, Kind.Long, Unsafe.ARRAY_LONG_INDEX_SCALE * index, graph); ReadNode read = graph.add(new ReadNode(readArray, location, StampFactory.forKind(Kind.Long), BarrierType.NONE)); - IntegerAddNode add = graph.unique(new IntegerAddNode(StampFactory.forKind(Kind.Long), read, counter.getIncrement())); + IntegerAddNode add = graph.unique(new IntegerAddNode(read, counter.getIncrement())); WriteNode write = graph.add(new WriteNode(readArray, add, location, BarrierType.NONE)); graph.addBeforeFixed(counter, thread); diff -r dcaf26339f7c -r b558af6ff4bc 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 Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Wed Jun 25 16:35:17 2014 +0200 @@ -461,52 +461,52 @@ @Override protected ValueNode genIntegerAdd(Kind kind, ValueNode x, ValueNode y) { - return new IntegerAddNode(StampFactory.forKind(kind), x, y); + return new IntegerAddNode(x, y); } @Override protected ValueNode genIntegerSub(Kind kind, ValueNode x, ValueNode y) { - return new IntegerSubNode(StampFactory.forKind(kind), x, y); + return new IntegerSubNode(x, y); } @Override protected ValueNode genIntegerMul(Kind kind, ValueNode x, ValueNode y) { - return new IntegerMulNode(StampFactory.forKind(kind), x, y); + return new IntegerMulNode(x, y); } @Override protected ValueNode genFloatAdd(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { - return new FloatAddNode(StampFactory.forKind(kind), x, y, isStrictFP); + return new FloatAddNode(x, y, isStrictFP); } @Override protected ValueNode genFloatSub(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { - return new FloatSubNode(StampFactory.forKind(kind), x, y, isStrictFP); + return new FloatSubNode(x, y, isStrictFP); } @Override protected ValueNode genFloatMul(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { - return new FloatMulNode(StampFactory.forKind(kind), x, y, isStrictFP); + return new FloatMulNode(x, y, isStrictFP); } @Override protected ValueNode genFloatDiv(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { - return new FloatDivNode(StampFactory.forKind(kind), x, y, isStrictFP); + return new FloatDivNode(x, y, isStrictFP); } @Override protected ValueNode genFloatRem(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { - return new FloatRemNode(StampFactory.forKind(kind), x, y, isStrictFP); + return new FloatRemNode(x, y, isStrictFP); } @Override protected ValueNode genIntegerDiv(Kind kind, ValueNode x, ValueNode y) { - return new IntegerDivNode(StampFactory.forKind(kind), x, y); + return new IntegerDivNode(x, y); } @Override protected ValueNode genIntegerRem(Kind kind, ValueNode x, ValueNode y) { - return new IntegerRemNode(StampFactory.forKind(kind), x, y); + return new IntegerRemNode(x, y); } @Override @@ -516,32 +516,32 @@ @Override protected ValueNode genLeftShift(Kind kind, ValueNode x, ValueNode y) { - return new LeftShiftNode(StampFactory.forKind(kind), x, y); + return new LeftShiftNode(x, y); } @Override protected ValueNode genRightShift(Kind kind, ValueNode x, ValueNode y) { - return new RightShiftNode(StampFactory.forKind(kind), x, y); + return new RightShiftNode(x, y); } @Override protected ValueNode genUnsignedRightShift(Kind kind, ValueNode x, ValueNode y) { - return new UnsignedRightShiftNode(StampFactory.forKind(kind), x, y); + return new UnsignedRightShiftNode(x, y); } @Override protected ValueNode genAnd(Kind kind, ValueNode x, ValueNode y) { - return new AndNode(StampFactory.forKind(kind), x, y); + return new AndNode(x, y); } @Override protected ValueNode genOr(Kind kind, ValueNode x, ValueNode y) { - return new OrNode(StampFactory.forKind(kind), x, y); + return new OrNode(x, y); } @Override protected ValueNode genXor(Kind kind, ValueNode x, ValueNode y) { - return new XorNode(StampFactory.forKind(kind), x, y); + return new XorNode(x, y); } @Override diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java Wed Jun 25 16:35:17 2014 +0200 @@ -62,7 +62,7 @@ range = IntegerArithmeticNode.sub(graph, range, ConstantNode.forIntegerStamp(stamp, 1, graph)); } } - IntegerDivNode div = graph.add(new IntegerDivNode(iv.valueNode().stamp().unrestricted(), range, iv.strideNode())); + IntegerDivNode div = graph.add(new IntegerDivNode(range, iv.strideNode())); graph.addBeforeFixed(loop.entryPoint(), div); ConstantNode zero = ConstantNode.forIntegerStamp(stamp, 0, graph); if (assumePositive) { diff -r dcaf26339f7c -r b558af6ff4bc 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 Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -34,8 +34,9 @@ @NodeInfo(shortName = "&") public final class AndNode extends BitLogicNode implements Canonicalizable, NarrowableArithmeticNode { - public AndNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public AndNode(ValueNode x, ValueNode y) { + super(StampTool.and(x.stamp(), y.stamp()), x, y); + assert x.stamp().isCompatible(y.stamp()); } @Override @@ -55,7 +56,7 @@ return getX(); } if (getX().isConstant() && !getY().isConstant()) { - return graph().unique(new AndNode(stamp(), getY(), getX())); + return graph().unique(new AndNode(getY(), getX())); } if (getX().isConstant()) { return ConstantNode.forPrimitive(stamp(), evalConst(getX().asConstant(), getY().asConstant()), graph()); diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -89,7 +89,7 @@ if (stamp instanceof IntegerStamp) { return IntegerArithmeticNode.add(graph, x, y); } else if (stamp instanceof FloatStamp) { - return graph.unique(new FloatAddNode(stamp, x, y, false)); + return graph.unique(new FloatAddNode(x, y, false)); } else { throw GraalInternalError.shouldNotReachHere(); } @@ -101,7 +101,7 @@ if (stamp instanceof IntegerStamp) { return IntegerArithmeticNode.sub(graph, x, y); } else if (stamp instanceof FloatStamp) { - return graph.unique(new FloatSubNode(stamp, x, y, false)); + return graph.unique(new FloatSubNode(x, y, false)); } else { throw GraalInternalError.shouldNotReachHere(); } @@ -113,7 +113,7 @@ if (stamp instanceof IntegerStamp) { return IntegerArithmeticNode.mul(graph, x, y); } else if (stamp instanceof FloatStamp) { - return graph.unique(new FloatMulNode(stamp, x, y, false)); + return graph.unique(new FloatMulNode(x, y, false)); } else { throw GraalInternalError.shouldNotReachHere(); } diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BitLogicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BitLogicNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BitLogicNode.java Wed Jun 25 16:35:17 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 @@ -25,7 +25,6 @@ import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.type.*; /** * The {@code LogicNode} class definition. @@ -44,32 +43,26 @@ } public static BitLogicNode and(StructuredGraph graph, ValueNode v1, ValueNode v2) { - assert v1.stamp().isCompatible(v2.stamp()); - return graph.unique(new AndNode(StampTool.and(v1.stamp(), v2.stamp()), v1, v2)); + return graph.unique(new AndNode(v1, v2)); } public static BitLogicNode and(ValueNode v1, ValueNode v2) { - assert v1.stamp().isCompatible(v2.stamp()); - return new AndNode(StampTool.and(v1.stamp(), v2.stamp()), v1, v2); + return new AndNode(v1, v2); } public static BitLogicNode or(StructuredGraph graph, ValueNode v1, ValueNode v2) { - assert v1.stamp().isCompatible(v2.stamp()); - return graph.unique(new OrNode(StampTool.or(v1.stamp(), v2.stamp()), v1, v2)); + return graph.unique(new OrNode(v1, v2)); } public static BitLogicNode or(ValueNode v1, ValueNode v2) { - assert v1.stamp().isCompatible(v2.stamp()); - return new OrNode(StampTool.or(v1.stamp(), v2.stamp()), v1, v2); + return new OrNode(v1, v2); } public static BitLogicNode xor(StructuredGraph graph, ValueNode v1, ValueNode v2) { - assert v1.stamp().isCompatible(v2.stamp()); - return graph.unique(new XorNode(StampTool.xor(v1.stamp(), v2.stamp()), v1, v2)); + return graph.unique(new XorNode(v1, v2)); } public static BitLogicNode xor(ValueNode v1, ValueNode v2) { - assert v1.stamp().isCompatible(v2.stamp()); - return new XorNode(StampTool.xor(v1.stamp(), v2.stamp()), v1, v2); + return new XorNode(v1, v2); } } diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatAddNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatAddNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatAddNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.calc; import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.lir.gen.*; @@ -33,8 +32,8 @@ @NodeInfo(shortName = "+") public final class FloatAddNode extends FloatArithmeticNode implements Canonicalizable { - public FloatAddNode(Stamp stamp, ValueNode x, ValueNode y, boolean isStrictFP) { - super(stamp, x, y, isStrictFP); + public FloatAddNode(ValueNode x, ValueNode y, boolean isStrictFP) { + super(x.stamp().unrestricted(), x, y, isStrictFP); } public Constant evalConst(Constant... inputs) { @@ -51,7 +50,7 @@ @Override public Node canonical(CanonicalizerTool tool) { if (getX().isConstant() && !getY().isConstant()) { - return graph().unique(new FloatAddNode(stamp(), getY(), getX(), isStrictFP())); + return graph().unique(new FloatAddNode(getY(), getX(), isStrictFP())); } if (getX().isConstant()) { return ConstantNode.forPrimitive(evalConst(getX().asConstant(), getY().asConstant()), graph()); diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatDivNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatDivNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatDivNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.calc; import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.lir.gen.*; @@ -33,8 +32,8 @@ @NodeInfo(shortName = "/") public final class FloatDivNode extends FloatArithmeticNode implements Canonicalizable { - public FloatDivNode(Stamp stamp, ValueNode x, ValueNode y, boolean isStrictFP) { - super(stamp, x, y, isStrictFP); + public FloatDivNode(ValueNode x, ValueNode y, boolean isStrictFP) { + super(x.stamp().unrestricted(), x, y, isStrictFP); } public Constant evalConst(Constant... inputs) { diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatMulNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatMulNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatMulNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.calc; import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.lir.gen.*; @@ -33,8 +32,8 @@ @NodeInfo(shortName = "*") public final class FloatMulNode extends FloatArithmeticNode implements Canonicalizable { - public FloatMulNode(Stamp stamp, ValueNode x, ValueNode y, boolean isStrictFP) { - super(stamp, x, y, isStrictFP); + public FloatMulNode(ValueNode x, ValueNode y, boolean isStrictFP) { + super(x.stamp().unrestricted(), x, y, isStrictFP); } public Constant evalConst(Constant... inputs) { @@ -51,7 +50,7 @@ @Override public Node canonical(CanonicalizerTool tool) { if (getX().isConstant() && !getY().isConstant()) { - return graph().unique(new FloatMulNode(stamp(), getY(), getX(), isStrictFP())); + return graph().unique(new FloatMulNode(getY(), getX(), isStrictFP())); } if (getX().isConstant()) { return ConstantNode.forPrimitive(evalConst(getX().asConstant(), getY().asConstant()), graph()); diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatRemNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatRemNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatRemNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.calc; import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.lir.gen.*; @@ -33,8 +32,8 @@ @NodeInfo(shortName = "%") public class FloatRemNode extends FloatArithmeticNode implements Canonicalizable, Lowerable { - public FloatRemNode(Stamp stamp, ValueNode x, ValueNode y, boolean isStrictFP) { - super(stamp, x, y, isStrictFP); + public FloatRemNode(ValueNode x, ValueNode y, boolean isStrictFP) { + super(x.stamp().unrestricted(), x, y, isStrictFP); } public Constant evalConst(Constant... inputs) { diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatSubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatSubNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatSubNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.calc; import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.lir.gen.*; @@ -33,8 +32,8 @@ @NodeInfo(shortName = "-") public final class FloatSubNode extends FloatArithmeticNode implements Canonicalizable { - public FloatSubNode(Stamp stamp, ValueNode x, ValueNode y, boolean isStrictFP) { - super(stamp, x, y, isStrictFP); + public FloatSubNode(ValueNode x, ValueNode y, boolean isStrictFP) { + super(x.stamp().unrestricted(), x, y, isStrictFP); } public Constant evalConst(Constant... inputs) { diff -r dcaf26339f7c -r b558af6ff4bc 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 Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -34,8 +34,8 @@ @NodeInfo(shortName = "+") public class IntegerAddNode extends IntegerArithmeticNode implements Canonicalizable, NarrowableArithmeticNode { - public IntegerAddNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public IntegerAddNode(ValueNode x, ValueNode y) { + super(StampTool.add(x.stamp(), y.stamp()), x, y); } @Override @@ -52,7 +52,7 @@ @Override public Node canonical(CanonicalizerTool tool) { if (getX().isConstant() && !getY().isConstant()) { - return graph().unique(new IntegerAddNode(stamp(), getY(), getX())); + return graph().unique(new IntegerAddNode(getY(), getX())); } if (getX() instanceof IntegerSubNode) { IntegerSubNode sub = (IntegerSubNode) getX(); diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -25,7 +25,6 @@ import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.type.*; public abstract class IntegerArithmeticNode extends BinaryNode implements ArithmeticLIRLowerable { @@ -35,15 +34,14 @@ } public static IntegerAddNode add(StructuredGraph graph, ValueNode v1, ValueNode v2) { - return graph.unique(new IntegerAddNode(StampTool.add(v1.stamp(), v2.stamp()), v1, v2)); + return graph.unique(new IntegerAddNode(v1, v2)); } public static IntegerMulNode mul(StructuredGraph graph, ValueNode v1, ValueNode v2) { - assert v1.stamp().isCompatible(v2.stamp()); - return graph.unique(new IntegerMulNode(v1.stamp().unrestricted(), v1, v2)); + return graph.unique(new IntegerMulNode(v1, v2)); } public static IntegerSubNode sub(StructuredGraph graph, ValueNode v1, ValueNode v2) { - return graph.unique(new IntegerSubNode(StampTool.sub(v1.stamp(), v2.stamp()), v1, v2)); + return graph.unique(new IntegerSubNode(v1, v2)); } } diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -33,8 +33,8 @@ @NodeInfo(shortName = "/") public class IntegerDivNode extends FixedBinaryNode implements Canonicalizable, Lowerable, LIRLowerable { - public IntegerDivNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public IntegerDivNode(ValueNode x, ValueNode y) { + super(x.stamp().unrestricted(), x, y); } @Override @@ -60,18 +60,17 @@ } long abs = Math.abs(c); if (CodeUtil.isPowerOf2(abs) && x().stamp() instanceof IntegerStamp) { - Stamp unrestricted = stamp().unrestricted(); ValueNode dividend = x(); IntegerStamp stampX = (IntegerStamp) x().stamp(); int log2 = CodeUtil.log2(abs); // no rounding if dividend is positive or if its low bits are always 0 if (stampX.canBeNegative() || (stampX.upMask() & (abs - 1)) != 0) { int bits = PrimitiveStamp.getBits(stamp()); - RightShiftNode sign = graph().unique(new RightShiftNode(unrestricted, x(), ConstantNode.forInt(bits - 1, graph()))); - UnsignedRightShiftNode round = graph().unique(new UnsignedRightShiftNode(unrestricted, sign, ConstantNode.forInt(bits - log2, graph()))); + RightShiftNode sign = graph().unique(new RightShiftNode(x(), ConstantNode.forInt(bits - 1, graph()))); + UnsignedRightShiftNode round = graph().unique(new UnsignedRightShiftNode(sign, ConstantNode.forInt(bits - log2, graph()))); dividend = IntegerArithmeticNode.add(graph(), dividend, round); } - RightShiftNode shift = graph().unique(new RightShiftNode(unrestricted, dividend, ConstantNode.forInt(log2, graph()))); + RightShiftNode shift = graph().unique(new RightShiftNode(dividend, ConstantNode.forInt(log2, graph()))); if (c < 0) { return graph().unique(new NegateNode(shift)); } @@ -86,7 +85,7 @@ IntegerRemNode integerRemNode = (IntegerRemNode) integerSubNode.getY(); if (integerSubNode.stamp().isCompatible(this.stamp()) && integerRemNode.stamp().isCompatible(this.stamp()) && integerSubNode.getX() == integerRemNode.x() && this.y() == integerRemNode.y()) { - return graph().add(new IntegerDivNode(stamp(), integerSubNode.getX(), this.y())); + return graph().add(new IntegerDivNode(integerSubNode.getX(), this.y())); } } } diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -34,8 +34,9 @@ @NodeInfo(shortName = "*") public class IntegerMulNode extends IntegerArithmeticNode implements Canonicalizable, NarrowableArithmeticNode { - public IntegerMulNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public IntegerMulNode(ValueNode x, ValueNode y) { + super(x.stamp().unrestricted(), x, y); + assert x.stamp().isCompatible(y.stamp()); } @Override @@ -47,7 +48,7 @@ @Override public Node canonical(CanonicalizerTool tool) { if (getX().isConstant() && !getY().isConstant()) { - return graph().unique(new IntegerMulNode(stamp(), getY(), getX())); + return graph().unique(new IntegerMulNode(getY(), getX())); } if (getX().isConstant()) { return ConstantNode.forPrimitive(evalConst(getX().asConstant(), getY().asConstant()), graph()); @@ -61,7 +62,7 @@ } long abs = Math.abs(c); if (abs > 0 && CodeUtil.isPowerOf2(abs)) { - LeftShiftNode shift = graph().unique(new LeftShiftNode(stamp().unrestricted(), getX(), ConstantNode.forInt(CodeUtil.log2(abs), graph()))); + LeftShiftNode shift = graph().unique(new LeftShiftNode(getX(), ConstantNode.forInt(CodeUtil.log2(abs), graph()))); if (c < 0) { return graph().unique(new NegateNode(shift)); } else { diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -33,8 +33,8 @@ @NodeInfo(shortName = "%") public class IntegerRemNode extends FixedBinaryNode implements Canonicalizable, Lowerable, LIRLowerable { - public IntegerRemNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public IntegerRemNode(ValueNode x, ValueNode y) { + super(x.stamp().unrestricted(), x, y); } @Override @@ -55,7 +55,7 @@ if (c == 1 || c == -1) { return ConstantNode.forIntegerStamp(stamp(), 0, graph()); } else if (c > 0 && CodeUtil.isPowerOf2(c) && x().stamp() instanceof IntegerStamp && ((IntegerStamp) x().stamp()).isPositive()) { - return graph().unique(new AndNode(stamp(), x(), ConstantNode.forIntegerStamp(stamp(), c - 1, graph()))); + return graph().unique(new AndNode(x(), ConstantNode.forIntegerStamp(stamp(), c - 1, graph()))); } } return this; diff -r dcaf26339f7c -r b558af6ff4bc 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 Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -34,8 +34,8 @@ @NodeInfo(shortName = "-") public class IntegerSubNode extends IntegerArithmeticNode implements Canonicalizable, NarrowableArithmeticNode { - public IntegerSubNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public IntegerSubNode(ValueNode x, ValueNode y) { + super(StampTool.sub(x.stamp(), y.stamp()), x, y); } @Override diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.calc; import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.lir.gen.*; @@ -34,8 +33,8 @@ @NodeInfo(shortName = "<<") public final class LeftShiftNode extends ShiftNode implements Canonicalizable { - public LeftShiftNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public LeftShiftNode(ValueNode x, ValueNode y) { + super(x, y); } @Override @@ -75,19 +74,19 @@ if (total != (total & mask)) { return ConstantNode.forIntegerKind(getKind(), 0, graph()); } - return graph().unique(new LeftShiftNode(stamp(), other.getX(), ConstantNode.forInt(total, graph()))); + return graph().unique(new LeftShiftNode(other.getX(), ConstantNode.forInt(total, graph()))); } else if ((other instanceof RightShiftNode || other instanceof UnsignedRightShiftNode) && otherAmount == amount) { if (getKind() == Kind.Long) { - return graph().unique(new AndNode(stamp(), other.getX(), ConstantNode.forLong(-1L << amount, graph()))); + return graph().unique(new AndNode(other.getX(), ConstantNode.forLong(-1L << amount, graph()))); } else { assert getKind() == Kind.Int; - return graph().unique(new AndNode(stamp(), other.getX(), ConstantNode.forInt(-1 << amount, graph()))); + return graph().unique(new AndNode(other.getX(), ConstantNode.forInt(-1 << amount, graph()))); } } } } if (originalAmout != amount) { - return graph().unique(new LeftShiftNode(stamp(), getX(), ConstantNode.forInt(amount, graph()))); + return graph().unique(new LeftShiftNode(getX(), ConstantNode.forInt(amount, graph()))); } } return this; diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/OrNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/OrNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/OrNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -34,8 +34,9 @@ @NodeInfo(shortName = "|") public final class OrNode extends BitLogicNode implements Canonicalizable { - public OrNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public OrNode(ValueNode x, ValueNode y) { + super(StampTool.or(x.stamp(), y.stamp()), x, y); + assert x.stamp().isCompatible(y.stamp()); } @Override @@ -55,7 +56,7 @@ return getX(); } if (getX().isConstant() && !getY().isConstant()) { - return graph().unique(new OrNode(stamp(), getY(), getX())); + return graph().unique(new OrNode(getY(), getX())); } if (getX().isConstant()) { return ConstantNode.forPrimitive(stamp(), evalConst(getX().asConstant(), getY().asConstant()), graph()); diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -33,8 +33,8 @@ @NodeInfo(shortName = ">>") public final class RightShiftNode extends ShiftNode implements Canonicalizable { - public RightShiftNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public RightShiftNode(ValueNode x, ValueNode y) { + super(x, y); } @Override @@ -51,7 +51,7 @@ @Override public Node canonical(CanonicalizerTool tool) { if (getX().stamp() instanceof IntegerStamp && ((IntegerStamp) getX().stamp()).isPositive()) { - return graph().unique(new UnsignedRightShiftNode(stamp(), getX(), getY())); + return graph().unique(new UnsignedRightShiftNode(getX(), getY())); } if (getX().isConstant() && getY().isConstant()) { return ConstantNode.forPrimitive(evalConst(getX().asConstant(), getY().asConstant()), graph()); @@ -85,14 +85,14 @@ * full shift for this kind */ assert total >= mask; - return graph().unique(new RightShiftNode(stamp(), other.getX(), ConstantNode.forInt(mask, graph()))); + return graph().unique(new RightShiftNode(other.getX(), ConstantNode.forInt(mask, graph()))); } - return graph().unique(new RightShiftNode(stamp(), other.getX(), ConstantNode.forInt(total, graph()))); + return graph().unique(new RightShiftNode(other.getX(), ConstantNode.forInt(total, graph()))); } } } if (originalAmout != amount) { - return graph().unique(new RightShiftNode(stamp(), getX(), ConstantNode.forInt(amount, graph()))); + return graph().unique(new RightShiftNode(getX(), ConstantNode.forInt(amount, graph()))); } } return this; diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java Wed Jun 25 16:35:17 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 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.calc; import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; @@ -34,12 +33,13 @@ /** * Creates a new shift operation. - * + * * @param x the first input value * @param s the second input value */ - public ShiftNode(Stamp stamp, ValueNode x, ValueNode s) { - super(stamp, x, s); + public ShiftNode(ValueNode x, ValueNode s) { + super(x.stamp().unrestricted(), x, s); + assert s.getKind() == Kind.Int; } public int getShiftAmountMask() { diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.calc; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; @@ -33,15 +32,8 @@ @NodeInfo(shortName = "|/|") public class UnsignedDivNode extends FixedBinaryNode implements Canonicalizable, Lowerable, LIRLowerable { - /** - * Used by {@code NodeIntrinsic} in {@code UnsignedMathSubstitutions}. - */ - private UnsignedDivNode(Kind kind, ValueNode x, ValueNode y) { - this(StampFactory.forKind(kind), x, y); - } - - public UnsignedDivNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public UnsignedDivNode(ValueNode x, ValueNode y) { + super(x.stamp().unrestricted(), x, y); } @Override @@ -58,7 +50,7 @@ return x(); } if (CodeUtil.isPowerOf2(c)) { - return graph().unique(new UnsignedRightShiftNode(stamp(), x(), ConstantNode.forInt(CodeUtil.log2(c), graph()))); + return graph().unique(new UnsignedRightShiftNode(x(), ConstantNode.forInt(CodeUtil.log2(c), graph()))); } } return this; @@ -80,8 +72,8 @@ } @NodeIntrinsic - public static native int unsignedDivide(@ConstantNodeParameter Kind kind, int a, int b); + public static native int unsignedDivide(int a, int b); @NodeIntrinsic - public static native long unsignedDivide(@ConstantNodeParameter Kind kind, long a, long b); + public static native long unsignedDivide(long a, long b); } diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.calc; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; @@ -33,15 +32,8 @@ @NodeInfo(shortName = "|%|") public class UnsignedRemNode extends FixedBinaryNode implements Canonicalizable, Lowerable, LIRLowerable { - /** - * Used by {@code NodeIntrinsic} in {@code UnsignedMathSubstitutions}. - */ - private UnsignedRemNode(Kind kind, ValueNode x, ValueNode y) { - this(StampFactory.forKind(kind), x, y); - } - - public UnsignedRemNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public UnsignedRemNode(ValueNode x, ValueNode y) { + super(x.stamp().unrestricted(), x, y); } @Override @@ -57,7 +49,7 @@ if (c == 1) { return ConstantNode.forIntegerStamp(stamp(), 0, graph()); } else if (CodeUtil.isPowerOf2(c)) { - return graph().unique(new AndNode(stamp(), x(), ConstantNode.forIntegerStamp(stamp(), c - 1, graph()))); + return graph().unique(new AndNode(x(), ConstantNode.forIntegerStamp(stamp(), c - 1, graph()))); } } return this; @@ -79,8 +71,8 @@ } @NodeIntrinsic - public static native int unsignedRemainder(@ConstantNodeParameter Kind kind, int a, int b); + public static native int unsignedRemainder(int a, int b); @NodeIntrinsic - public static native long unsignedRemainder(@ConstantNodeParameter Kind kind, long a, long b); + public static native long unsignedRemainder(long a, long b); } diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.calc; import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.lir.gen.*; @@ -34,8 +33,8 @@ @NodeInfo(shortName = ">>>") public final class UnsignedRightShiftNode extends ShiftNode implements Canonicalizable { - public UnsignedRightShiftNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public UnsignedRightShiftNode(ValueNode x, ValueNode y) { + super(x, y); } @Override @@ -75,19 +74,19 @@ if (total != (total & mask)) { return ConstantNode.forIntegerKind(getKind(), 0, graph()); } - return graph().unique(new UnsignedRightShiftNode(stamp(), other.getX(), ConstantNode.forInt(total, graph()))); + return graph().unique(new UnsignedRightShiftNode(other.getX(), ConstantNode.forInt(total, graph()))); } else if (other instanceof LeftShiftNode && otherAmount == amount) { if (getKind() == Kind.Long) { - return graph().unique(new AndNode(stamp(), other.getX(), ConstantNode.forLong(-1L >>> amount, graph()))); + return graph().unique(new AndNode(other.getX(), ConstantNode.forLong(-1L >>> amount, graph()))); } else { assert getKind() == Kind.Int; - return graph().unique(new AndNode(stamp(), other.getX(), ConstantNode.forInt(-1 >>> amount, graph()))); + return graph().unique(new AndNode(other.getX(), ConstantNode.forInt(-1 >>> amount, graph()))); } } } } if (originalAmout != amount) { - return graph().unique(new UnsignedRightShiftNode(stamp(), getX(), ConstantNode.forInt(amount, graph()))); + return graph().unique(new UnsignedRightShiftNode(getX(), ConstantNode.forInt(amount, graph()))); } } return this; diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -34,8 +34,9 @@ @NodeInfo(shortName = "^") public final class XorNode extends BitLogicNode implements Canonicalizable { - public XorNode(Stamp stamp, ValueNode x, ValueNode y) { - super(stamp, x, y); + public XorNode(ValueNode x, ValueNode y) { + super(StampTool.xor(x.stamp(), y.stamp()), x, y); + assert x.stamp().isCompatible(y.stamp()); } @Override @@ -55,7 +56,7 @@ return ConstantNode.forIntegerStamp(stamp(), 0, graph()); } if (getX().isConstant() && !getY().isConstant()) { - return graph().unique(new XorNode(stamp(), getY(), getX())); + return graph().unique(new XorNode(getY(), getX())); } if (getX().isConstant()) { return ConstantNode.forPrimitive(stamp(), evalConst(getX().asConstant(), getY().asConstant()), graph()); diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntegerSubstitutions.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntegerSubstitutions.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntegerSubstitutions.java Wed Jun 25 16:35:17 2014 +0200 @@ -22,7 +22,6 @@ */ package com.oracle.graal.replacements; -import com.oracle.graal.api.meta.*; import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.replacements.nodes.*; @@ -58,11 +57,11 @@ @MethodSubstitution public static int divideUnsigned(int dividend, int divisor) { - return UnsignedDivNode.unsignedDivide(Kind.Int, dividend, divisor); + return UnsignedDivNode.unsignedDivide(dividend, divisor); } @MethodSubstitution public static int remainderUnsigned(int dividend, int divisor) { - return UnsignedRemNode.unsignedRemainder(Kind.Int, dividend, divisor); + return UnsignedRemNode.unsignedRemainder(dividend, divisor); } } diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/LongSubstitutions.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/LongSubstitutions.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/LongSubstitutions.java Wed Jun 25 16:35:17 2014 +0200 @@ -22,7 +22,6 @@ */ package com.oracle.graal.replacements; -import com.oracle.graal.api.meta.*; import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.replacements.nodes.*; @@ -58,11 +57,11 @@ @MethodSubstitution public static long divideUnsigned(long dividend, long divisor) { - return UnsignedDivNode.unsignedDivide(Kind.Long, dividend, divisor); + return UnsignedDivNode.unsignedDivide(dividend, divisor); } @MethodSubstitution public static long remainderUnsigned(long dividend, long divisor) { - return UnsignedRemNode.unsignedRemainder(Kind.Long, dividend, divisor); + return UnsignedRemNode.unsignedRemainder(dividend, divisor); } } diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/UnsignedMathSubstitutions.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/UnsignedMathSubstitutions.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/UnsignedMathSubstitutions.java Wed Jun 25 16:35:17 2014 +0200 @@ -26,9 +26,7 @@ import static com.oracle.graal.nodes.calc.ConditionalNode.*; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; import com.oracle.graal.api.replacements.*; -import com.oracle.graal.graph.Node.ConstantNodeParameter; import com.oracle.graal.graph.Node.NodeIntrinsic; import com.oracle.graal.nodes.calc.*; @@ -101,7 +99,7 @@ */ @MethodSubstitution public static int divide(int a, int b) { - return unsignedDivide(Kind.Int, a, b); + return unsignedDivide(a, b); } /** @@ -109,7 +107,7 @@ */ @MethodSubstitution public static int remainder(int a, int b) { - return unsignedRemainder(Kind.Int, a, b); + return unsignedRemainder(a, b); } /** @@ -117,7 +115,7 @@ */ @MethodSubstitution public static long divide(long a, long b) { - return unsignedDivide(Kind.Long, a, b); + return unsignedDivide(a, b); } /** @@ -125,18 +123,18 @@ */ @MethodSubstitution public static long remainder(long a, long b) { - return unsignedRemainder(Kind.Long, a, b); + return unsignedRemainder(a, b); } @NodeIntrinsic(UnsignedDivNode.class) - private static native int unsignedDivide(@ConstantNodeParameter Kind kind, int a, int b); + private static native int unsignedDivide(int a, int b); @NodeIntrinsic(UnsignedDivNode.class) - private static native long unsignedDivide(@ConstantNodeParameter Kind kind, long a, long b); + private static native long unsignedDivide(long a, long b); @NodeIntrinsic(UnsignedRemNode.class) - private static native int unsignedRemainder(@ConstantNodeParameter Kind kind, int a, int b); + private static native int unsignedRemainder(int a, int b); @NodeIntrinsic(UnsignedRemNode.class) - private static native long unsignedRemainder(@ConstantNodeParameter Kind kind, long a, long b); + private static native long unsignedRemainder(long a, long b); } diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -39,13 +39,13 @@ public class IntegerAddExactNode extends IntegerAddNode implements Canonicalizable, IntegerExactArithmeticNode { public IntegerAddExactNode(ValueNode x, ValueNode y) { - super(x.stamp().unrestricted(), x, y); + super(x, y); assert x.stamp().isCompatible(y.stamp()) && x.stamp() instanceof IntegerStamp; } @Override public boolean inferStamp() { - // TODO Should probably use a specialised version which understands that it can't overflow + // TODO Should probably use a specialized version which understands that it can't overflow return updateStamp(StampTool.add(getX().stamp(), getY().stamp())); } diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -38,7 +38,7 @@ public class IntegerMulExactNode extends IntegerMulNode implements Canonicalizable, IntegerExactArithmeticNode { public IntegerMulExactNode(ValueNode x, ValueNode y) { - super(x.stamp().unrestricted(), x, y); + super(x, y); assert x.stamp().isCompatible(y.stamp()) && x.stamp() instanceof IntegerStamp; } diff -r dcaf26339f7c -r b558af6ff4bc graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java Wed Jun 25 16:35:17 2014 +0200 @@ -39,13 +39,13 @@ public class IntegerSubExactNode extends IntegerSubNode implements Canonicalizable, IntegerExactArithmeticNode { public IntegerSubExactNode(ValueNode x, ValueNode y) { - super(StampTool.sub(x.stamp(), y.stamp()), x, y); + super(x, y); assert x.stamp().isCompatible(y.stamp()) && x.stamp() instanceof IntegerStamp; } @Override public boolean inferStamp() { - // TODO Should probably use a specialised version which understands that it can't overflow + // TODO Should probably use a specialized version which understands that it can't overflow return updateStamp(StampTool.sub(getX().stamp(), getY().stamp())); } diff -r dcaf26339f7c -r b558af6ff4bc 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 Wed Jun 25 13:11:32 2014 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Wed Jun 25 16:35:17 2014 +0200 @@ -199,7 +199,7 @@ ValueNode left = arguments.get(0); ValueNode right = operation.rightOperandIsInt() ? toUnsigned(graph, arguments.get(1), Kind.Int) : fromSigned(graph, arguments.get(1)); - ValueNode replacement = graph.addOrUnique(createBinaryNodeInstance(operation.node(), wordKind, left, right)); + ValueNode replacement = graph.addOrUnique(createBinaryNodeInstance(operation.node(), left, right)); if (replacement instanceof FixedWithNextNode) { graph.addBeforeFixed(invoke.asNode(), (FixedWithNextNode) replacement); } @@ -213,7 +213,7 @@ case NOT: assert arguments.size() == 1; - replace(invoke, graph.unique(new XorNode(StampFactory.forKind(wordKind), arguments.get(0), ConstantNode.forIntegerKind(wordKind, -1, graph)))); + replace(invoke, graph.unique(new XorNode(arguments.get(0), ConstantNode.forIntegerKind(wordKind, -1, graph)))); break; case READ_POINTER: @@ -333,10 +333,10 @@ * called for all Word operations which are annotated with @Operation(node = ...) and * encapsulates the reflective allocation of the node. */ - private static ValueNode createBinaryNodeInstance(Class nodeClass, Kind kind, ValueNode left, ValueNode right) { + private static ValueNode createBinaryNodeInstance(Class nodeClass, ValueNode left, ValueNode right) { try { - Constructor constructor = nodeClass.getConstructor(Stamp.class, ValueNode.class, ValueNode.class); - return constructor.newInstance(StampFactory.forKind(kind), left, right); + Constructor constructor = nodeClass.getConstructor(ValueNode.class, ValueNode.class); + return constructor.newInstance(left, right); } catch (Throwable ex) { throw new GraalInternalError(ex).addContext(nodeClass.getName()); }