comparison graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java @ 8282:59744882ddeb

moved logic for reserving a special area/slot in a frame (e.g., for use during deoptimization) out of FrameMap and into platform specific backend class
author Doug Simon <doug.simon@oracle.com>
date Thu, 14 Mar 2013 14:35:53 +0100
parents 45bce3579308
children 9882af5c8504
comparison
equal deleted inserted replaced
8281:8fde1be81b2d 8282:59744882ddeb
68 * </pre> 68 * </pre>
69 * 69 *
70 * The spill slot area also includes stack allocated memory blocks (ALLOCA blocks). The size of such 70 * The spill slot area also includes stack allocated memory blocks (ALLOCA blocks). The size of such
71 * a block may be greater than the size of a normal spill slot or the word size. 71 * a block may be greater than the size of a normal spill slot or the word size.
72 * <p> 72 * <p>
73 * A runtime has two ways to reserve space in the stack frame for its own use: 73 * A runtime can reserve space at the beginning of the overflow argument area. The calling
74 * <ul> 74 * convention can specify that the first overflow stack argument is not at offset 0, but at a
75 * <li>A memory block somewhere in the frame of size 75 * specified offset. Use {@link CodeCacheProvider#getMinimumOutgoingSize()} to make sure that
76 * {@link CodeCacheProvider#getCustomStackAreaSize()}. The offset to this block is returned in 76 * call-free methods also have this space reserved. Then the VM can use the memory at offset 0
77 * {@link CompilationResult#getCustomStackAreaOffset()}. 77 * relative to the stack pointer.
78 * <li>At the beginning of the overflow argument area: The calling convention can specify that the
79 * first overflow stack argument is not at offset 0, but at a specified offset o. Use
80 * {@link CodeCacheProvider#getMinimumOutgoingSize()} to make sure that call-free methods also have
81 * this space reserved. Then the VM can use memory the memory at offset 0 relative to the stack
82 * pointer.
83 * </ul>
84 */ 78 */
85 public final class FrameMap { 79 public final class FrameMap {
86 80
87 public final CodeCacheProvider runtime; 81 public final CodeCacheProvider runtime;
88 public final TargetDescription target; 82 public final TargetDescription target;
113 107
114 /** 108 /**
115 * The list of stack areas allocated in this frame that are present in every reference map. 109 * The list of stack areas allocated in this frame that are present in every reference map.
116 */ 110 */
117 private final List<StackSlot> objectStackBlocks; 111 private final List<StackSlot> objectStackBlocks;
118
119 /**
120 * The stack area reserved for use by the VM, or {@code null} if the VM does not request stack
121 * space.
122 */
123 private final StackSlot customArea;
124 112
125 /** 113 /**
126 * Records whether an offset to an incoming stack argument was ever returned by 114 * Records whether an offset to an incoming stack argument was ever returned by
127 * {@link #offsetForStackSlot(StackSlot)}. 115 * {@link #offsetForStackSlot(StackSlot)}.
128 */ 116 */
137 this.registerConfig = registerConfig; 125 this.registerConfig = registerConfig;
138 this.frameSize = -1; 126 this.frameSize = -1;
139 this.spillSize = returnAddressSize() + calleeSaveAreaSize(); 127 this.spillSize = returnAddressSize() + calleeSaveAreaSize();
140 this.outgoingSize = runtime.getMinimumOutgoingSize(); 128 this.outgoingSize = runtime.getMinimumOutgoingSize();
141 this.objectStackBlocks = new ArrayList<>(); 129 this.objectStackBlocks = new ArrayList<>();
142 this.customArea = allocateStackBlock(runtime.getCustomStackAreaSize(), false);
143 this.initialFrameSize = currentFrameSize(); 130 this.initialFrameSize = currentFrameSize();
144 } 131 }
145 132
146 private int returnAddressSize() { 133 private int returnAddressSize() {
147 return target.arch.getReturnAddressSize(); 134 return target.arch.getReturnAddressSize();
218 * 205 *
219 * @return The offset to the callee save area (in bytes). 206 * @return The offset to the callee save area (in bytes).
220 */ 207 */
221 public int offsetToCalleeSaveArea() { 208 public int offsetToCalleeSaveArea() {
222 return frameSize() - calleeSaveAreaSize(); 209 return frameSize() - calleeSaveAreaSize();
223 }
224
225 /**
226 * Gets the offset of the stack area stack block reserved for use by the VM, or -1 if the VM
227 * does not request stack space.
228 *
229 * @return The offset to the custom area (in bytes).
230 */
231 public int offsetToCustomArea() {
232 return customArea == null ? -1 : offsetForStackSlot(customArea);
233 } 210 }
234 211
235 /** 212 /**
236 * Informs the frame map that the compiled code calls a particular method, which may need stack 213 * Informs the frame map that the compiled code calls a particular method, which may need stack
237 * space for outgoing arguments. 214 * space for outgoing arguments.