comparison graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java @ 2660:9f557e940180

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.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 11 May 2011 16:40:22 +0200
parents 63633fb05914
children 194d93d089bd
comparison
equal deleted inserted replaced
2659:40248577d587 2660:9f557e940180
900 public void visitThrow(Throw x) { 900 public void visitThrow(Throw x) {
901 setNoResult(x); 901 setNoResult(x);
902 CiValue exceptionOpr = load(x.exception()); 902 CiValue exceptionOpr = load(x.exception());
903 LIRDebugInfo info = stateFor(x, x.stateBefore()); 903 LIRDebugInfo info = stateFor(x, x.stateBefore());
904 904
905 // check if the instruction has an xhandler in any of the nested scopes
906 boolean unwind = false;
907 if (x.exceptionHandlers().size() == 0) {
908 // this throw is not inside an xhandler
909 unwind = true;
910 } else {
911 // get some idea of the throw type
912 boolean typeIsExact = true;
913 RiType throwType = x.exception().exactType();
914 if (throwType == null) {
915 typeIsExact = false;
916 throwType = x.exception().declaredType();
917 }
918 if (throwType != null && throwType.isResolved() && throwType.isInstanceClass()) {
919 unwind = !ExceptionHandler.couldCatch(x.exceptionHandlers(), throwType, typeIsExact);
920 }
921 }
922
923 assert !currentBlock.checkBlockFlag(BlockBegin.BlockFlag.DefaultExceptionHandler) || unwind : "should be no more handlers to dispatch to";
924
925 // move exception oop into fixed register 905 // move exception oop into fixed register
926 CiCallingConvention callingConvention = compilation.frameMap().getCallingConvention(new CiKind[]{CiKind.Object}, RuntimeCall); 906 CiCallingConvention callingConvention = compilation.frameMap().getCallingConvention(new CiKind[]{CiKind.Object}, RuntimeCall);
927 CiValue argumentOperand = callingConvention.locations[0]; 907 CiValue argumentOperand = callingConvention.locations[0];
928 lir.move(exceptionOpr, argumentOperand); 908 lir.move(exceptionOpr, argumentOperand);
929 909
930 if (unwind) { 910 lir.throwException(CiValue.IllegalValue, argumentOperand, info);
931 lir.unwindException(CiValue.IllegalValue, exceptionOpr, info);
932 } else {
933 lir.throwException(CiValue.IllegalValue, argumentOperand, info);
934 }
935 } 911 }
936 912
937 private void blockDoEpilog(BlockBegin block) { 913 private void blockDoEpilog(BlockBegin block) {
938 if (C1XOptions.PrintIRWithLIR) { 914 if (C1XOptions.PrintIRWithLIR) {
939 TTY.println(); 915 TTY.println();