comparison graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiStackSlot.java @ 5503:438ab53efdd0

Renaming CiKind => RiKind.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 07 Jun 2012 17:08:33 +0200
parents 1e3ecb08767d
children 452f91ebdb54
comparison
equal deleted inserted replaced
5502:13aee5aba8cc 5503:438ab53efdd0
20 * or visit www.oracle.com if you need additional information or have any 20 * or visit www.oracle.com if you need additional information or have any
21 * questions. 21 * questions.
22 */ 22 */
23 package com.oracle.max.cri.ci; 23 package com.oracle.max.cri.ci;
24 24
25 import static com.oracle.max.cri.ci.CiKind.*; 25 import static com.oracle.max.cri.ci.RiKind.*;
26 26
27 /** 27 /**
28 * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame 28 * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame
29 * or an incoming stack-based argument in a method's {@linkplain #inCallerFrame() caller's frame}. 29 * or an incoming stack-based argument in a method's {@linkplain #inCallerFrame() caller's frame}.
30 */ 30 */
41 * @param kind The kind of the value stored in the stack slot. 41 * @param kind The kind of the value stored in the stack slot.
42 * @param offset The offset of the stack slot (in bytes) 42 * @param offset The offset of the stack slot (in bytes)
43 * @param inCallerFrame Specifies if the offset is relative to the stack pointer, 43 * @param inCallerFrame Specifies if the offset is relative to the stack pointer,
44 * or the beginning of the frame (stack pointer + total frame size). 44 * or the beginning of the frame (stack pointer + total frame size).
45 */ 45 */
46 public static CiStackSlot get(CiKind kind, int offset, boolean addFrameSize) { 46 public static CiStackSlot get(RiKind kind, int offset, boolean addFrameSize) {
47 assert kind.stackKind() == kind; 47 assert kind.stackKind() == kind;
48 assert addFrameSize || offset >= 0; 48 assert addFrameSize || offset >= 0;
49 49
50 if (offset % CACHE_GRANULARITY == 0) { 50 if (offset % CACHE_GRANULARITY == 0) {
51 CiStackSlot[][] cache; 51 CiStackSlot[][] cache;
69 } 69 }
70 70
71 /** 71 /**
72 * Private constructor to enforce use of {@link #get()} so that a cache can be used. 72 * Private constructor to enforce use of {@link #get()} so that a cache can be used.
73 */ 73 */
74 private CiStackSlot(CiKind kind, int offset, boolean addFrameSize) { 74 private CiStackSlot(RiKind kind, int offset, boolean addFrameSize) {
75 super(kind); 75 super(kind);
76 this.offset = offset; 76 this.offset = offset;
77 this.addFrameSize = addFrameSize; 77 this.addFrameSize = addFrameSize;
78 } 78 }
79 79
158 private static final CiStackSlot[][] SPILL_CACHE = makeCache(SPILL_CACHE_PER_KIND_SIZE, -1, true); 158 private static final CiStackSlot[][] SPILL_CACHE = makeCache(SPILL_CACHE_PER_KIND_SIZE, -1, true);
159 private static final CiStackSlot[][] IN_CACHE = makeCache(PARAM_CACHE_PER_KIND_SIZE, 1, true); 159 private static final CiStackSlot[][] IN_CACHE = makeCache(PARAM_CACHE_PER_KIND_SIZE, 1, true);
160 private static final CiStackSlot[][] OUT_CACHE = makeCache(PARAM_CACHE_PER_KIND_SIZE, 1, false); 160 private static final CiStackSlot[][] OUT_CACHE = makeCache(PARAM_CACHE_PER_KIND_SIZE, 1, false);
161 161
162 private static CiStackSlot[][] makeCache(int cachePerKindSize, int sign, boolean addFrameSize) { 162 private static CiStackSlot[][] makeCache(int cachePerKindSize, int sign, boolean addFrameSize) {
163 CiStackSlot[][] cache = new CiStackSlot[CiKind.VALUES.length][]; 163 CiStackSlot[][] cache = new CiStackSlot[RiKind.VALUES.length][];
164 for (CiKind kind : new CiKind[] {Illegal, Int, Long, Float, Double, Object, Jsr}) { 164 for (RiKind kind : new RiKind[] {Illegal, Int, Long, Float, Double, Object, Jsr}) {
165 CiStackSlot[] slots = new CiStackSlot[cachePerKindSize]; 165 CiStackSlot[] slots = new CiStackSlot[cachePerKindSize];
166 for (int i = 0; i < cachePerKindSize; i++) { 166 for (int i = 0; i < cachePerKindSize; i++) {
167 slots[i] = new CiStackSlot(kind, sign * i * CACHE_GRANULARITY, addFrameSize); 167 slots[i] = new CiStackSlot(kind, sign * i * CACHE_GRANULARITY, addFrameSize);
168 } 168 }
169 cache[kind.ordinal()] = slots; 169 cache[kind.ordinal()] = slots;