changeset 3506:6b5e8da7daac

Fixed an issue with special div checks.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Mon, 08 Aug 2011 17:42:34 +0200
parents 600ffdb9adda
children 9afae29fefeb
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java
diffstat 2 files changed, 3 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java	Mon Aug 08 16:54:49 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java	Mon Aug 08 17:42:34 2011 +0200
@@ -146,7 +146,7 @@
 
     public static boolean UseConstDirectCall                 = ____;
 
-    public static boolean GenSpecialDivChecks                = ____;
+    public static boolean GenSpecialDivChecks                = true;
     public static boolean GenAssertionCode                   = ____;
     public static boolean AlignCallsForPatching              = true;
     public static boolean NullCheckUniquePc                  = ____;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java	Mon Aug 08 16:54:49 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java	Mon Aug 08 17:42:34 2011 +0200
@@ -1121,22 +1121,6 @@
             moveRegs(lreg, AMD64.rax);
 
             Label continuation = new Label();
-
-            if (GraalOptions.GenSpecialDivChecks) {
-                // check for special case of Integer.MIN_VALUE / -1
-                Label normalCase = new Label();
-                masm.cmpl(AMD64.rax, Integer.MIN_VALUE);
-                masm.jcc(ConditionFlag.notEqual, normalCase);
-                if (code == LIROpcode.Irem) {
-                    // prepare X86Register.rdx for possible special case where remainder = 0
-                    masm.xorl(AMD64.rdx, AMD64.rdx);
-                }
-                masm.cmpl(rreg, -1);
-                masm.jcc(ConditionFlag.equal, continuation);
-
-                // handle normal case
-                masm.bind(normalCase);
-            }
             masm.cdql();
             int offset = masm.codeBuffer.position();
             masm.idivl(rreg);
@@ -1170,7 +1154,8 @@
 
         Label continuation = new Label();
 
-        if (GraalOptions.GenSpecialDivChecks && code == LIROpcode.Div) {
+        System.out.println("gen check" + code);
+        if (GraalOptions.GenSpecialDivChecks && code == LIROpcode.Ldiv) {
             // check for special case of Long.MIN_VALUE / -1
             Label normalCase = new Label();
             masm.movq(AMD64.rdx, java.lang.Long.MIN_VALUE);