Search in sources :

Example 1 with SubstrateDynamicNewArrayNode

use of com.oracle.svm.core.graal.nodes.SubstrateDynamicNewArrayNode in project graal by oracle.

the class SubstrateGraphBuilderPlugins method registerArrayPlugins.

private static void registerArrayPlugins(InvocationPlugins plugins) {
    Registration r = new Registration(plugins, Array.class).setAllowOverwrite(true);
    r.register2("newInstance", Class.class, int.class, new InvocationPlugin() {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode clazz, ValueNode length) {
            b.addPush(JavaKind.Object, new SubstrateDynamicNewArrayNode(clazz, length));
            return true;
        }
    });
    /*
         * We have our own Java-level implementation of Array.getLength(), so we just disable the
         * plugin defined in StandardGraphBuilderPlugins.
         */
    r.register1("getLength", Object.class, new InvocationPlugin() {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver type, ValueNode array) {
            return false;
        }
    });
}
Also used : Array(java.lang.reflect.Array) SubstrateDynamicNewArrayNode(com.oracle.svm.core.graal.nodes.SubstrateDynamicNewArrayNode) GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) StackValueNode(com.oracle.svm.core.graal.stackvalue.StackValueNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) ConvertUnknownValueNode(com.oracle.graal.pointsto.nodes.ConvertUnknownValueNode) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) Receiver(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

ConvertUnknownValueNode (com.oracle.graal.pointsto.nodes.ConvertUnknownValueNode)1 SubstrateDynamicNewArrayNode (com.oracle.svm.core.graal.nodes.SubstrateDynamicNewArrayNode)1 StackValueNode (com.oracle.svm.core.graal.stackvalue.StackValueNode)1 Array (java.lang.reflect.Array)1 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)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