# HG changeset patch # User Stefan Anzinger # Date 1406659889 25200 # Node ID 8aa938ab4ac8e0ff9770358550f3fe1f5c90375a # Parent 403b07a69400dfef7aa4c46575a0e001aa10bdd5 [SPARC] Spill slots must be 4 byte aligned diff -r 403b07a69400 -r 8aa938ab4ac8 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java --- 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; diff -r 403b07a69400 -r 8aa938ab4ac8 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java --- 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 @@ * *
  *   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
diff -r 403b07a69400 -r 8aa938ab4ac8 graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java
--- 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);
+    }
 }