comparison graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java @ 2833:1cd59ca9ac86

Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Tue, 31 May 2011 13:30:23 +0200
parents d54ea877a302
children c1c8a0291771
comparison
equal deleted inserted replaced
2832:775c31be565c 2833:1cd59ca9ac86
214 public static class DeoptimizationStub { 214 public static class DeoptimizationStub {
215 public final Label label = new Label(); 215 public final Label label = new Label();
216 public final LIRDebugInfo info; 216 public final LIRDebugInfo info;
217 217
218 public DeoptimizationStub(FrameState state) { 218 public DeoptimizationStub(FrameState state) {
219 info = new LIRDebugInfo(state, null); 219 info = new LIRDebugInfo(state);
220 } 220 }
221 } 221 }
222 222
223 public void doBlock(LIRBlock block) { 223 public void doBlock(LIRBlock block) {
224 blockDoProlog(block); 224 blockDoProlog(block);
475 @Override 475 @Override
476 public void visitInvoke(Invoke x) { 476 public void visitInvoke(Invoke x) {
477 RiMethod target = x.target(); 477 RiMethod target = x.target();
478 LIRDebugInfo info = stateFor(x, stateBeforeInvokeWithArguments(x)); 478 LIRDebugInfo info = stateFor(x, stateBeforeInvokeWithArguments(x));
479 LIRDebugInfo info2 = stateFor(x, stateBeforeInvokeReturn(x)); 479 LIRDebugInfo info2 = stateFor(x, stateBeforeInvokeReturn(x));
480 if (x.exceptionEdge() != null) {
481 info2.setExceptionEdge(getLIRBlock(x.exceptionEdge()));
482 }
480 483
481 XirSnippet snippet = null; 484 XirSnippet snippet = null;
482 485
483 int opcode = x.opcode(); 486 int opcode = x.opcode();
484 XirArgument receiver; 487 XirArgument receiver;
875 targets[i] = getLIRBlock(nonDefaultSuccessors.get(i)); 878 targets[i] = getLIRBlock(nonDefaultSuccessors.get(i));
876 } 879 }
877 lir.tableswitch(tag, x.lowKey(), getLIRBlock(x.defaultSuccessor()), targets); 880 lir.tableswitch(tag, x.lowKey(), getLIRBlock(x.defaultSuccessor()), targets);
878 } 881 }
879 } 882 }
880 }
881
882 @Override
883 public void visitThrow(Throw x) {
884 setNoResult(x);
885 CiValue exceptionOpr = load(x.exception());
886 LIRDebugInfo info = stateFor(x, x.stateBefore());
887
888 // move exception oop into fixed register
889 CiCallingConvention callingConvention = compilation.frameMap().getCallingConvention(new CiKind[]{CiKind.Object}, RuntimeCall);
890 CiValue argumentOperand = callingConvention.locations[0];
891 lir.move(exceptionOpr, argumentOperand);
892
893 lir.throwException(CiValue.IllegalValue, argumentOperand, info);
894 } 883 }
895 884
896 @Override 885 @Override
897 public void visitDeoptimize(Deoptimize deoptimize) { 886 public void visitDeoptimize(Deoptimize deoptimize) {
898 DeoptimizationStub stub = new DeoptimizationStub(lastState); 887 DeoptimizationStub stub = new DeoptimizationStub(lastState);
1486 1475
1487 protected LIRDebugInfo stateFor(Value x, FrameState state) { 1476 protected LIRDebugInfo stateFor(Value x, FrameState state) {
1488 if (compilation.placeholderState != null) { 1477 if (compilation.placeholderState != null) {
1489 state = compilation.placeholderState; 1478 state = compilation.placeholderState;
1490 } 1479 }
1491 1480 return new LIRDebugInfo(state);
1492 assert state != null;
1493 LIRBlock exceptionEdge = null;
1494 if (x instanceof ExceptionEdgeInstruction) {
1495 Instruction begin = ((ExceptionEdgeInstruction) x).exceptionEdge();
1496 if (begin != null) {
1497 exceptionEdge = getLIRBlock(begin);
1498 }
1499 }
1500 return new LIRDebugInfo(state, exceptionEdge);
1501 } 1481 }
1502 1482
1503 List<CiValue> visitInvokeArguments(CiCallingConvention cc, Invoke x, List<CiValue> pointerSlots) { 1483 List<CiValue> visitInvokeArguments(CiCallingConvention cc, Invoke x, List<CiValue> pointerSlots) {
1504 // for each argument, load it into the correct location 1484 // for each argument, load it into the correct location
1505 List<CiValue> argList = new ArrayList<CiValue>(x.argumentCount()); 1485 List<CiValue> argList = new ArrayList<CiValue>(x.argumentCount());