# HG changeset patch # User Thomas Wuerthinger # Date 1312818154 -7200 # Node ID 6b5e8da7daacbb200513a32724ad3c70d5aa4424 # Parent 600ffdb9addabcd5a44ae247c62727567722d13e Fixed an issue with special div checks. diff -r 600ffdb9adda -r 6b5e8da7daac graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java --- 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 = ____; diff -r 600ffdb9adda -r 6b5e8da7daac graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java --- 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);