Search in sources :

Example 1 with SubstrateDynamicNewInstanceNode

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

the class SubstrateGraphBuilderPlugins method registerUnsafePlugins.

private static void registerUnsafePlugins(InvocationPlugins plugins) {
    Registration r = new Registration(plugins, Unsafe.class).setAllowOverwrite(true);
    r.register2("allocateInstance", Receiver.class, Class.class, new InvocationPlugin() {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode clazz) {
            ValueNode clazzNonNull = b.nullCheckedValue(clazz, DeoptimizationAction.None);
            b.addPush(JavaKind.Object, new SubstrateDynamicNewInstanceNode(clazzNonNull));
            return true;
        }
    });
}
Also used : 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) Unsafe(sun.misc.Unsafe) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) Receiver(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver) SubstrateDynamicNewInstanceNode(com.oracle.svm.core.graal.nodes.SubstrateDynamicNewInstanceNode) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

ConvertUnknownValueNode (com.oracle.graal.pointsto.nodes.ConvertUnknownValueNode)1 SubstrateDynamicNewInstanceNode (com.oracle.svm.core.graal.nodes.SubstrateDynamicNewInstanceNode)1 StackValueNode (com.oracle.svm.core.graal.stackvalue.StackValueNode)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 Unsafe (sun.misc.Unsafe)1