changeset 5880:afd2508528f5

The targetAdress should be moved to a fixed register for indirect call. Fix from Christian Wimmer
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 07 Aug 2012 11:13:17 -0700
parents 77196bba5575
children 472a648769e4
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java	Mon Jul 30 08:37:04 2012 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java	Tue Aug 07 11:13:17 2012 -0700
@@ -165,7 +165,9 @@
                 assert methodOopNode != null;
                 Value methodOop = AMD64.rbx.asValue();
                 emitMove(operand(methodOopNode), methodOop);
-                append(new AMD64IndirectCallOp(callTarget.targetMethod(), result, parameters, methodOop, operand(callTarget.computedAddress()), callState));
+                Value targetAddress = AMD64.rax.asValue();
+                emitMove(operand(callTarget.computedAddress()), targetAddress);
+                append(new AMD64IndirectCallOp(callTarget.targetMethod(), result, parameters, methodOop, targetAddress, callState));
             }
 
             if (isLegal(result)) {
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Mon Jul 30 08:37:04 2012 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Tue Aug 07 11:13:17 2012 -0700
@@ -105,6 +105,12 @@
             }
             indirectCall(tasm, masm, asRegister(targetAddress), targetMethod, state);
         }
+
+        @Override
+        protected void verify() {
+            super.verify();
+            assert isRegister(targetAddress) : "The current register allocator cannot handle variables to be used at call sites, it must be in a fixed register for now";
+        }
     }
 
     public static void directCall(TargetMethodAssembler tasm, AMD64MacroAssembler masm, Object target, LIRFrameState info) {