@SuppressWarnings("deprecation") @Override public InlineKind getInlineKind(ResolvedJavaMethod original, boolean duringPartialEvaluation) { TruffleBoundary truffleBoundary = getAnnotation(TruffleBoundary.class, original); if (truffleBoundary != null) { if (duringPartialEvaluation || !truffleBoundary.allowInlining()) { // Since this method is invoked by the bytecode parser plugins, which can be invoked // by the partial evaluator, we want to prevent inlining across the boundary during // partial evaluation, // even if the TruffleBoundary allows inlining after partial evaluation. if (!truffleBoundary.throwsControlFlowException() && truffleBoundary.transferToInterpreterOnException()) { return InlineKind.DO_NOT_INLINE_DEOPTIMIZE_ON_EXCEPTION; } else { return InlineKind.DO_NOT_INLINE_WITH_EXCEPTION; } } } else if (getAnnotation(TruffleCallBoundary.class, original) != null) { return InlineKind.DO_NOT_INLINE_WITH_EXCEPTION; } return InlineKind.INLINE; }
@Override @SuppressWarnings("deprecation") protected void run(StructuredGraph graph) { for (Node n : graph.getNodes()) { if (n instanceof InvokeWithExceptionNode) { InvokeWithExceptionNode invoke = (InvokeWithExceptionNode) n; ExceptionObjectNode exceptionObject = (ExceptionObjectNode) invoke.exceptionEdge(); FixedNode originalNext = exceptionObject.next(); if (!(originalNext instanceof DeoptimizeNode) && invoke.callTarget().targetMethod() != null) { TruffleBoundary truffleBoundary = invoke.callTarget().targetMethod().getAnnotation(TruffleBoundary.class); if (truffleBoundary != null) { if (!truffleBoundary.throwsControlFlowException() && truffleBoundary.transferToInterpreterOnException()) { addDeoptimizeNode(graph, originalNext); } } } } } }
@SuppressWarnings("deprecation") private boolean deoptimizeOnException(ResolvedJavaMethod method) { if (method == null) { return false; } CompilerDirectives.TruffleBoundary truffleBoundary = method.getAnnotation(CompilerDirectives.TruffleBoundary.class); return truffleBoundary != null && (!truffleBoundary.throwsControlFlowException() && truffleBoundary.transferToInterpreterOnException()); }