changeset 20882:e0b3dc6b025c

Truffle: profile exception type only for direct calls
author Andreas Woess <andreas.woess@oracle.com>
date Thu, 09 Apr 2015 23:40:18 +0200
parents f5c3284db6f2
children 7f4339cca304
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java
diffstat 1 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Fri Apr 10 00:36:47 2015 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Thu Apr 09 23:40:18 2015 +0200
@@ -163,12 +163,23 @@
     public final Object callDirect(Object... args) {
         compilationProfile.reportDirectCall();
         profileArguments(args);
-        Object result = doInvoke(args);
-        Class<?> klass = profiledReturnType;
-        if (klass != null && CompilerDirectives.inCompiledCode() && profiledReturnTypeAssumption.isValid()) {
-            result = FrameWithoutBoxing.unsafeCast(result, klass, true, true);
+        try {
+            Object result = doInvoke(args);
+            Class<?> klass = profiledReturnType;
+            if (klass != null && CompilerDirectives.inCompiledCode() && profiledReturnTypeAssumption.isValid()) {
+                result = FrameWithoutBoxing.unsafeCast(result, klass, true, true);
+            }
+            return result;
+        } catch (Throwable t) {
+            t = exceptionProfile.profile(t);
+            if (t instanceof RuntimeException) {
+                throw (RuntimeException) t;
+            } else if (t instanceof Error) {
+                throw (Error) t;
+            } else {
+                throw new RuntimeException(t);
+            }
         }
-        return result;
     }
 
     public final Object callInlined(Object... arguments) {
@@ -238,18 +249,7 @@
     }
 
     protected Object doInvoke(Object[] args) {
-        try {
-            return callBoundary(args);
-        } catch (Throwable t) {
-            t = exceptionProfile.profile(t);
-            if (t instanceof RuntimeException) {
-                throw (RuntimeException) t;
-            } else if (t instanceof Error) {
-                throw (Error) t;
-            } else {
-                throw new RuntimeException(t);
-            }
-        }
+        return callBoundary(args);
     }
 
     @TruffleCallBoundary