comparison graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java @ 2771:056e392d63d4

Connected local variables to start node. No more need for frame state to emit locals.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Tue, 24 May 2011 09:49:04 +0200
parents dd6419f4bfe2
children 3e3338a1abb9
comparison
equal deleted inserted replaced
2770:4f3053eef0de 2771:056e392d63d4
271 XirSnippet snippet = xir.genArrayLength(site(x), array); 271 XirSnippet snippet = xir.genArrayLength(site(x), array);
272 emitXir(snippet, x, stateFor(x), null, true); 272 emitXir(snippet, x, stateFor(x), null, true);
273 return x.operand(); 273 return x.operand();
274 } 274 }
275 275
276 private void setOperandsForLocals(FrameState state) { 276 private void setOperandsForLocals() {
277 CiCallingConvention args = compilation.frameMap().incomingArguments(); 277 CiCallingConvention args = compilation.frameMap().incomingArguments();
278 int javaIndex = 0; 278 for (Node node : compilation.graph.start().usages()) {
279 for (int i = 0; i < args.locations.length; i++) { 279 if (node instanceof Local) {
280 CiValue src = args.locations[i]; 280 Local local = (Local) node;
281 assert src.isLegal() : "check"; 281 int i = local.index();
282 282
283 CiVariable dest = newVariable(src.kind.stackKind()); 283 CiValue src = args.locations[i];
284 lir.move(src, dest, src.kind); 284 assert src.isLegal() : "check";
285 285
286 // Assign new location to Local instruction for this local 286 CiVariable dest = newVariable(src.kind.stackKind());
287 Value instr = state.localAt(javaIndex); 287 lir.move(src, dest, src.kind);
288 Local local = ((Local) instr); 288
289 CiKind kind = src.kind.stackKind(); 289 assert src.kind.stackKind() == local.kind.stackKind() : "local type check failed";
290 assert kind == local.kind.stackKind() : "local type check failed"; 290 setResult(local, dest);
291 setResult(local, dest); 291 }
292 javaIndex += kind.jvmSlots;
293 } 292 }
294 } 293 }
295 294
296 @Override 295 @Override
297 public void visitCheckCast(CheckCast x) { 296 public void visitCheckCast(CheckCast x) {
892 if (block == ir.startBlock) { 891 if (block == ir.startBlock) {
893 XirSnippet prologue = xir.genPrologue(null, compilation.method); 892 XirSnippet prologue = xir.genPrologue(null, compilation.method);
894 if (prologue != null) { 893 if (prologue != null) {
895 emitXir(prologue, null, null, null, false); 894 emitXir(prologue, null, null, null, false);
896 } 895 }
897 setOperandsForLocals(ir.getHIRStartBlock().end().stateAfter()); 896 setOperandsForLocals();
898 } 897 }
899 } 898 }
900 899
901 /** 900 /**
902 * Copies a given value into an operand that is forced to be a stack location. 901 * Copies a given value into an operand that is forced to be a stack location.