comparison graal/GraalCompiler/src/com/sun/c1x/graph/ScopeData.java @ 2564:274360f98f97

Remove inlining (2nd part) removed IRScope
author Gilles Duboscq <gilles.duboscq@oracle.com>
date Fri, 29 Apr 2011 13:19:17 +0200
parents 16b9a8b5ad39
children
comparison
equal deleted inserted replaced
2563:491896f81cae 2564:274360f98f97
61 public final int mask = 1 << ordinal(); 61 public final int mask = 1 << ordinal();
62 } 62 }
63 63
64 64
65 final ScopeData parent; 65 final ScopeData parent;
66 // the IR scope 66 //
67 final IRScope scope; 67 final RiMethod method;
68 // bci-to-block mapping 68 // bci-to-block mapping
69 final BlockMap blockMap; 69 final BlockMap blockMap;
70 // the bytecode stream 70 // the bytecode stream
71 final BytecodeStream stream; 71 final BytecodeStream stream;
72 // the constant pool 72 // the constant pool
130 * @param scope the IR scope 130 * @param scope the IR scope
131 * @param blockMap the block map for this scope 131 * @param blockMap the block map for this scope
132 * @param stream the bytecode stream 132 * @param stream the bytecode stream
133 * @param constantPool the constant pool 133 * @param constantPool the constant pool
134 */ 134 */
135 public ScopeData(ScopeData parent, IRScope scope, BlockMap blockMap, BytecodeStream stream, RiConstantPool constantPool) { 135 public ScopeData(ScopeData parent, RiMethod method, BlockMap blockMap, BytecodeStream stream, RiConstantPool constantPool) {
136 this.parent = parent; 136 this.parent = parent;
137 this.scope = scope; 137 this.method = method;
138 this.blockMap = blockMap; 138 this.blockMap = blockMap;
139 this.stream = stream; 139 this.stream = stream;
140 this.constantPool = constantPool; 140 this.constantPool = constantPool;
141 this.jsrEntryBci = -1; 141 this.jsrEntryBci = -1;
142 this.jsrDuplicatedBlocks = null; 142 this.jsrDuplicatedBlocks = null;
146 maxInlineSize = C1XOptions.MaximumTrivialSize; 146 maxInlineSize = C1XOptions.MaximumTrivialSize;
147 } 147 }
148 if (parent.hasHandler()) { 148 if (parent.hasHandler()) {
149 flags |= HasHandler.mask; 149 flags |= HasHandler.mask;
150 } 150 }
151 if (parent.noSafepoints() || scope.method.noSafepoints()) { 151 if (parent.noSafepoints() || method.noSafepoints()) {
152 flags |= NoSafepoints.mask; 152 flags |= NoSafepoints.mask;
153 } 153 }
154 } else { 154 } else {
155 maxInlineSize = C1XOptions.MaximumInlineSize; 155 maxInlineSize = C1XOptions.MaximumInlineSize;
156 if (scope.method.noSafepoints()) { 156 if (method.noSafepoints()) {
157 flags |= NoSafepoints.mask; 157 flags |= NoSafepoints.mask;
158 } 158 }
159 } 159 }
160 RiExceptionHandler[] handlers = scope.method.exceptionHandlers(); 160 RiExceptionHandler[] handlers = method.exceptionHandlers();
161 if (handlers != null && handlers.length > 0) { 161 if (handlers != null && handlers.length > 0) {
162 exceptionHandlers = new ArrayList<ExceptionHandler>(handlers.length); 162 exceptionHandlers = new ArrayList<ExceptionHandler>(handlers.length);
163 for (RiExceptionHandler ch : handlers) { 163 for (RiExceptionHandler ch : handlers) {
164 ExceptionHandler h = new ExceptionHandler(ch); 164 ExceptionHandler h = new ExceptionHandler(ch);
165 h.setEntryBlock(blockAt(h.handler.handlerBCI())); 165 h.setEntryBlock(blockAt(h.handler.handlerBCI()));
177 * @param blockMap the block map for this scope 177 * @param blockMap the block map for this scope
178 * @param stream the bytecode stream 178 * @param stream the bytecode stream
179 * @param constantPool the constant pool 179 * @param constantPool the constant pool
180 * @param jsrEntryBci the bytecode index of the entrypoint of the JSR 180 * @param jsrEntryBci the bytecode index of the entrypoint of the JSR
181 */ 181 */
182 public ScopeData(ScopeData parent, IRScope scope, BlockMap blockMap, BytecodeStream stream, RiConstantPool constantPool, int jsrEntryBci) { 182 public ScopeData(ScopeData parent, RiMethod method, BlockMap blockMap, BytecodeStream stream, RiConstantPool constantPool, int jsrEntryBci) {
183 this.parent = parent; 183 this.parent = parent;
184 this.scope = scope; 184 this.method = method;
185 this.blockMap = blockMap; 185 this.blockMap = blockMap;
186 this.stream = stream; 186 this.stream = stream;
187 this.constantPool = constantPool; 187 this.constantPool = constantPool;
188 assert jsrEntryBci > 0 : "jsr cannot jump to BCI 0"; 188 assert jsrEntryBci > 0 : "jsr cannot jump to BCI 0";
189 assert parent != null : "jsr must have parent scope"; 189 assert parent != null : "jsr must have parent scope";
190 this.jsrEntryBci = jsrEntryBci; 190 this.jsrEntryBci = jsrEntryBci;
191 this.jsrDuplicatedBlocks = new BlockBegin[scope.method.code().length]; 191 this.jsrDuplicatedBlocks = new BlockBegin[method.code().length];
192 this.jsrRetAddrLocal = -1; 192 this.jsrRetAddrLocal = -1;
193 193
194 maxInlineSize = (int) (C1XOptions.MaximumInlineRatio * parent.maxInlineSize()); 194 maxInlineSize = (int) (C1XOptions.MaximumInlineRatio * parent.maxInlineSize());
195 if (maxInlineSize < C1XOptions.MaximumTrivialSize) { 195 if (maxInlineSize < C1XOptions.MaximumTrivialSize) {
196 maxInlineSize = C1XOptions.MaximumTrivialSize; 196 maxInlineSize = C1XOptions.MaximumTrivialSize;
269 public int maxInlineSize() { 269 public int maxInlineSize() {
270 return maxInlineSize; 270 return maxInlineSize;
271 } 271 }
272 272
273 /** 273 /**
274 * Gets the size of the stack at the caller.
275 * @return the size of the stack
276 */
277 public int callerStackSize() {
278 FrameState state = scope.callerState;
279 return state == null ? 0 : state.stackSize();
280 }
281
282 /**
283 * Gets the block continuation for this ScopeData. 274 * Gets the block continuation for this ScopeData.
284 * @return the continuation 275 * @return the continuation
285 */ 276 */
286 public BlockBegin continuation() { 277 public BlockBegin continuation() {
287 return continuation; 278 return continuation;
500 * @return a string representation of this scope data 491 * @return a string representation of this scope data
501 */ 492 */
502 @Override 493 @Override
503 public String toString() { 494 public String toString() {
504 if (parsingJsr()) { 495 if (parsingJsr()) {
505 return "jsr@" + jsrEntryBci + " data for " + scope.toString(); 496 return "jsr@" + jsrEntryBci + " data for " + method.toString();
506 } else { 497 } else {
507 return "data for " + scope.toString(); 498 return "data for " + method.toString();
508 } 499 }
509 500
510 } 501 }
511 } 502 }