comparison graal/com.oracle.max.cri/src/com/sun/cri/ci/CiTarget.java @ 4181:319860ae697a

Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
author Christian Wimmer <Christian.Wimmer@Oracle.com>
date Mon, 02 Jan 2012 14:16:08 -0800
parents e233f5660da4
children
comparison
equal deleted inserted replaced
4180:383c1272cd1f 4181:319860ae697a
1 /* 1 /*
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
39 * Specifies if this is a multi-processor system. 39 * Specifies if this is a multi-processor system.
40 */ 40 */
41 public final boolean isMP; 41 public final boolean isMP;
42 42
43 /** 43 /**
44 * The number of {@link #spillSlotSize spill slots} required per kind.
45 */
46 private final int[] spillSlotsPerKindMap;
47
48 /**
49 * Specifies if this target supports encoding objects inline in the machine code. 44 * Specifies if this target supports encoding objects inline in the machine code.
50 */ 45 */
51 public final boolean inlineObjects; 46 public final boolean inlineObjects;
52
53 /**
54 * The spill slot size for values that occupy 1 {@linkplain CiKind#sizeInSlots() Java slot}.
55 */
56 public final int spillSlotSize;
57 47
58 /** 48 /**
59 * The machine word size on this target. 49 * The machine word size on this target.
60 */ 50 */
61 public final int wordSize; 51 public final int wordSize;
105 // TODO This should go away when XIR goes away, and the logic be part of the VM-specific lowering. 95 // TODO This should go away when XIR goes away, and the logic be part of the VM-specific lowering.
106 public final boolean invokeSnippetAfterArguments; 96 public final boolean invokeSnippetAfterArguments;
107 97
108 public CiTarget(CiArchitecture arch, 98 public CiTarget(CiArchitecture arch,
109 boolean isMP, 99 boolean isMP,
110 int spillSlotSize,
111 int stackAlignment, 100 int stackAlignment,
112 int pageSize, 101 int pageSize,
113 int cacheAlignment, 102 int cacheAlignment,
114 boolean inlineObjects, 103 boolean inlineObjects,
115 boolean debugInfoDoubleWordsInSecondSlot, 104 boolean debugInfoDoubleWordsInSecondSlot,
116 boolean invokeSnippetAfterArguments) { 105 boolean invokeSnippetAfterArguments) {
117 this.arch = arch; 106 this.arch = arch;
118 this.pageSize = pageSize; 107 this.pageSize = pageSize;
119 this.isMP = isMP; 108 this.isMP = isMP;
120 this.spillSlotSize = spillSlotSize;
121 this.wordSize = arch.wordSize; 109 this.wordSize = arch.wordSize;
122 if (wordSize == 8) { 110 if (wordSize == 8) {
123 this.wordKind = CiKind.Long; 111 this.wordKind = CiKind.Long;
124 } else { 112 } else {
125 this.wordKind = CiKind.Int; 113 this.wordKind = CiKind.Int;
126 } 114 }
127 this.stackAlignment = stackAlignment; 115 this.stackAlignment = stackAlignment;
128 this.stackBias = 0; // TODO: configure with param once SPARC port exists 116 this.stackBias = 0; // TODO: configure with param once SPARC port exists
129 this.cacheAlignment = cacheAlignment; 117 this.cacheAlignment = cacheAlignment;
130 this.inlineObjects = inlineObjects; 118 this.inlineObjects = inlineObjects;
131 this.spillSlotsPerKindMap = new int[CiKind.values().length];
132 this.debugInfoDoubleWordsInSecondSlot = debugInfoDoubleWordsInSecondSlot; 119 this.debugInfoDoubleWordsInSecondSlot = debugInfoDoubleWordsInSecondSlot;
133 this.invokeSnippetAfterArguments = invokeSnippetAfterArguments; 120 this.invokeSnippetAfterArguments = invokeSnippetAfterArguments;
134
135 for (CiKind k : CiKind.values()) {
136 // initialize the number of spill slots required for each kind
137 int size = sizeInBytes(k);
138 int slots = 0;
139 while (slots * spillSlotSize < size) {
140 slots++;
141 }
142 spillSlotsPerKindMap[k.ordinal()] = slots;
143 }
144 } 121 }
145 122
146 /** 123 /**
147 * Gets the size in bytes of the specified kind for this target. 124 * Gets the size in bytes of the specified kind for this target.
148 * 125 *
166 } 143 }
167 // Checkstyle: resume 144 // Checkstyle: resume
168 } 145 }
169 146
170 /** 147 /**
171 * Gets the number of spill slots for a specified kind in this target.
172 * @param kind the kind for which to get the spill slot count
173 * @return the number of spill slots for {@code kind}
174 */
175 public int spillSlots(CiKind kind) {
176 return spillSlotsPerKindMap[kind.ordinal()];
177 }
178
179 /**
180 * Aligns the given frame size (without return instruction pointer) to the stack 148 * Aligns the given frame size (without return instruction pointer) to the stack
181 * alignment size and return the aligned size (without return instruction pointer). 149 * alignment size and return the aligned size (without return instruction pointer).
182 * @param frameSize the initial frame size to be aligned 150 * @param frameSize the initial frame size to be aligned
183 * @return the aligned frame size 151 * @return the aligned frame size
184 */ 152 */