changeset 18439:180b55c6a189

LinearScan: update VirtualStackSlot in intervals.spillSlot.
author Josef Eisl <josef.eisl@jku.at>
date Tue, 11 Nov 2014 17:01:47 +0100
parents de99ed0b18ca
children 7aae90a0031c
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Tue Nov 11 16:53:32 2014 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Tue Nov 11 17:01:47 2014 +0100
@@ -42,6 +42,8 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
+import com.oracle.graal.lir.FrameMapBuilder.FrameMappable;
+import com.oracle.graal.lir.FrameMapBuilder.FrameMappingTool;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
 import com.oracle.graal.lir.StandardOp.MoveOp;
@@ -1804,6 +1806,31 @@
         }
     }
 
+    private class Mapper implements FrameMappable {
+
+        public void map(FrameMappingTool tool) {
+            try (Scope scope = Debug.scope("StackSlotMappingLSRA")) {
+                for (Interval current : intervals) {
+                    if (current != null) {
+                        if (isVirtualStackSlot(current.location())) {
+                            VirtualStackSlot value = asVirtualStackSlot(current.location());
+                            StackSlot stackSlot = tool.getStackSlot(value);
+                            Debug.log("map %s -> %s", value, stackSlot);
+                            current.assignLocation(stackSlot);
+                        }
+                        if (current.isSplitParent() && current.spillSlot() != null && isVirtualStackSlot(current.spillSlot())) {
+                            VirtualStackSlot value = asVirtualStackSlot(current.spillSlot());
+                            StackSlot stackSlot = tool.getStackSlot(value);
+                            Debug.log("map %s -> %s", value, stackSlot);
+                            current.setSpillSlot(stackSlot);
+                        }
+                    }
+                }
+            }
+        }
+
+    }
+
     public static void allocate(TargetDescription target, LIRGenerationResult res) {
         new LinearScan(target, res).allocate();
     }
@@ -1851,6 +1878,8 @@
                 printIntervals("After register allocation");
                 printLir("After register allocation", true);
 
+                // register interval mapper
+                frameMapBuilder.requireMapping(new Mapper());
                 // build frame map
                 res.buildFrameMap();