Search in sources :

Example 1 with PiArrayNode

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

the class TruffleGraphBuilderPlugins method registerOptimizedCallTargetPlugins.

public static void registerOptimizedCallTargetPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess, boolean canDelayIntrinsification, KnownTruffleTypes types) {
    final ResolvedJavaType optimizedCallTargetType = getRuntime().resolveType(metaAccess, "org.graalvm.compiler.truffle.runtime.OptimizedCallTarget");
    Registration r = new Registration(plugins, new ResolvedJavaSymbol(optimizedCallTargetType));
    r.register2("createFrame", new ResolvedJavaSymbol(types.classFrameDescriptor), Object[].class, new InvocationPlugin() {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode descriptor, ValueNode args) {
            if (canDelayIntrinsification) {
                return false;
            }
            if (!descriptor.isJavaConstant()) {
                throw b.bailout("Parameter 'descriptor' is not a compile-time constant");
            }
            ValueNode nonNullArguments = b.add(PiNode.create(args, StampFactory.objectNonNull(StampTool.typeReferenceOrNull(args))));
            b.addPush(JavaKind.Object, new NewFrameNode(b, descriptor, nonNullArguments, types));
            return true;
        }
    });
    r.register2("castArrayFixedLength", Object[].class, int.class, new InvocationPlugin() {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode args, ValueNode length) {
            b.addPush(JavaKind.Object, new PiArrayNode(args, length, args.stamp(NodeView.DEFAULT)));
            return true;
        }
    });
    registerUnsafeCast(r, canDelayIntrinsification);
}
Also used : NewFrameNode(org.graalvm.compiler.truffle.compiler.nodes.frame.NewFrameNode) GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) ValueNode(org.graalvm.compiler.nodes.ValueNode) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) Receiver(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver) PiArrayNode(org.graalvm.compiler.nodes.PiArrayNode) ResolvedJavaSymbol(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.ResolvedJavaSymbol) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)1 PiArrayNode (org.graalvm.compiler.nodes.PiArrayNode)1 ValueNode (org.graalvm.compiler.nodes.ValueNode)1 GraphBuilderContext (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext)1 InvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin)1 Receiver (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver)1 Registration (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration)1 ResolvedJavaSymbol (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.ResolvedJavaSymbol)1 NewFrameNode (org.graalvm.compiler.truffle.compiler.nodes.frame.NewFrameNode)1