Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java @ 2774:93fd92c9f8b0
Removed usage of stateAfter on BlockEnd instructions.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Tue, 24 May 2011 13:39:50 +0200 |
parents | 27512ea6bbcb |
children | 3b73b230b86b |
comparison
equal
deleted
inserted
replaced
2773:27512ea6bbcb | 2774:93fd92c9f8b0 |
---|---|
279 return blocksVisited.contains(block); | 279 return blocksVisited.contains(block); |
280 } | 280 } |
281 | 281 |
282 private void finishStartBlock(Block startBlock) { | 282 private void finishStartBlock(Block startBlock) { |
283 assert bci() == 0; | 283 assert bci() == 0; |
284 FrameState stateAfter = frameState.create(bci()); | 284 Instruction target = createTargetAt(0, frameState); |
285 Instruction target = createTargetAt(0, stateAfter); | 285 Goto base = new Goto(target, graph); |
286 Goto base = new Goto(target, stateAfter, graph); | |
287 appendWithBCI(base); | 286 appendWithBCI(base); |
288 } | 287 } |
289 | 288 |
290 public void mergeOrClone(Block target, FrameStateAccess newState) { | 289 public void mergeOrClone(Block target, FrameStateAccess newState) { |
291 Instruction first = target.firstInstruction; | 290 Instruction first = target.firstInstruction; |
418 ExceptionObject exception = new ExceptionObject(graph); | 417 ExceptionObject exception = new ExceptionObject(graph); |
419 entry.appendNext(exception); | 418 entry.appendNext(exception); |
420 FrameState stateWithException = entryState.duplicateModified(bci, CiKind.Void, exception); | 419 FrameState stateWithException = entryState.duplicateModified(bci, CiKind.Void, exception); |
421 | 420 |
422 Instruction successor = createTarget(dispatchBlock, stateWithException); | 421 Instruction successor = createTarget(dispatchBlock, stateWithException); |
423 BlockEnd end = new Goto(successor, stateWithException, graph); | 422 BlockEnd end = new Goto(successor, graph); |
424 exception.appendNext(end); | 423 exception.appendNext(end); |
425 | 424 |
426 if (x instanceof Invoke) { | 425 if (x instanceof Invoke) { |
427 ((Invoke) x).setExceptionEdge(entry); | 426 ((Invoke) x).setExceptionEdge(entry); |
428 } else { | 427 } else { |
601 Value y = append(Constant.forInt(delta, graph)); | 600 Value y = append(Constant.forInt(delta, graph)); |
602 frameState.storeLocal(index, append(new ArithmeticOp(IADD, CiKind.Int, x, y, isStrict(method().accessFlags()), false, graph))); | 601 frameState.storeLocal(index, append(new ArithmeticOp(IADD, CiKind.Int, x, y, isStrict(method().accessFlags()), false, graph))); |
603 } | 602 } |
604 | 603 |
605 private void genGoto(int fromBCI, int toBCI) { | 604 private void genGoto(int fromBCI, int toBCI) { |
606 append(new Goto(createTargetAt(toBCI, frameState), null, graph)); | 605 append(new Goto(createTargetAt(toBCI, frameState), graph)); |
607 } | 606 } |
608 | 607 |
609 private void ifNode(Value x, Condition cond, Value y) { | 608 private void ifNode(Value x, Condition cond, Value y) { |
610 assert !x.isDeleted() && !y.isDeleted(); | 609 assert !x.isDeleted() && !y.isDeleted(); |
611 If ifNode = new If(x, cond, y, null, graph); | 610 If ifNode = new If(x, cond, y, graph); |
612 append(ifNode); | 611 append(ifNode); |
613 Instruction tsucc = createTargetAt(stream().readBranchDest(), frameState); | 612 Instruction tsucc = createTargetAt(stream().readBranchDest(), frameState); |
614 ifNode.setBlockSuccessor(0, tsucc); | 613 ifNode.setBlockSuccessor(0, tsucc); |
615 Instruction fsucc = createTargetAt(stream().nextBCI(), frameState); | 614 Instruction fsucc = createTargetAt(stream().nextBCI(), frameState); |
616 ifNode.setBlockSuccessor(1, fsucc); | 615 ifNode.setBlockSuccessor(1, fsucc); |
990 offsetList.add(offset); | 989 offsetList.add(offset); |
991 } | 990 } |
992 int offset = ts.defaultOffset(); | 991 int offset = ts.defaultOffset(); |
993 list.add(null); | 992 list.add(null); |
994 offsetList.add(offset); | 993 offsetList.add(offset); |
995 TableSwitch tableSwitch = new TableSwitch(value, list, ts.lowKey(), null, graph); | 994 TableSwitch tableSwitch = new TableSwitch(value, list, ts.lowKey(), graph); |
996 for (int i = 0; i < offsetList.size(); ++i) { | 995 for (int i = 0; i < offsetList.size(); ++i) { |
997 tableSwitch.setBlockSuccessor(i, createTargetAt(bci + offsetList.get(i), frameState)); | 996 tableSwitch.setBlockSuccessor(i, createTargetAt(bci + offsetList.get(i), frameState)); |
998 } | 997 } |
999 append(tableSwitch); | 998 append(tableSwitch); |
1000 } | 999 } |
1015 keys[i] = ls.keyAt(i); | 1014 keys[i] = ls.keyAt(i); |
1016 } | 1015 } |
1017 int offset = ls.defaultOffset(); | 1016 int offset = ls.defaultOffset(); |
1018 list.add(null); | 1017 list.add(null); |
1019 offsetList.add(offset); | 1018 offsetList.add(offset); |
1020 LookupSwitch lookupSwitch = new LookupSwitch(value, list, keys, null, graph); | 1019 LookupSwitch lookupSwitch = new LookupSwitch(value, list, keys, graph); |
1021 for (int i = 0; i < offsetList.size(); ++i) { | 1020 for (int i = 0; i < offsetList.size(); ++i) { |
1022 lookupSwitch.setBlockSuccessor(i, createTargetAt(bci + offsetList.get(i), frameState)); | 1021 lookupSwitch.setBlockSuccessor(i, createTargetAt(bci + offsetList.get(i), frameState)); |
1023 } | 1022 } |
1024 append(lookupSwitch); | 1023 append(lookupSwitch); |
1025 } | 1024 } |
1155 assert frameState.stackSize() == 1; | 1154 assert frameState.stackSize() == 1; |
1156 | 1155 |
1157 if (block.handler.catchType().isResolved()) { | 1156 if (block.handler.catchType().isResolved()) { |
1158 Instruction catchSuccessor = createTarget(block.handlerBlock, frameState); | 1157 Instruction catchSuccessor = createTarget(block.handlerBlock, frameState); |
1159 Instruction nextDispatch = createTarget(block.next, frameState); | 1158 Instruction nextDispatch = createTarget(block.next, frameState); |
1160 append(new ExceptionDispatch(frameState.stackAt(0), catchSuccessor, nextDispatch, block.handler.catchType(), frameState.duplicate(bci()), graph)); | 1159 append(new ExceptionDispatch(frameState.stackAt(0), catchSuccessor, nextDispatch, block.handler.catchType(), graph)); |
1161 } else { | 1160 } else { |
1162 Deoptimize deopt = new Deoptimize(graph); | 1161 Deoptimize deopt = new Deoptimize(graph); |
1163 deopt.setMessage("unresolved " + block.handler.catchType().name()); | 1162 deopt.setMessage("unresolved " + block.handler.catchType().name()); |
1164 append(deopt); | 1163 append(deopt); |
1165 Instruction nextDispatch = createTarget(block.next, frameState); | 1164 Instruction nextDispatch = createTarget(block.next, frameState); |
1166 append(new Goto(nextDispatch, frameState.duplicate(bci()), graph)); | 1165 append(new Goto(nextDispatch, graph)); |
1167 } | 1166 } |
1168 } | 1167 } |
1169 } | 1168 } |
1170 | 1169 |
1171 private BlockEnd iterateBytecodesForBlock(Block block) { | 1170 private BlockEnd iterateBytecodesForBlock(Block block) { |
1181 while (bci < endBCI) { | 1180 while (bci < endBCI) { |
1182 Block nextBlock = blockFromBci[bci]; | 1181 Block nextBlock = blockFromBci[bci]; |
1183 if (nextBlock != null && nextBlock != block) { | 1182 if (nextBlock != null && nextBlock != block) { |
1184 // we fell through to the next block, add a goto and break | 1183 // we fell through to the next block, add a goto and break |
1185 Instruction next = createTarget(nextBlock, frameState); | 1184 Instruction next = createTarget(nextBlock, frameState); |
1186 end = new Goto(next, null, graph); | 1185 end = new Goto(next, graph); |
1187 lastInstr = lastInstr.appendNext(end); | 1186 lastInstr = lastInstr.appendNext(end); |
1188 break; | 1187 break; |
1189 } | 1188 } |
1190 // read the opcode | 1189 // read the opcode |
1191 int opcode = stream.currentBC(); | 1190 int opcode = stream.currentBC(); |