changeset 6300:6a51bc216306

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 28 Aug 2012 14:58:55 +0200
parents 904517c1cd06 (current diff) 1ed726759f65 (diff)
children 4535a87e8bf8
files
diffstat 11 files changed, 52 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/BasicInductionVariable.java	Tue Aug 28 14:17:22 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/BasicInductionVariable.java	Tue Aug 28 14:58:55 2012 +0200
@@ -48,9 +48,9 @@
         if (stamp instanceof IntegerStamp) {
             IntegerStamp integerStamp = (IntegerStamp) stamp;
             Direction dir = null;
-            if (integerStamp.lowerBound() > 0) {
+            if (integerStamp.isStrictlyPositive()) {
                 dir = Direction.Up;
-            } else if (integerStamp.upperBound() < 0) {
+            } else if (integerStamp.isStrictlyNegative()) {
                 dir =  Direction.Down;
             }
             if (dir != null) {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/DerivedScaledInductionVariable.java	Tue Aug 28 14:17:22 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/DerivedScaledInductionVariable.java	Tue Aug 28 14:58:55 2012 +0200
@@ -51,9 +51,9 @@
         Stamp stamp = scale.stamp();
         if (stamp instanceof IntegerStamp) {
             IntegerStamp integerStamp = (IntegerStamp) stamp;
-            if (integerStamp.lowerBound() > 0) {
+            if (integerStamp.isStrictlyPositive()) {
                 return base.direction();
-            } else if (integerStamp.upperBound() < 0) {
+            } else if (integerStamp.isStrictlyNegative()) {
                 return base.direction().opposite();
             }
         }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_series.java	Tue Aug 28 14:17:22 2012 +0200
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_series.java	Tue Aug 28 14:58:55 2012 +0200
@@ -98,10 +98,15 @@
         return (0.0);
     }
 
-    // TODO (ds) disabled as JDK 7u6 + Graal breaks this for some as yet unknown reason)
-    //@Test
+    /* This test is sensible to the implementation of Math.pow, cos and sin.
+     * Since for these functions, the specs says "The computed result must be within 1 ulp of the exact result",
+     * different implementation may return different results.
+     * The 11 ulp delta allowed for test(100) tries to account for that but is not guaranteed to work forever.
+     */
+    @Test
     public void run0() throws Throwable {
-        Assert.assertEquals(0.6248571921291398d, test(100), 0);
+        double expected = 0.6248571921291398d;
+        Assert.assertEquals(expected, test(100), 11 * Math.ulp(expected));
     }
 
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowThanNode.java	Tue Aug 28 14:17:22 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowThanNode.java	Tue Aug 28 14:58:55 2012 +0200
@@ -60,10 +60,10 @@
         } else {
             IntegerStamp xStamp = x().integerStamp();
             IntegerStamp yStamp = y().integerStamp();
-            if (yStamp.lowerBound() >= 0 && yStamp.upperBound() >= 0) {
-                if (xStamp.lowerBound() >= 0 && xStamp.upperBound() < yStamp.lowerBound()) {
+            if (yStamp.isPositive()) {
+                if (xStamp.isPositive() && xStamp.upperBound() < yStamp.lowerBound()) {
                     return ConstantNode.forBoolean(true, graph());
-                } else if (xStamp.upperBound() < 0 || xStamp.lowerBound() >= yStamp.upperBound()) {
+                } else if (xStamp.isStrictlyNegative() || xStamp.lowerBound() >= yStamp.upperBound()) {
                     return ConstantNode.forBoolean(false, graph());
                 }
             }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java	Tue Aug 28 14:17:22 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java	Tue Aug 28 14:58:55 2012 +0200
@@ -67,8 +67,8 @@
                 ValueNode dividend = x();
                 IntegerStamp stampX = x().integerStamp();
                 int log2 = CodeUtil.log2(abs);
-                // no rounding if dividend is negative or if its low bits are always 0
-                if (stampX.lowerBound() < 0 || (stampX.mask() & (abs - 1)) != 0) {
+                // no rounding if dividend is positive or if its low bits are always 0
+                if (stampX.canBeNegative() || (stampX.mask() & (abs - 1)) != 0) {
                     int bits;
                     if (kind().isInt()) {
                         bits = 32;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java	Tue Aug 28 14:17:22 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java	Tue Aug 28 14:58:55 2012 +0200
@@ -26,6 +26,7 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.nodes.type.*;
 
 @NodeInfo(shortName = "<")
 public final class IntegerLessThanNode extends CompareNode {
@@ -77,7 +78,7 @@
         } else if (x().integerStamp().lowerBound() >= y().integerStamp().upperBound()) {
             return ConstantNode.forBoolean(false, graph());
         }
-        if (x().integerStamp().lowerBound() >= 0 && y().integerStamp().lowerBound() >= 0) {
+        if (IntegerStamp.sameSign(x().integerStamp(), y().integerStamp())) {
             return graph().unique(new IntegerBelowThanNode(x(), y()));
         }
         return super.canonical(tool);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java	Tue Aug 28 14:17:22 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java	Tue Aug 28 14:58:55 2012 +0200
@@ -52,7 +52,7 @@
             long c = y().asConstant().asLong();
             if (c == 1 || c == -1) {
                 return ConstantNode.forIntegerKind(kind(), 0, graph());
-            } else if (c > 0 && CodeUtil.isPowerOf2(c) && x().integerStamp().lowerBound() >= 0) {
+            } else if (c > 0 && CodeUtil.isPowerOf2(c) && x().integerStamp().isPositive()) {
                 return graph().unique(new AndNode(kind(), x(), ConstantNode.forIntegerKind(kind(), c - 1, graph())));
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java	Tue Aug 28 14:17:22 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java	Tue Aug 28 14:58:55 2012 +0200
@@ -36,7 +36,7 @@
 
     @Override
     public ValueNode canonical(CanonicalizerTool tool) {
-        if (x().integerStamp().lowerBound() >= 0) {
+        if (x().integerStamp().isPositive()) {
             return graph().unique(new UnsignedRightShiftNode(kind(), x(), y()));
         }
         if (y().isConstant()) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java	Tue Aug 28 14:17:22 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java	Tue Aug 28 14:58:55 2012 +0200
@@ -81,6 +81,30 @@
         return value >= lowerBound && value <= upperBound && (value & mask) == (value & defaultMask(kind()));
     }
 
+    public boolean isPositive() {
+        return lowerBound() >= 0;
+    }
+
+    public boolean isNegative() {
+        return upperBound() <= 0;
+    }
+
+    public boolean isStrictlyPositive() {
+        return lowerBound() > 0;
+    }
+
+    public boolean isStrictlyNegative() {
+        return upperBound() < 0;
+    }
+
+    public boolean canBePositive() {
+        return upperBound() > 0;
+    }
+
+    public boolean canBeNegative() {
+        return lowerBound() < 0;
+    }
+
     @Override
     public String toString() {
         StringBuilder str = new StringBuilder();
@@ -176,4 +200,8 @@
         }
     }
 
+    public static boolean sameSign(IntegerStamp s1, IntegerStamp s2) {
+        return s1.isPositive() && s2.isPositive() || s1.isNegative() && s2.isNegative();
+    }
+
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java	Tue Aug 28 14:17:22 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java	Tue Aug 28 14:58:55 2012 +0200
@@ -79,7 +79,7 @@
 
     public static Stamp div(IntegerStamp stamp1, IntegerStamp stamp2) {
         Kind kind = stamp1.kind();
-        if (stamp2.lowerBound() > 0) {
+        if (stamp2.isStrictlyPositive()) {
             long lowerBound = stamp1.lowerBound() / stamp2.lowerBound();
             long upperBound = stamp1.upperBound() / stamp2.lowerBound();
             return StampFactory.forInteger(kind, lowerBound, upperBound, IntegerStamp.maskFor(kind, lowerBound, upperBound));
--- a/mx/sanitycheck.py	Tue Aug 28 14:17:22 2012 +0200
+++ b/mx/sanitycheck.py	Tue Aug 28 14:58:55 2012 +0200
@@ -115,10 +115,10 @@
     if specjvm2008 is None or not exists(join(specjvm2008, 'SPECjvm2008.jar')):
         mx.abort('Please set the SPECJVM2008 environment variable to a SPECjvm2008 directory')
     
-    score = re.compile(r"^(Score on|Noncompliant) (?P<benchmark>[a-zA-Z0-9\._]+)( result)?: (?P<score>[0-9]+(,|\.)[0-9]+)( SPECjvm2008 Base)? ops/m$")
+    score = re.compile(r"^(Score on|Noncompliant) (?P<benchmark>[a-zA-Z0-9\._]+)( result)?: (?P<score>[0-9]+((,|\.)[0-9]+)?)( SPECjvm2008 Base)? ops/m$")
     error = re.compile(r"^Errors in benchmark: ")
     # The ' ops/m' at the end of the success string is important : it's how you can tell valid and invalid runs apart
-    success = re.compile(r"^(Noncompliant c|C)omposite result: [0-9]+(,|\.)[0-9]+( SPECjvm2008 (Base|Peak))? ops/m$")
+    success = re.compile(r"^(Noncompliant c|C)omposite result: [0-9]+((,|\.)[0-9]+)?( SPECjvm2008 (Base|Peak))? ops/m$")
     matcher = Matcher(score, {'const:group' : "const:SPECjvm2008", 'const:name' : 'benchmark', 'const:score' : 'score'}, startNewLine=True)
     
     opts = []