changeset 19750:2a21ea0ec141

Profile exceptions on OptimizeCallTarget#doInvoke.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 10 Mar 2015 12:48:03 +0100
parents 095ddb9421d0
children 84144a672012
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Tue Mar 10 11:33:30 2015 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Tue Mar 10 12:48:03 2015 +0100
@@ -56,6 +56,7 @@
     protected final CompilationPolicy compilationPolicy;
     private final OptimizedCallTarget sourceCallTarget;
     private final AtomicInteger callSitesKnown = new AtomicInteger(0);
+    private final ValueProfile exceptionProfile = ValueProfile.createClassProfile();
 
     @CompilationFinal private Class<?>[] profiledArgumentTypes;
     @CompilationFinal private Assumption profiledArgumentTypesAssumption;
@@ -232,7 +233,16 @@
     }
 
     protected Object doInvoke(Object[] args) {
-        return callBoundary(args);
+        try {
+            return callBoundary(args);
+        } catch (Throwable t) {
+            t = exceptionProfile.profile(t);
+            if (t instanceof RuntimeException) {
+                throw (RuntimeException) t;
+            } else {
+                throw new RuntimeException(t);
+            }
+        }
     }
 
     @TruffleCallBoundary