Mercurial > hg > graal-jvmci-8
comparison graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java @ 2783:9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 25 May 2011 12:04:58 +0200 |
parents | 915456e4959e |
children | e62cfea1c134 |
comparison
equal
deleted
inserted
replaced
2782:915456e4959e | 2783:9bc0c2eb00d6 |
---|---|
25 import static com.sun.cri.bytecode.Bytecodes.*; | 25 import static com.sun.cri.bytecode.Bytecodes.*; |
26 import static com.sun.cri.bytecode.Bytecodes.MemoryBarriers.*; | 26 import static com.sun.cri.bytecode.Bytecodes.MemoryBarriers.*; |
27 import static com.sun.cri.ci.CiCallingConvention.Type.*; | 27 import static com.sun.cri.ci.CiCallingConvention.Type.*; |
28 import static com.sun.cri.ci.CiValue.*; | 28 import static com.sun.cri.ci.CiValue.*; |
29 | 29 |
30 import java.lang.reflect.*; | |
30 import java.util.*; | 31 import java.util.*; |
31 | 32 |
32 import com.oracle.graal.graph.*; | 33 import com.oracle.graal.graph.*; |
33 import com.oracle.max.asm.*; | 34 import com.oracle.max.asm.*; |
34 import com.sun.c1x.*; | 35 import com.sun.c1x.*; |
255 | 256 |
256 if (C1XOptions.TraceLIRGeneratorLevel >= 1) { | 257 if (C1XOptions.TraceLIRGeneratorLevel >= 1) { |
257 TTY.println("END Generating LIR for block B" + block.blockID()); | 258 TTY.println("END Generating LIR for block B" + block.blockID()); |
258 } | 259 } |
259 | 260 |
261 block.setLastState(lastState); | |
260 this.currentBlock = null; | 262 this.currentBlock = null; |
261 blockDoEpilog(); | 263 blockDoEpilog(); |
262 } | 264 } |
263 | 265 |
264 @Override | 266 @Override |
271 XirSnippet snippet = xir.genArrayLength(site(x), array); | 273 XirSnippet snippet = xir.genArrayLength(site(x), array); |
272 emitXir(snippet, x, stateFor(x), null, true); | 274 emitXir(snippet, x, stateFor(x), null, true); |
273 return x.operand(); | 275 return x.operand(); |
274 } | 276 } |
275 | 277 |
276 private void setOperandsForLocals() { | 278 private FrameState setOperandsForLocals() { |
277 CiCallingConvention args = compilation.frameMap().incomingArguments(); | 279 CiCallingConvention args = compilation.frameMap().incomingArguments(); |
280 int bci = 0; | |
281 if (Modifier.isSynchronized(compilation.method.accessFlags())) { | |
282 bci = Instruction.SYNCHRONIZATION_ENTRY_BCI; | |
283 } | |
284 FrameState fs = new FrameState(bci, compilation.method.maxLocals(), 0, 0, compilation.graph); | |
278 for (Node node : compilation.graph.start().usages()) { | 285 for (Node node : compilation.graph.start().usages()) { |
279 if (node instanceof Local) { | 286 if (node instanceof Local) { |
280 Local local = (Local) node; | 287 Local local = (Local) node; |
281 int i = local.index(); | 288 int i = local.index(); |
289 fs.storeLocal(i, local); | |
282 | 290 |
283 CiValue src = args.locations[i]; | 291 CiValue src = args.locations[i]; |
284 assert src.isLegal() : "check"; | 292 assert src.isLegal() : "check"; |
285 | 293 |
286 CiVariable dest = newVariable(src.kind.stackKind()); | 294 CiVariable dest = newVariable(src.kind.stackKind()); |
288 | 296 |
289 assert src.kind.stackKind() == local.kind.stackKind() : "local type check failed"; | 297 assert src.kind.stackKind() == local.kind.stackKind() : "local type check failed"; |
290 setResult(local, dest); | 298 setResult(local, dest); |
291 } | 299 } |
292 } | 300 } |
301 return fs; | |
293 } | 302 } |
294 | 303 |
295 @Override | 304 @Override |
296 public void visitCheckCast(CheckCast x) { | 305 public void visitCheckCast(CheckCast x) { |
297 XirArgument obj = toXirArgument(x.object()); | 306 XirArgument obj = toXirArgument(x.object()); |
890 if (block == ir.startBlock) { | 899 if (block == ir.startBlock) { |
891 XirSnippet prologue = xir.genPrologue(null, compilation.method); | 900 XirSnippet prologue = xir.genPrologue(null, compilation.method); |
892 if (prologue != null) { | 901 if (prologue != null) { |
893 emitXir(prologue, null, null, null, false); | 902 emitXir(prologue, null, null, null, false); |
894 } | 903 } |
895 setOperandsForLocals(); | 904 FrameState fs = setOperandsForLocals(); |
905 lastState = fs; | |
906 } else if (block.blockPredecessors().size() == 1) { | |
907 FrameState fs = block.blockPredecessors().get(0).lastState(); | |
908 assert fs != null; | |
909 lastState = fs; | |
896 } | 910 } |
897 } | 911 } |
898 | 912 |
899 /** | 913 /** |
900 * Copies a given value into an operand that is forced to be a stack location. | 914 * Copies a given value into an operand that is forced to be a stack location. |