changeset 15455:6e036e2a2091

added com.oracle.graal.lir.FrameMap.stackSlotSize()
author twisti
date Wed, 30 Apr 2014 15:09:15 -1000
parents 0e0c24424d14
children bb97b75d1d65
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java	Wed Apr 30 15:08:09 2014 -1000
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java	Wed Apr 30 15:09:15 2014 -1000
@@ -113,6 +113,15 @@
     }
 
     /**
+     * Gets the size of a stack slot.
+     *
+     * @return stack slot size
+     */
+    public int stackSlotSize() {
+        return target.wordSize;
+    }
+
+    /**
      * Gets the frame size of the compiled frame, not including the size of the
      * {@link Architecture#getReturnAddressSize() return address slot}.
      *
@@ -208,8 +217,8 @@
      * @return the index of the stack slot
      */
     public int indexForStackSlot(StackSlot slot) {
-        assert offsetForStackSlot(slot) % target.wordSize == 0;
-        return offsetForStackSlot(slot) / target.wordSize;
+        assert offsetForStackSlot(slot) % stackSlotSize() == 0;
+        return offsetForStackSlot(slot) / stackSlotSize();
     }
 
     /**
@@ -259,7 +268,7 @@
      * @param kind the {@link PlatformKind} to be stored in the spill slot.
      * @return the size in bytes
      */
-    protected int spillSlotSize(PlatformKind kind) {
+    public int spillSlotSize(PlatformKind kind) {
         return target.getSizeInBytes(kind);
     }
 
@@ -321,7 +330,7 @@
         if (slots == 0) {
             return null;
         }
-        spillSize += (slots * target.wordSize);
+        spillSize += (slots * stackSlotSize());
 
         if (!objects.isEmpty()) {
             assert objects.length() <= slots;
@@ -329,7 +338,7 @@
             for (int slotIndex = 0; slotIndex < slots; slotIndex++) {
                 StackSlot objectSlot = null;
                 if (objects.get(slotIndex)) {
-                    objectSlot = allocateNewSpillSlot(Kind.Object, slotIndex * target.wordSize);
+                    objectSlot = allocateNewSpillSlot(Kind.Object, slotIndex * stackSlotSize());
                     objectStackSlots.add(objectSlot);
                     if (outObjectStackSlots != null) {
                         outObjectStackSlots.add(objectSlot);
@@ -352,7 +361,7 @@
     }
 
     public ReferenceMap initReferenceMap(boolean hasRegisters) {
-        ReferenceMap refMap = target.createReferenceMap(hasRegisters, frameSize() / target.wordSize);
+        ReferenceMap refMap = target.createReferenceMap(hasRegisters, frameSize() / stackSlotSize());
         for (StackSlot slot : objectStackSlots) {
             setReference(slot, refMap);
         }