changeset 5652:3405794d135c

fix to ldiv's -MIN/-1 special case, add a jtt for this remove now deprecated assert in LoopFragment
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 19 Jun 2012 13:20:39 +0200
parents 02f76c2ee0f0
children 1f263f152cda
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopFragment.java graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv2.java graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java
diffstat 3 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopFragment.java	Mon Jun 18 15:03:27 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopFragment.java	Tue Jun 19 13:20:39 2012 +0200
@@ -246,7 +246,6 @@
                     PhiNode phi = graph.add(vpn.type() == PhiType.Value ? new PhiNode(vpn.kind(), merge) : new PhiNode(vpn.type(), merge));
                     phi.addInput(vpn);
                     phi.addInput(newVpn);
-                    assert vpn.type() == PhiType.Value;
                     replaceWith = phi;
                 } else {
                     replaceWith = vpn.value();
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv2.java	Mon Jun 18 15:03:27 2012 +0200
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv2.java	Tue Jun 19 13:20:39 2012 +0200
@@ -27,6 +27,8 @@
 /*
  */
 public class BC_ldiv2 {
+    public static long MIN = Long.MIN_VALUE;
+    public static long MAX = Long.MAX_VALUE;
 
     public static long test(long a, long b) {
         return a / b;
@@ -34,12 +36,16 @@
 
     @Test
     public void run0() throws Throwable {
-        Assert.assertEquals(-9223372036854775808L, test(-9223372036854775808L, -1));
+        Assert.assertEquals(MIN, test(MIN, -1));
     }
 
     @Test
     public void run1() throws Throwable {
-        Assert.assertEquals(-9223372036854775808L, test(-9223372036854775808L, 1));
+        Assert.assertEquals(MIN, test(MIN, 1));
     }
 
+    @Test
+    public void run2() throws Throwable {
+        Assert.assertEquals(-1, test(MIN, MAX));
+    }
 }
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java	Mon Jun 18 15:03:27 2012 +0200
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java	Tue Jun 19 13:20:39 2012 +0200
@@ -397,7 +397,7 @@
                         masm.movq(AMD64.rdx, java.lang.Long.MIN_VALUE);
                         masm.cmpq(AMD64.rax, AMD64.rdx);
                         masm.jcc(ConditionFlag.notEqual, normalCase);
-                        masm.cmpl(asRegister(src), -1);
+                        masm.cmpq(asRegister(src), -1);
                         masm.jcc(ConditionFlag.equal, continuation);
                         masm.bind(normalCase);
                     }