Search in sources :

Example 1 with PluginReplacementWithExceptionNode

use of org.graalvm.compiler.nodes.PluginReplacementWithExceptionNode in project graal by oracle.

the class BytecodeParser method replacePluginWithException.

@Override
public void replacePluginWithException(GeneratedInvocationPlugin plugin, ResolvedJavaMethod targetMethod, ValueNode[] args, PluginReplacementWithExceptionNode.ReplacementWithExceptionFunction replacementFunction) {
    assert replacementFunction != null;
    JavaType returnType = maybeEagerlyResolve(targetMethod.getSignature().getReturnType(method.getDeclaringClass()), targetMethod.getDeclaringClass());
    StampPair returnStamp = getReplacements().getGraphBuilderPlugins().getOverridingStamp(this, returnType, false);
    if (returnStamp == null) {
        returnStamp = StampFactory.forDeclaredType(getAssumptions(), returnType, false);
    }
    WithExceptionNode node = new PluginReplacementWithExceptionNode(returnStamp.getTrustedStamp(), args, replacementFunction, plugin.getClass().getSimpleName());
    if (returnType.getJavaKind() == JavaKind.Void) {
        add(node);
    } else {
        addPush(returnType.getJavaKind(), node);
    }
}
Also used : ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) JavaType(jdk.vm.ci.meta.JavaType) StressInvokeWithExceptionNode(org.graalvm.compiler.core.common.GraalOptions.StressInvokeWithExceptionNode) PluginReplacementWithExceptionNode(org.graalvm.compiler.nodes.PluginReplacementWithExceptionNode) WithExceptionNode(org.graalvm.compiler.nodes.WithExceptionNode) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) PluginReplacementWithExceptionNode(org.graalvm.compiler.nodes.PluginReplacementWithExceptionNode) StampPair(org.graalvm.compiler.core.common.type.StampPair)

Aggregations

JavaType (jdk.vm.ci.meta.JavaType)1 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)1 StressInvokeWithExceptionNode (org.graalvm.compiler.core.common.GraalOptions.StressInvokeWithExceptionNode)1 StampPair (org.graalvm.compiler.core.common.type.StampPair)1 InvokeWithExceptionNode (org.graalvm.compiler.nodes.InvokeWithExceptionNode)1 PluginReplacementWithExceptionNode (org.graalvm.compiler.nodes.PluginReplacementWithExceptionNode)1 WithExceptionNode (org.graalvm.compiler.nodes.WithExceptionNode)1