Search in sources :

Example 1 with ObjectCloneNode

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

the class HotSpotGraphBuilderPlugins method registerObjectPlugins.

private static void registerObjectPlugins(InvocationPlugins plugins, OptionValues options, BytecodeProvider bytecodeProvider) {
    Registration r = new Registration(plugins, Object.class, bytecodeProvider);
    if (!GeneratePIC.getValue(options)) {
        // FIXME: clone() requires speculation and requires a fix in here (to check that
        // b.getAssumptions() != null), and in ReplacementImpl.getSubstitution() where there is
        // an instantiation of IntrinsicGraphBuilder using a constructor that sets
        // AllowAssumptions to YES automatically. The former has to inherit the assumptions
        // settings from the root compile instead. So, for now, I'm disabling it for
        // GeneratePIC.
        r.register1("clone", Receiver.class, new InvocationPlugin() {

            @Override
            public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
                ValueNode object = receiver.get();
                b.addPush(JavaKind.Object, new ObjectCloneNode(b.getInvokeKind(), targetMethod, b.bci(), b.getInvokeReturnStamp(b.getAssumptions()), object));
                return true;
            }

            @Override
            public boolean inlineOnly() {
                return true;
            }
        });
    }
    r.registerMethodSubstitution(ObjectSubstitutions.class, "hashCode", Receiver.class);
}
Also used : ObjectCloneNode(org.graalvm.compiler.hotspot.replacements.ObjectCloneNode) 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) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 ObjectCloneNode (org.graalvm.compiler.hotspot.replacements.ObjectCloneNode)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