# HG changeset patch # User Thomas Wuerthinger # Date 1305124822 -7200 # Node ID 9f557e9401803a746c0f494efc6397a8939690d0 # Parent 40248577d587171d5841c188d8bfcf0c8859700e Removed exception optimization that immediately unwinds if it is guaranteed that there is no local exception handler. Reason to remove the optimization: In case of a local exception handler that has been really executed, we need a type check on the exception object and a conditional jump from the throw anyway. diff -r 40248577d587 -r 9f557e940180 graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java --- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Wed May 11 16:25:15 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Wed May 11 16:40:22 2011 +0200 @@ -902,36 +902,12 @@ CiValue exceptionOpr = load(x.exception()); LIRDebugInfo info = stateFor(x, x.stateBefore()); - // check if the instruction has an xhandler in any of the nested scopes - boolean unwind = false; - if (x.exceptionHandlers().size() == 0) { - // this throw is not inside an xhandler - unwind = true; - } else { - // get some idea of the throw type - boolean typeIsExact = true; - RiType throwType = x.exception().exactType(); - if (throwType == null) { - typeIsExact = false; - throwType = x.exception().declaredType(); - } - if (throwType != null && throwType.isResolved() && throwType.isInstanceClass()) { - unwind = !ExceptionHandler.couldCatch(x.exceptionHandlers(), throwType, typeIsExact); - } - } - - assert !currentBlock.checkBlockFlag(BlockBegin.BlockFlag.DefaultExceptionHandler) || unwind : "should be no more handlers to dispatch to"; - // move exception oop into fixed register CiCallingConvention callingConvention = compilation.frameMap().getCallingConvention(new CiKind[]{CiKind.Object}, RuntimeCall); CiValue argumentOperand = callingConvention.locations[0]; lir.move(exceptionOpr, argumentOperand); - if (unwind) { - lir.unwindException(CiValue.IllegalValue, exceptionOpr, info); - } else { - lir.throwException(CiValue.IllegalValue, argumentOperand, info); - } + lir.throwException(CiValue.IllegalValue, argumentOperand, info); } private void blockDoEpilog(BlockBegin block) { diff -r 40248577d587 -r 9f557e940180 graal/GraalCompiler/src/com/sun/c1x/lir/LIRAssembler.java --- a/graal/GraalCompiler/src/com/sun/c1x/lir/LIRAssembler.java Wed May 11 16:25:15 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/lir/LIRAssembler.java Wed May 11 16:40:22 2011 +0200 @@ -367,8 +367,7 @@ break; case Throw: - case Unwind: - emitThrow(op.operand1(), op.operand2(), op.info, op.code == LIROpcode.Unwind); + emitThrow(op.operand1(), op.operand2(), op.info); break; default: @@ -465,7 +464,7 @@ protected abstract void emitVolatileMove(CiValue inOpr, CiValue result, CiKind kind, LIRDebugInfo info); - protected abstract void emitThrow(CiValue inOpr1, CiValue inOpr2, LIRDebugInfo info, boolean unwind); + protected abstract void emitThrow(CiValue inOpr1, CiValue inOpr2, LIRDebugInfo info); protected abstract void emitLogicOp(LIROpcode code, CiValue inOpr1, CiValue inOpr2, CiValue dst); diff -r 40248577d587 -r 9f557e940180 graal/GraalCompiler/src/com/sun/c1x/lir/LIRList.java --- a/graal/GraalCompiler/src/com/sun/c1x/lir/LIRList.java Wed May 11 16:25:15 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/lir/LIRList.java Wed May 11 16:40:22 2011 +0200 @@ -193,10 +193,6 @@ append(new LIROp2(LIROpcode.Throw, exceptionPC, exceptionOop, CiValue.IllegalValue, info, CiKind.Illegal, true)); } - public void unwindException(CiValue exceptionPC, CiValue exceptionOop, LIRDebugInfo info) { - append(new LIROp2(LIROpcode.Unwind, exceptionPC, exceptionOop, CiValue.IllegalValue, info)); - } - public void compareTo(CiValue left, CiValue right, CiValue dst) { append(new LIROp2(LIROpcode.CompareTo, left, right, dst)); } diff -r 40248577d587 -r 9f557e940180 graal/GraalCompiler/src/com/sun/c1x/lir/LIROpcode.java --- a/graal/GraalCompiler/src/com/sun/c1x/lir/LIROpcode.java Wed May 11 16:25:15 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/lir/LIROpcode.java Wed May 11 16:40:22 2011 +0200 @@ -83,7 +83,6 @@ Shr, Ushr, Throw, - Unwind, CompareTo, EndOp2, BeginOp3, diff -r 40248577d587 -r 9f557e940180 graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRAssembler.java --- a/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRAssembler.java Wed May 11 16:25:15 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRAssembler.java Wed May 11 16:40:22 2011 +0200 @@ -1392,13 +1392,13 @@ } @Override - protected void emitThrow(CiValue exceptionPC, CiValue exceptionOop, LIRDebugInfo info, boolean unwind) { + protected void emitThrow(CiValue exceptionPC, CiValue exceptionOop, LIRDebugInfo info) { // exception object is not added to oop map by LinearScan // (LinearScan assumes that no oops are in fixed registers) // info.addRegisterOop(exceptionOop); - masm.directCall(unwind ? CiRuntimeCall.UnwindException : CiRuntimeCall.HandleException, info); + masm.directCall(CiRuntimeCall.HandleException, info); // enough room for two byte trap - masm.nop(); + masm.shouldNotReachHere(); } private void emitXIRShiftOp(LIROpcode code, CiValue left, CiValue count, CiValue dest) {