changeset 17198:75177b3cc5a8

Remove unused methods from StampTool.
author Roland Schatz <roland.schatz@oracle.com>
date Wed, 24 Sep 2014 14:22:01 +0200
parents ec35bb4eccb8
children 88012c1750a0
files graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/IntegerStampTest.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java
diffstat 8 files changed, 27 insertions(+), 166 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/IntegerStampTest.java	Wed Sep 24 13:46:37 2014 +0200
+++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/IntegerStampTest.java	Wed Sep 24 14:22:01 2014 +0200
@@ -38,6 +38,10 @@
 
     private StructuredGraph graph;
 
+    private static Stamp addIntStamp(Stamp a, Stamp b) {
+        return IntegerStamp.OPS.getAdd().foldStamp(a, b);
+    }
+
     @Before
     public void before() {
         graph = new StructuredGraph();
@@ -173,86 +177,86 @@
 
     @Test
     public void testAddIntSimple() {
-        assertEquals(StampFactory.forInteger(Kind.Int, 0, 30, 0, 31), StampTool.add(StampFactory.forInteger(Kind.Int, 0, 10), StampFactory.forInteger(Kind.Int, 0, 20)));
+        assertEquals(StampFactory.forInteger(Kind.Int, 0, 30, 0, 31), addIntStamp(StampFactory.forInteger(Kind.Int, 0, 10), StampFactory.forInteger(Kind.Int, 0, 20)));
     }
 
     @Test
     public void testAddNegativeOverFlowInt1() {
         assertEquals(StampFactory.forInteger(Kind.Int, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, 0xffff_ffffL),
-                        StampTool.add(StampFactory.forInteger(Kind.Int, Integer.MIN_VALUE, 0), StampFactory.forInteger(Kind.Int, -1, 0)));
+                        addIntStamp(StampFactory.forInteger(Kind.Int, Integer.MIN_VALUE, 0), StampFactory.forInteger(Kind.Int, -1, 0)));
     }
 
     @Test
     public void testAddNegativeOverFlowInt2() {
         assertEquals(StampFactory.forInteger(Kind.Int, Integer.MAX_VALUE - 2, Integer.MAX_VALUE, 0x7fff_fffcL, 0x7fff_ffffL),
-                        StampTool.add(StampFactory.forInteger(Kind.Int, Integer.MIN_VALUE, Integer.MIN_VALUE + 1), StampFactory.forInteger(Kind.Int, -3, -2)));
+                        addIntStamp(StampFactory.forInteger(Kind.Int, Integer.MIN_VALUE, Integer.MIN_VALUE + 1), StampFactory.forInteger(Kind.Int, -3, -2)));
     }
 
     @Test
     public void testAddPositiveOverFlowInt1() {
-        assertEquals(StampFactory.forKind(Kind.Int), StampTool.add(StampFactory.forInteger(Kind.Int, 0, 1), StampFactory.forInteger(Kind.Int, 0, Integer.MAX_VALUE)));
+        assertEquals(StampFactory.forKind(Kind.Int), addIntStamp(StampFactory.forInteger(Kind.Int, 0, 1), StampFactory.forInteger(Kind.Int, 0, Integer.MAX_VALUE)));
     }
 
     @Test
     public void testAddPositiveOverFlowInt2() {
         assertEquals(StampFactory.forInteger(Kind.Int, Integer.MIN_VALUE, Integer.MIN_VALUE + 2),
-                        StampTool.add(StampFactory.forInteger(Kind.Int, Integer.MAX_VALUE - 1, Integer.MAX_VALUE), StampFactory.forInteger(Kind.Int, 2, 3)));
+                        addIntStamp(StampFactory.forInteger(Kind.Int, Integer.MAX_VALUE - 1, Integer.MAX_VALUE), StampFactory.forInteger(Kind.Int, 2, 3)));
     }
 
     @Test
     public void testAddOverFlowsInt() {
-        assertEquals(StampFactory.forKind(Kind.Int), StampTool.add(StampFactory.forInteger(Kind.Int, -1, 1), StampFactory.forInteger(Kind.Int, Integer.MIN_VALUE, Integer.MAX_VALUE)));
+        assertEquals(StampFactory.forKind(Kind.Int), addIntStamp(StampFactory.forInteger(Kind.Int, -1, 1), StampFactory.forInteger(Kind.Int, Integer.MIN_VALUE, Integer.MAX_VALUE)));
     }
 
     @Test
     public void testAddLongSimple() {
-        assertEquals(StampFactory.forInteger(Kind.Long, 0, 30, 0, 31), StampTool.add(StampFactory.forInteger(Kind.Long, 0, 10), StampFactory.forInteger(Kind.Long, 0, 20)));
+        assertEquals(StampFactory.forInteger(Kind.Long, 0, 30, 0, 31), addIntStamp(StampFactory.forInteger(Kind.Long, 0, 10), StampFactory.forInteger(Kind.Long, 0, 20)));
     }
 
     @Test
     public void testAddNegativOverFlowLong1() {
         assertEquals(StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MAX_VALUE, 0, 0xffff_ffff_ffff_ffffL),
-                        StampTool.add(StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MIN_VALUE + 1), StampFactory.forInteger(Kind.Long, Integer.MIN_VALUE, Integer.MAX_VALUE)));
+                        addIntStamp(StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MIN_VALUE + 1), StampFactory.forInteger(Kind.Long, Integer.MIN_VALUE, Integer.MAX_VALUE)));
     }
 
     @Test
     public void testAddNegativeOverFlowLong2() {
         assertEquals(StampFactory.forInteger(Kind.Long, Long.MAX_VALUE - 2, Long.MAX_VALUE),
-                        StampTool.add(StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MIN_VALUE + 1), StampFactory.forInteger(Kind.Long, -3, -2)));
+                        addIntStamp(StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MIN_VALUE + 1), StampFactory.forInteger(Kind.Long, -3, -2)));
     }
 
     @Test
     public void testAddPositiveOverFlowLong1() {
-        assertEquals(StampFactory.forKind(Kind.Long), StampTool.add(StampFactory.forInteger(Kind.Long, 0, 1), StampFactory.forInteger(Kind.Long, 0, Long.MAX_VALUE)));
+        assertEquals(StampFactory.forKind(Kind.Long), addIntStamp(StampFactory.forInteger(Kind.Long, 0, 1), StampFactory.forInteger(Kind.Long, 0, Long.MAX_VALUE)));
     }
 
     @Test
     public void testAddPositiveOverFlowLong2() {
         assertEquals(StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MIN_VALUE + 2),
-                        StampTool.add(StampFactory.forInteger(Kind.Long, Long.MAX_VALUE - 1, Long.MAX_VALUE), StampFactory.forInteger(Kind.Long, 2, 3)));
+                        addIntStamp(StampFactory.forInteger(Kind.Long, Long.MAX_VALUE - 1, Long.MAX_VALUE), StampFactory.forInteger(Kind.Long, 2, 3)));
     }
 
     @Test
     public void testAddOverFlowsLong() {
-        assertEquals(StampFactory.forKind(Kind.Long), StampTool.add(StampFactory.forInteger(Kind.Long, -1, 1), StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MAX_VALUE)));
+        assertEquals(StampFactory.forKind(Kind.Long), addIntStamp(StampFactory.forInteger(Kind.Long, -1, 1), StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MAX_VALUE)));
     }
 
     @Test
     public void testAdd1() {
         assertEquals(StampFactory.forInteger(Kind.Int, Integer.MIN_VALUE + 1, 31 + (Integer.MIN_VALUE + 1)),
-                        StampTool.add(StampFactory.forInteger(Kind.Int, 0, 31), StampFactory.forInteger(Kind.Int, Integer.MIN_VALUE + 1, Integer.MIN_VALUE + 1)));
+                        addIntStamp(StampFactory.forInteger(Kind.Int, 0, 31), StampFactory.forInteger(Kind.Int, Integer.MIN_VALUE + 1, Integer.MIN_VALUE + 1)));
     }
 
     @Test
     public void testAdd2() {
         assertEquals(StampFactory.forInteger(Kind.Int, 0x8000_007e, 0x8000_007f, 0x8000_007eL, 0x8000_007fL),
-                        StampTool.add(StampFactory.forInteger(Kind.Int, 0x7fff_fffe, 0x7fff_ffff, 0x7fff_fffeL, 0x7ffff_fffL), StampFactory.forInteger(Kind.Int, 128, 128)));
+                        addIntStamp(StampFactory.forInteger(Kind.Int, 0x7fff_fffe, 0x7fff_ffff, 0x7fff_fffeL, 0x7ffff_fffL), StampFactory.forInteger(Kind.Int, 128, 128)));
     }
 
     @Test
     public void testAdd3() {
         assertEquals(StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MAX_VALUE - 1, 0, 0xffff_ffff_ffff_fffeL),
-                        StampTool.add(StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MAX_VALUE - 1, 0, 0xffff_ffff_ffff_fffeL),
+                        addIntStamp(StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MAX_VALUE - 1, 0, 0xffff_ffff_ffff_fffeL),
                                         StampFactory.forInteger(Kind.Long, Long.MIN_VALUE, Long.MAX_VALUE - 1, 0, 0xffff_ffff_ffff_fffeL)));
 
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java	Wed Sep 24 13:46:37 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java	Wed Sep 24 14:22:01 2014 +0200
@@ -29,7 +29,6 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.type.*;
 
 @NodeInfo(shortName = "/")
 public class IntegerDivNode extends FixedBinaryNode implements Lowerable, LIRLowerable {
@@ -39,12 +38,12 @@
     }
 
     protected IntegerDivNode(ValueNode x, ValueNode y) {
-        super(StampTool.div(x.stamp(), y.stamp()), x, y);
+        super(IntegerStamp.OPS.getDiv().foldStamp(x.stamp(), y.stamp()), x, y);
     }
 
     @Override
     public boolean inferStamp() {
-        return updateStamp(StampTool.div(getX().stamp(), getY().stamp()));
+        return updateStamp(IntegerStamp.OPS.getDiv().foldStamp(getX().stamp(), getY().stamp()));
     }
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java	Wed Sep 24 13:46:37 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java	Wed Sep 24 14:22:01 2014 +0200
@@ -28,7 +28,6 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.type.*;
 
 @NodeInfo(shortName = "%")
 public class IntegerRemNode extends FixedBinaryNode implements Lowerable, LIRLowerable {
@@ -38,12 +37,12 @@
     }
 
     protected IntegerRemNode(ValueNode x, ValueNode y) {
-        super(StampTool.rem(x.stamp(), y.stamp()), x, y);
+        super(IntegerStamp.OPS.getRem().foldStamp(x.stamp(), y.stamp()), x, y);
     }
 
     @Override
     public boolean inferStamp() {
-        return updateStamp(StampTool.rem(getX().stamp(), getY().stamp()));
+        return updateStamp(IntegerStamp.OPS.getRem().foldStamp(getX().stamp(), getY().stamp()));
     }
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java	Wed Sep 24 13:46:37 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java	Wed Sep 24 14:22:01 2014 +0200
@@ -31,7 +31,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.type.*;
 
 /**
  * Location node that is the sum of two other location nodes. Can represent locations in the form of
@@ -120,7 +119,7 @@
 
     @Override
     public IntegerStamp getDisplacementStamp() {
-        return StampTool.add(getX().getDisplacementStamp(), getY().getDisplacementStamp());
+        return (IntegerStamp) IntegerStamp.OPS.getAdd().foldStamp(getX().getDisplacementStamp(), getY().getDisplacementStamp());
     }
 
     @NodeIntrinsic
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java	Wed Sep 24 13:46:37 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java	Wed Sep 24 14:22:01 2014 +0200
@@ -107,7 +107,7 @@
     public IntegerStamp getDisplacementStamp() {
         assert indexScaling > 0 && CodeUtil.isPowerOf2(indexScaling);
         int scale = CodeUtil.log2(indexScaling);
-        return (IntegerStamp) StampTool.add(StampFactory.forInteger(64, displacement, displacement),
+        return (IntegerStamp) IntegerStamp.OPS.getAdd().foldStamp(StampFactory.forInteger(64, displacement, displacement),
                         StampTool.signExtend(StampTool.leftShift(index.stamp(), StampFactory.forInteger(64, scale, scale)), 64));
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java	Wed Sep 24 13:46:37 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java	Wed Sep 24 14:22:01 2014 +0200
@@ -34,22 +34,6 @@
  */
 public class StampTool {
 
-    public static Stamp negate(Stamp stamp) {
-        if (stamp instanceof IntegerStamp) {
-            IntegerStamp integerStamp = (IntegerStamp) stamp;
-            int bits = integerStamp.getBits();
-            if (integerStamp.lowerBound() != CodeUtil.minValue(bits)) {
-                // TODO(ls) check if the mask calculation is correct...
-                return StampFactory.forInteger(bits, -integerStamp.upperBound(), -integerStamp.lowerBound());
-            }
-        } else if (stamp instanceof FloatStamp) {
-            FloatStamp floatStamp = (FloatStamp) stamp;
-            return new FloatStamp(floatStamp.getBits(), -floatStamp.upperBound(), -floatStamp.lowerBound(), floatStamp.isNonNaN());
-        }
-
-        return stamp.unrestricted();
-    }
-
     public static Stamp not(Stamp stamp) {
         if (stamp instanceof IntegerStamp) {
             IntegerStamp integerStamp = (IntegerStamp) stamp;
@@ -73,128 +57,6 @@
         }
     }
 
-    public static Stamp add(Stamp stamp1, Stamp stamp2) {
-        if (stamp1 instanceof IntegerStamp && stamp2 instanceof IntegerStamp) {
-            return add((IntegerStamp) stamp1, (IntegerStamp) stamp2);
-        }
-        return StampFactory.illegal();
-    }
-
-    private static long carryBits(long x, long y) {
-        return (x + y) ^ x ^ y;
-    }
-
-    public static Stamp sub(Stamp stamp1, Stamp stamp2) {
-        return add(stamp1, StampTool.negate(stamp2));
-    }
-
-    public static Stamp div(Stamp stamp1, Stamp stamp2) {
-        if (stamp1 instanceof IntegerStamp && stamp2 instanceof IntegerStamp) {
-            return div((IntegerStamp) stamp1, (IntegerStamp) stamp2);
-        }
-        return StampFactory.illegal();
-    }
-
-    public static Stamp div(IntegerStamp stamp1, IntegerStamp stamp2) {
-        assert stamp1.getBits() == stamp2.getBits();
-        if (stamp2.isStrictlyPositive()) {
-            long lowerBound = stamp1.lowerBound() / stamp2.lowerBound();
-            long upperBound = stamp1.upperBound() / stamp2.lowerBound();
-            return StampFactory.forInteger(stamp1.getBits(), lowerBound, upperBound);
-        }
-        return stamp1.unrestricted();
-    }
-
-    public static Stamp rem(Stamp stamp1, Stamp stamp2) {
-        if (stamp1 instanceof IntegerStamp && stamp2 instanceof IntegerStamp) {
-            return rem((IntegerStamp) stamp1, (IntegerStamp) stamp2);
-        }
-        return StampFactory.illegal();
-    }
-
-    public static Stamp rem(IntegerStamp stamp1, IntegerStamp stamp2) {
-        assert stamp1.getBits() == stamp2.getBits();
-        // zero is always possible
-        long lowerBound = Math.min(stamp1.lowerBound(), 0);
-        long upperBound = Math.max(stamp1.upperBound(), 0);
-
-        long magnitude; // the maximum absolute value of the result, derived from stamp2
-        if (stamp2.lowerBound() == CodeUtil.minValue(stamp2.getBits())) {
-            // Math.abs(...) - 1 does not work in this case
-            magnitude = CodeUtil.maxValue(stamp2.getBits());
-        } else {
-            magnitude = Math.max(Math.abs(stamp2.lowerBound()), Math.abs(stamp2.upperBound())) - 1;
-        }
-        lowerBound = Math.max(lowerBound, -magnitude);
-        upperBound = Math.min(upperBound, magnitude);
-
-        return StampFactory.forInteger(stamp1.getBits(), lowerBound, upperBound);
-    }
-
-    private static boolean addOverflowsPositively(long x, long y, int bits) {
-        long result = x + y;
-        if (bits == 64) {
-            return (~x & ~y & result) < 0;
-        } else {
-            return result > CodeUtil.maxValue(bits);
-        }
-    }
-
-    private static boolean addOverflowsNegatively(long x, long y, int bits) {
-        long result = x + y;
-        if (bits == 64) {
-            return (x & y & ~result) < 0;
-        } else {
-            return result < CodeUtil.minValue(bits);
-        }
-    }
-
-    public static IntegerStamp add(IntegerStamp stamp1, IntegerStamp stamp2) {
-        int bits = stamp1.getBits();
-        assert bits == stamp2.getBits();
-
-        if (stamp1.isUnrestricted()) {
-            return stamp1;
-        } else if (stamp2.isUnrestricted()) {
-            return stamp2;
-        }
-        long defaultMask = CodeUtil.mask(bits);
-        long variableBits = (stamp1.downMask() ^ stamp1.upMask()) | (stamp2.downMask() ^ stamp2.upMask());
-        long variableBitsWithCarry = variableBits | (carryBits(stamp1.downMask(), stamp2.downMask()) ^ carryBits(stamp1.upMask(), stamp2.upMask()));
-        long newDownMask = (stamp1.downMask() + stamp2.downMask()) & ~variableBitsWithCarry;
-        long newUpMask = (stamp1.downMask() + stamp2.downMask()) | variableBitsWithCarry;
-
-        newDownMask &= defaultMask;
-        newUpMask &= defaultMask;
-
-        long lowerBound;
-        long upperBound;
-        boolean lowerOverflowsPositively = addOverflowsPositively(stamp1.lowerBound(), stamp2.lowerBound(), bits);
-        boolean upperOverflowsPositively = addOverflowsPositively(stamp1.upperBound(), stamp2.upperBound(), bits);
-        boolean lowerOverflowsNegatively = addOverflowsNegatively(stamp1.lowerBound(), stamp2.lowerBound(), bits);
-        boolean upperOverflowsNegatively = addOverflowsNegatively(stamp1.upperBound(), stamp2.upperBound(), bits);
-        if ((lowerOverflowsNegatively && !upperOverflowsNegatively) || (!lowerOverflowsPositively && upperOverflowsPositively)) {
-            lowerBound = CodeUtil.minValue(bits);
-            upperBound = CodeUtil.maxValue(bits);
-        } else {
-            lowerBound = CodeUtil.signExtend((stamp1.lowerBound() + stamp2.lowerBound()) & defaultMask, bits);
-            upperBound = CodeUtil.signExtend((stamp1.upperBound() + stamp2.upperBound()) & defaultMask, bits);
-        }
-        IntegerStamp limit = StampFactory.forInteger(bits, lowerBound, upperBound);
-        newUpMask &= limit.upMask();
-        upperBound = CodeUtil.signExtend(upperBound & newUpMask, bits);
-        newDownMask |= limit.downMask();
-        lowerBound |= newDownMask;
-        return new IntegerStamp(bits, lowerBound, upperBound, newDownMask, newUpMask);
-    }
-
-    public static Stamp sub(IntegerStamp stamp1, IntegerStamp stamp2) {
-        if (stamp1.isUnrestricted() || stamp2.isUnrestricted()) {
-            return stamp1.unrestricted();
-        }
-        return add(stamp1, (IntegerStamp) StampTool.negate(stamp2));
-    }
-
     public static Stamp stampForMask(int bits, long downMask, long upMask) {
         long lowerBound;
         long upperBound;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java	Wed Sep 24 13:46:37 2014 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java	Wed Sep 24 14:22:01 2014 +0200
@@ -29,7 +29,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.type.*;
 import com.oracle.truffle.api.*;
 
 /**
@@ -51,7 +50,7 @@
     @Override
     public boolean inferStamp() {
         // TODO Should probably use a specialized version which understands that it can't overflow
-        return updateStamp(StampTool.add(getX().stamp(), getY().stamp()));
+        return super.inferStamp();
     }
 
     @Override
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java	Wed Sep 24 13:46:37 2014 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java	Wed Sep 24 14:22:01 2014 +0200
@@ -29,7 +29,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.truffle.api.*;
 
@@ -52,7 +51,7 @@
     @Override
     public boolean inferStamp() {
         // TODO Should probably use a specialized version which understands that it can't overflow
-        return updateStamp(StampTool.sub(getX().stamp(), getY().stamp()));
+        return super.inferStamp();
     }
 
     @Override