diff graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java @ 9433:45a73cd19baa

Use the correct move instruction for register saving and restoring.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 30 Apr 2013 19:25:08 +0200
parents c0488f573091
children 5fa54bf57f8c
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Tue Apr 30 19:24:00 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Tue Apr 30 19:25:08 2013 +0200
@@ -198,13 +198,19 @@
         if (needsCalleeSave) {
             Register[] savedRegisters = frameMap.registerConfig.getAllocatableRegisters();
             savedRegisterLocations = new StackSlot[savedRegisters.length];
+            AMD64LIRInstruction[] savingMoves = new AMD64LIRInstruction[savedRegisters.length];
+            AMD64LIRInstruction[] restoringMoves = new AMD64LIRInstruction[savedRegisters.length];
             for (int i = 0; i < savedRegisters.length; i++) {
                 PlatformKind kind = target.arch.getLargestStorableKind(savedRegisters[i].getRegisterCategory());
                 assert kind != Kind.Illegal;
                 StackSlot spillSlot = frameMap.allocateSpillSlot(kind);
                 savedRegisterLocations[i] = spillSlot;
+
+                RegisterValue register = savedRegisters[i].asValue(kind);
+                savingMoves[i] = createMove(spillSlot, register);
+                restoringMoves[i] = createMove(register, spillSlot);
             }
-            save = new AMD64SaveRegistersOp(savedRegisters, savedRegisterLocations);
+            save = new AMD64SaveRegistersOp(savingMoves, restoringMoves, savedRegisterLocations);
             append(save);
 
             Value thread = args[0];