diff 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
line wrap: on
line diff
--- 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) {