comparison graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java @ 2729:108adba3345e

Removed usage of stackmap table for local variable liveness.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Thu, 19 May 2011 17:17:22 +0200
parents 7e470e1cd3b6
children 027adfafd47e a2f62de90c76
comparison
equal deleted inserted replaced
2728:7e470e1cd3b6 2729:108adba3345e
271 271
272 if (existingState == null) { 272 if (existingState == null) {
273 // copy state because it is modified 273 // copy state because it is modified
274 FrameState duplicate = newState.duplicate(bci()); 274 FrameState duplicate = newState.duplicate(bci());
275 275
276 if (C1XOptions.UseStackMapTableLiveness && method != null) {
277 // if a liveness map is available, use it to invalidate dead locals
278 CiBitMap[] livenessMap = method.livenessMap();
279 if (livenessMap != null && bci() >= 0) {
280 assert bci() < livenessMap.length;
281 CiBitMap liveness = livenessMap[bci()];
282 if (liveness != null) {
283 invalidateDeadLocals(duplicate, liveness);
284 }
285 }
286 }
287
288 // if the block is a loop header, insert all necessary phis 276 // if the block is a loop header, insert all necessary phis
289 if (isParserLoopHeader()) { 277 if (isParserLoopHeader()) {
290 insertLoopPhis(duplicate); 278 insertLoopPhis(duplicate);
291 } 279 }
292 280
299 287
300 assert existingState.localsSize() == newState.localsSize(); 288 assert existingState.localsSize() == newState.localsSize();
301 assert existingState.stackSize() == newState.stackSize(); 289 assert existingState.stackSize() == newState.stackSize();
302 290
303 existingState.merge(this, newState); 291 existingState.merge(this, newState);
304 }
305 }
306
307 private void invalidateDeadLocals(FrameState newState, CiBitMap liveness) {
308 int max = newState.localsSize();
309 assert max <= liveness.size();
310 for (int i = 0; i < max; i++) {
311 Value x = newState.localAt(i);
312 if (x != null) {
313 if (!liveness.get(i)) {
314 // invalidate the local if it is not live
315 newState.invalidateLocal(i);
316 }
317 }
318 } 292 }
319 } 293 }
320 294
321 private void insertLoopPhis(FrameState newState) { 295 private void insertLoopPhis(FrameState newState) {
322 int stackSize = newState.stackSize(); 296 int stackSize = newState.stackSize();