# HG changeset patch # User Andreas Woess # Date 1428615618 -7200 # Node ID e0b3dc6b025cc1f7a5b6f0b345682634c4b88d0e # Parent f5c3284db6f2510418dae03a72c8711dea43bba7 Truffle: profile exception type only for direct calls diff -r f5c3284db6f2 -r e0b3dc6b025c graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java --- 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