Search in sources :

Example 1 with HotSpotIdentityHashCodeNode

use of org.graalvm.compiler.hotspot.replacements.HotSpotIdentityHashCodeNode in project graal by oracle.

the class HotSpotGraphBuilderPlugins method registerSystemPlugins.

private static void registerSystemPlugins(InvocationPlugins plugins) {
    Registration r = new Registration(plugins, System.class);
    r.register(new ForeignCallPlugin(HotSpotHostForeignCallsProvider.JAVA_TIME_MILLIS, "currentTimeMillis"));
    r.register(new ForeignCallPlugin(HotSpotHostForeignCallsProvider.JAVA_TIME_NANOS, "nanoTime"));
    r.register(new InlineOnlyInvocationPlugin("identityHashCode", Object.class) {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode object) {
            b.addPush(JavaKind.Int, new HotSpotIdentityHashCodeNode(object, b.bci()));
            return true;
        }
    });
    ArrayCopySnippets.registerSystemArraycopyPlugin(r);
}
Also used : ForeignCallPlugin(org.graalvm.compiler.nodes.graphbuilderconf.ForeignCallPlugin) GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) InlineOnlyInvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.InlineOnlyInvocationPlugin) ValueNode(org.graalvm.compiler.nodes.ValueNode) Receiver(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver) HotSpotIdentityHashCodeNode(org.graalvm.compiler.hotspot.replacements.HotSpotIdentityHashCodeNode) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Example 2 with HotSpotIdentityHashCodeNode

use of org.graalvm.compiler.hotspot.replacements.HotSpotIdentityHashCodeNode in project graal by oracle.

the class HotSpotGraphBuilderPlugins method registerObjectPlugins.

private static void registerObjectPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, Replacements replacements) {
    Registration r = new Registration(plugins, Object.class, replacements);
    r.register(new InlineOnlyInvocationPlugin("clone", Receiver.class) {

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

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
            ValueNode object = receiver.get();
            b.addPush(JavaKind.Int, new HotSpotIdentityHashCodeNode(object, b.bci()));
            return true;
        }
    });
    if (config.inlineNotify()) {
        r.register(new InlineOnlyInvocationPlugin("notify", Receiver.class) {

            @Override
            public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
                ValueNode object = receiver.get();
                b.add(new FastNotifyNode(object, false, b.bci()));
                return true;
            }
        });
    }
    if (config.inlineNotifyAll()) {
        r.register(new InlineOnlyInvocationPlugin("notifyAll", Receiver.class) {

            @Override
            public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
                ValueNode object = receiver.get();
                b.add(new FastNotifyNode(object, true, b.bci()));
                return true;
            }
        });
    }
}
Also used : ObjectCloneNode(org.graalvm.compiler.hotspot.replacements.ObjectCloneNode) GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) InlineOnlyInvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.InlineOnlyInvocationPlugin) ValueNode(org.graalvm.compiler.nodes.ValueNode) Receiver(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver) HotSpotIdentityHashCodeNode(org.graalvm.compiler.hotspot.replacements.HotSpotIdentityHashCodeNode) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) FastNotifyNode(org.graalvm.compiler.hotspot.replacements.FastNotifyNode)

Aggregations

ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)2 HotSpotIdentityHashCodeNode (org.graalvm.compiler.hotspot.replacements.HotSpotIdentityHashCodeNode)2 ValueNode (org.graalvm.compiler.nodes.ValueNode)2 GraphBuilderContext (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext)2 InlineOnlyInvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.InlineOnlyInvocationPlugin)2 Receiver (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver)2 Registration (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration)2 FastNotifyNode (org.graalvm.compiler.hotspot.replacements.FastNotifyNode)1 ObjectCloneNode (org.graalvm.compiler.hotspot.replacements.ObjectCloneNode)1 ForeignCallPlugin (org.graalvm.compiler.nodes.graphbuilderconf.ForeignCallPlugin)1