Search in sources :

Example 1 with SubstrateIdentityHashCodeNode

use of com.oracle.svm.core.identityhashcode.SubstrateIdentityHashCodeNode in project graal by oracle.

the class SubstrateGraphBuilderPlugins method registerSystemPlugins.

private static void registerSystemPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) {
    Registration r = new Registration(plugins, System.class);
    if (SubstrateOptions.FoldSecurityManagerGetter.getValue()) {
        r.register(new RequiredInvocationPlugin("getSecurityManager") {

            @Override
            public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
                /* System.getSecurityManager() always returns null. */
                b.addPush(JavaKind.Object, ConstantNode.forConstant(SubstrateObjectConstant.forObject(null), metaAccess, b.getGraph()));
                return true;
            }
        });
    }
    r.register(new RequiredInvocationPlugin("identityHashCode", Object.class) {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode object) {
            b.addPush(JavaKind.Int, new SubstrateIdentityHashCodeNode(object, b.bci()));
            return true;
        }
    });
}
Also used : GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) RequiredInvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.RequiredInvocationPlugin) StackValueNode(com.oracle.svm.core.graal.stackvalue.StackValueNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) Receiver(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) SubstrateIdentityHashCodeNode(com.oracle.svm.core.identityhashcode.SubstrateIdentityHashCodeNode)

Example 2 with SubstrateIdentityHashCodeNode

use of com.oracle.svm.core.identityhashcode.SubstrateIdentityHashCodeNode in project graal by oracle.

the class SubstrateGraphBuilderPlugins method registerObjectPlugins.

private static void registerObjectPlugins(InvocationPlugins plugins) {
    Registration r = new Registration(plugins, Object.class);
    r.register(new RequiredInvocationPlugin("clone", Receiver.class) {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
            ValueNode object = receiver.get();
            b.addPush(JavaKind.Object, new SubstrateObjectCloneWithExceptionNode(MacroParams.of(b, targetMethod, object)));
            return true;
        }
    });
    r.register(new RequiredInvocationPlugin("hashCode", Receiver.class) {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
            ValueNode object = receiver.get();
            b.addPush(JavaKind.Int, new SubstrateIdentityHashCodeNode(object, b.bci()));
            return true;
        }
    });
}
Also used : SubstrateObjectCloneWithExceptionNode(com.oracle.svm.core.graal.jdk.SubstrateObjectCloneWithExceptionNode) GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) RequiredInvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.RequiredInvocationPlugin) StackValueNode(com.oracle.svm.core.graal.stackvalue.StackValueNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) Receiver(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) SubstrateIdentityHashCodeNode(com.oracle.svm.core.identityhashcode.SubstrateIdentityHashCodeNode)

Aggregations

StackValueNode (com.oracle.svm.core.graal.stackvalue.StackValueNode)2 SubstrateIdentityHashCodeNode (com.oracle.svm.core.identityhashcode.SubstrateIdentityHashCodeNode)2 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)2 ValueNode (org.graalvm.compiler.nodes.ValueNode)2 GraphBuilderContext (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext)2 Receiver (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver)2 RequiredInvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.RequiredInvocationPlugin)2 Registration (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration)2 SubstrateObjectCloneWithExceptionNode (com.oracle.svm.core.graal.jdk.SubstrateObjectCloneWithExceptionNode)1