Mercurial > hg > truffle
changeset 2749:36440e516e44
block entry instructions created on-demand
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 20 May 2011 14:09:28 +0200 |
parents | 861449bd8b86 |
children | 6048da340364 |
files | graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java |
diffstat | 1 files changed, 12 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Fri May 20 13:53:57 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Fri May 20 14:09:28 2011 +0200 @@ -115,8 +115,6 @@ private BlockBegin unwindBlock; - private final Set<Instruction> loopHeaders = new HashSet<Instruction>(); - /** * Creates a new, initialized, {@code GraphBuilder} instance for a given compilation. * @@ -156,23 +154,12 @@ blockList = new Block[rootMethod.code().length]; for (int i = 0; i < blockMap.blocks.size(); i++) { + int blockID = ir.nextBlockNumber(); + assert blockID == i; Block block = blockMap.blocks.get(i); - -// if (block.isLoopHeader) { - BlockBegin blockBegin = new BlockBegin(block.startBci, ir.nextBlockNumber(), graph); - - block.firstInstruction = blockBegin; - blockList[block.startBci] = block; - - if (block.isLoopHeader) { - loopHeaders.add(blockBegin); - } -// } else { -// blockList[block.startBci] = new Placeholder(graph); -// } + blockList[block.startBci] = block; } - // 1. create the start block Block startBlock = nextBlock(Instruction.SYNCHRONIZATION_ENTRY_BCI); BlockBegin startBlockBegin = new BlockBegin(0, startBlock.blockID, graph); @@ -381,7 +368,7 @@ int current = exceptionHandlers.size() - 1; if (exceptionHandlers.get(current).isCatchAll()) { - successor = exceptionHandlers.get(current).entryBlock().firstInstruction; + successor = createTarget(exceptionHandlers.get(current).entryBlock(), null); current--; } else { if (unwindBlock == null) { @@ -412,6 +399,7 @@ BlockBegin dispatchEntry = new BlockBegin(handler.handlerBCI(), ir.nextBlockNumber(), graph); if (handler.handler.catchType().isResolved()) { + Instruction entry = createTarget(handler.entryBlock(), null); ExceptionDispatch end = new ExceptionDispatch(null, (BlockBegin) handler.entryBlock().firstInstruction, null, handler, null, graph); end.setBlockSuccessor(0, (BlockBegin) successor); dispatchEntry.appendNext(end); @@ -1072,7 +1060,13 @@ } private Instruction createTarget(Block block, FrameStateAccess stateAfter) { - mergeOrClone(block, stateAfter); + if (block.firstInstruction == null) { + BlockBegin blockBegin = new BlockBegin(block.startBci, block.blockID, graph); + block.firstInstruction = blockBegin; + } + if (stateAfter != null) { + mergeOrClone(block, stateAfter); + } addToWorkList(block); return block.firstInstruction; }