# HG changeset patch # User Mick Jordan # Date 1378855947 25200 # Node ID 3d358ea1130065fd77e34e87778498f384b80ce8 # Parent 93c63975217e2cff3f45d901e205ad1ff6b5e164 allow backend to specify spill slot size diff -r 93c63975217e -r 3d358ea11300 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java Thu Aug 29 19:09:09 2013 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java Tue Sep 10 16:32:27 2013 -0700 @@ -28,12 +28,12 @@ /** * AMD64 specific frame map. - * + * * This is the format of an AMD64 stack frame: - * + * *
  *   Base       Contents
- * 
+ *
  *            :                                :  -----
  *   caller   | incoming overflow argument n   |    ^
  *   frame    :     ...                        :    | positive
@@ -55,9 +55,9 @@
  *            :     ...                        :    | positive   |      |
  *            | outgoing overflow argument 0   |    | offsets    v      v
  *    %sp-->  +--------------------------------+---------------------------
- * 
+ *
  * 
- * + * * The spill slot area also includes stack allocated memory blocks (ALLOCA blocks). The size of such * a block may be greater than the size of a normal spill slot or the word size. *

@@ -67,7 +67,7 @@ * call-free methods also have this space reserved. Then the VM can use the memory at offset 0 * relative to the stack pointer. */ -public final class AMD64FrameMap extends FrameMap { +public class AMD64FrameMap extends FrameMap { public AMD64FrameMap(CodeCacheProvider runtime, TargetDescription target, RegisterConfig registerConfig) { super(runtime, target, registerConfig); diff -r 93c63975217e -r 3d358ea11300 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java Thu Aug 29 19:09:09 2013 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java Tue Sep 10 16:32:27 2013 -0700 @@ -116,7 +116,7 @@ /** * Gets the frame size of the compiled frame, not including the size of the * {@link Architecture#getReturnAddressSize() return address slot}. - * + * * @return The size of the frame (in bytes). */ public int frameSize() { @@ -136,7 +136,7 @@ /** * Gets the total frame size of the compiled frame, including the size of the * {@link Architecture#getReturnAddressSize() return address slot}. - * + * * @return The total size of the frame (in bytes). */ public abstract int totalFrameSize(); @@ -149,7 +149,7 @@ /** * Aligns the given frame size to the stack alignment size and return the aligned size. - * + * * @param size the initial frame size to be aligned * @return the aligned frame size */ @@ -181,7 +181,7 @@ /** * Computes the offset of a stack slot relative to the frame register. - * + * * @param slot a stack slot * @return the offset of the stack slot */ @@ -197,7 +197,7 @@ /** * Computes the index of a stack slot relative to slot 0. This is also the bit index of stack * slots in the reference map. - * + * * @param slot a stack slot * @return the index of the stack slot */ @@ -209,7 +209,7 @@ /** * Gets the offset from the stack pointer to the stack area where callee-saved registers are * stored. - * + * * @return The offset to the callee save area (in bytes). */ public abstract int offsetToCalleeSaveArea(); @@ -217,7 +217,7 @@ /** * Informs the frame map that the compiled code calls a particular method, which may need stack * space for outgoing arguments. - * + * * @param cc The calling convention for the called method. */ public void callsMethod(CallingConvention cc) { @@ -226,7 +226,7 @@ /** * Reserves space for stack-based outgoing arguments. - * + * * @param argsSize The amount of space (in bytes) to reserve for stack-based outgoing arguments. */ public void reserveOutgoing(int argsSize) { @@ -239,7 +239,7 @@ * Reserves a new spill slot in the frame of the method being compiled. The returned slot is * aligned on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte * boundary. - * + * * @param kind The kind of the spill slot to be reserved. * @param additionalOffset * @return A spill slot denoting the reserved memory area. @@ -247,9 +247,20 @@ protected abstract StackSlot allocateNewSpillSlot(PlatformKind kind, int additionalOffset); /** + * Returns the spill slot size for the given {@link PlatformKind}. + * The default value is the size in bytes for the target architecture. + * @param kind the {@link PlatformKind} to be stored in the spill slot. + * @return the size in bytes + */ + protected int spillSlotSize(PlatformKind kind) { + return target.arch.getSizeInBytes(kind); + } + + /** * Reserves a spill slot in the frame of the method being compiled. The returned slot is aligned - * on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte boundary. - * + * on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte boundary, + * unless overridden by a subclass. + * * @param kind The kind of the spill slot to be reserved. * @return A spill slot denoting the reserved memory area. */ @@ -267,7 +278,7 @@ } } } - int size = target.arch.getSizeInBytes(kind); + int size = spillSlotSize(kind); spillSize = NumUtil.roundUp(spillSize + size, size); return allocateNewSpillSlot(kind, 0); } @@ -288,7 +299,7 @@ /** * Reserves a block of memory in the frame of the method being compiled. The returned block is * aligned on a word boundary. If the requested size is 0, the method returns {@code null}. - * + * * @param size The size to reserve (in bytes). * @param refs Specifies if the block is all references. If true, the block will be in all * reference maps for this method. The caller is responsible to initialize the memory @@ -340,7 +351,7 @@ * Marks the specified location as a reference in the reference map of the debug information. * The tracked location can be a {@link RegisterValue} or a {@link StackSlot}. Note that a * {@link Constant} is automatically tracked. - * + * * @param location The location to be added to the reference map. * @param registerRefMap A register reference map, as created by {@link #initRegisterRefMap()}. * @param frameRefMap A frame reference map, as created by {@link #initFrameRefMap()}.