changeset 3511:5f3d12c9f300

Merge
author Gilles Duboscq <gilles.duboscq@oracle.com>
date Mon, 08 Aug 2011 18:38:52 +0200
parents cca4ea9b9064 (current diff) 28ba2439034f (diff)
children f4e9efacd3c9
files graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java
diffstat 8 files changed, 21 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java	Mon Aug 08 18:38:24 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java	Mon Aug 08 18:38:52 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/ir/MathIntrinsic.java	Mon Aug 08 18:38:24 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/MathIntrinsic.java	Mon Aug 08 18:38:52 2011 +0200
@@ -29,7 +29,7 @@
 public class MathIntrinsic extends FloatingNode {
 
     public enum Operation {
-        SQRT
+        ABS, SQRT,
     }
 
     @Input private Value x;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java	Mon Aug 08 18:38:24 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java	Mon Aug 08 18:38:52 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);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java	Mon Aug 08 18:38:24 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java	Mon Aug 08 18:38:52 2011 +0200
@@ -466,14 +466,19 @@
 
     @Override
     public void visitMathIntrinsic(MathIntrinsic node) {
+        assert node.kind == CiKind.Double;
         LIRItem opd = new LIRItem(node.x(), this);
         opd.setDestroysRegister();
         opd.loadItem();
         CiVariable dest = createResultVariable(node);
         switch (node.operation()) {
+            case ABS:
+                lir.abs(opd.result(), dest, CiValue.IllegalValue);
+                break;
             case SQRT:
                 lir.sqrt(opd.result(), dest, CiValue.IllegalValue);
                 break;
+
             default:
                 throw Util.shouldNotReachHere();
         }
--- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotRuntime.java	Mon Aug 08 18:38:24 2011 +0200
+++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotRuntime.java	Mon Aug 08 18:38:52 2011 +0200
@@ -30,6 +30,7 @@
 import com.oracle.max.graal.compiler.graph.*;
 import com.oracle.max.graal.compiler.ir.*;
 import com.oracle.max.graal.compiler.ir.Conditional.ConditionalStructure;
+import com.oracle.max.graal.compiler.ir.MathIntrinsic.Operation;
 import com.oracle.max.graal.compiler.value.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.runtime.nodes.*;
@@ -603,10 +604,16 @@
                     intrinsicGraphs.put(method, graph);
                 }
             } else if (holderName.equals("Ljava/lang/Math;")) {
-                if (fullName.equals("sqrt(D)D")) {
+                MathIntrinsic.Operation op = null;
+                if (fullName.equals("abs(D)D")) {
+                    op = MathIntrinsic.Operation.ABS;
+                } else if (fullName.equals("sqrt(D)D")) {
+                    op = MathIntrinsic.Operation.SQRT;
+                }
+                if (op != null) {
                     CompilerGraph graph = new CompilerGraph(this);
                     Local value = new Local(CiKind.Double, 0, graph);
-                    MathIntrinsic min = new MathIntrinsic(value, MathIntrinsic.Operation.SQRT, graph);
+                    MathIntrinsic min = new MathIntrinsic(value, op, graph);
                     Return ret = new Return(min, graph);
                     graph.start().setNext(ret);
                     graph.setReturn(ret);
--- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java	Mon Aug 08 18:38:24 2011 +0200
+++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java	Mon Aug 08 18:38:52 2011 +0200
@@ -622,7 +622,7 @@
             checkSubtype(asm, objHub, objHub, hub);
             asm.jneq(end, objHub, asm.o(null));
             XirOperand scratch = asm.createRegisterTemp("scratch", CiKind.Word, AMD64.r10);
-            asm.mov(scratch, asm.createConstant(CiConstant.forWord(0)));
+            asm.mov(scratch, asm.createConstant(CiConstant.forWord(2)));
 
             asm.callRuntime(CiRuntimeCall.Deoptimize, null);
             asm.shouldNotReachHere();
--- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Mon Aug 08 18:38:24 2011 +0200
+++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Mon Aug 08 18:38:52 2011 +0200
@@ -101,6 +101,7 @@
     restore_live_registers(this, false);
     movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD);
     leave();
+    movl(rscratch1, 2); // InvalidateRecompile
     jump(RuntimeAddress(SharedRuntime::deopt_blob()->uncommon_trap()));
     bind(L);
   }
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Mon Aug 08 18:38:24 2011 +0200
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Mon Aug 08 18:38:52 2011 +0200
@@ -2642,7 +2642,7 @@
 
   int jmp_uncommon_trap_offset = __ pc() - start;
   __ pushptr(Address(r15_thread, in_bytes(JavaThread::ScratchA_offset())));
-  __ movptr(rscratch1, 0);
+  __ movptr(rscratch1, 2); // InvalidateRecompile
 
   int uncommon_trap_offset = __ pc() - start;