changeset 16654:8aa938ab4ac8

[SPARC] Spill slots must be 4 byte aligned
author Stefan Anzinger <stefan.anzinger@gmail.com>
date Tue, 29 Jul 2014 11:51:29 -0700
parents 403b07a69400
children 6514c67b7efa
files graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java
diffstat 3 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java	Tue Jul 29 11:04:36 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java	Tue Jul 29 11:51:29 2014 -0700
@@ -235,8 +235,8 @@
             }
 
             if (locations[i] == null) {
-                // Stack slot is always aligned to its size in bytes
-                int typeSize = target.getSizeInBytes(kind);
+                // Stack slot is always aligned to its size in bytes but minimum wordsize
+                int typeSize = SPARC.spillSlotSize(target, kind);
                 int modulus = currentStackOffset % typeSize;
                 if (modulus != 0) {
                     currentStackOffset += typeSize - modulus;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java	Tue Jul 29 11:04:36 2014 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java	Tue Jul 29 11:51:29 2014 -0700
@@ -26,6 +26,7 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.lir.*;
+import com.oracle.graal.sparc.*;
 
 /**
  * SPARC specific frame map.
@@ -34,7 +35,7 @@
  *
  * <pre>
  *   Base       Contents
- * 
+ *
  *            :                                :  -----
  *   caller   | incoming overflow argument n   |    ^
  *   frame    :     ...                        :    | positive
@@ -107,6 +108,14 @@
     }
 
     /**
+     * In SPARC we have spill slots word aligned
+     */
+    @Override
+    public int spillSlotSize(LIRKind kind) {
+        return SPARC.spillSlotSize(target, kind.getPlatformKind());
+    }
+
+    /**
      * We must add the calleSaveAreaSize() when it is a in or out parameter
      */
     @Override
--- a/graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java	Tue Jul 29 11:04:36 2014 -0700
+++ b/graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java	Tue Jul 29 11:51:29 2014 -0700
@@ -195,6 +195,11 @@
      */
     public static final int FLOAT_REGISTER_COUNT = 64;
 
+    /**
+     * Alignment for valid memory access
+     */
+    public static final int MEMORY_ACCESS_ALIGN = 4;
+
     public SPARC() {
         super("SPARC", 8, ByteOrder.BIG_ENDIAN, false, allRegisters, LOAD_STORE | STORE_STORE, 1, r31.encoding + FLOAT_REGISTER_COUNT + 1, 8);
     }
@@ -237,4 +242,8 @@
             return Kind.Illegal;
         }
     }
+
+    public static int spillSlotSize(TargetDescription td, PlatformKind kind) {
+        return Math.max(td.getSizeInBytes(kind), MEMORY_ACCESS_ALIGN);
+    }
 }