Search in sources :

Example 1 with HotSpotStoreReservedReferenceNode

use of org.graalvm.compiler.hotspot.nodes.HotSpotStoreReservedReferenceNode in project graal by oracle.

the class HotSpotGraphBuilderPlugins method registerTrufflePlugins.

private static void registerTrufflePlugins(InvocationPlugins plugins, WordTypes wordTypes, GraalHotSpotVMConfig config) {
    if (config.jvmciReservedReference0Offset == -1) {
        // cannot install intrinsics without
        return;
    }
    Registration tl = new Registration(plugins, "org.graalvm.compiler.truffle.runtime.hotspot.HotSpotFastThreadLocal");
    tl.register(new InvocationPlugin("get", Receiver.class) {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
            int jvmciReservedReference0Offset = config.jvmciReservedReference0Offset;
            GraalError.guarantee(jvmciReservedReference0Offset != -1, "jvmciReservedReference0Offset is not available but used.");
            b.addPush(JavaKind.Object, new HotSpotLoadReservedReferenceNode(b.getMetaAccess(), wordTypes, jvmciReservedReference0Offset));
            return true;
        }
    });
    tl.register(new InvocationPlugin("set", Receiver.class, Object[].class) {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
            int jvmciReservedReference0Offset = config.jvmciReservedReference0Offset;
            GraalError.guarantee(jvmciReservedReference0Offset != -1, "jvmciReservedReference0Offset is not available but used.");
            b.add(new HotSpotStoreReservedReferenceNode(wordTypes, value, jvmciReservedReference0Offset));
            return true;
        }
    });
}
Also used : HotSpotLoadReservedReferenceNode(org.graalvm.compiler.hotspot.nodes.HotSpotLoadReservedReferenceNode) 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) SnippetSubstitutionInvocationPlugin(org.graalvm.compiler.replacements.SnippetSubstitutionInvocationPlugin) InlineOnlyInvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.InlineOnlyInvocationPlugin) Receiver(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) HotSpotStoreReservedReferenceNode(org.graalvm.compiler.hotspot.nodes.HotSpotStoreReservedReferenceNode)

Example 2 with HotSpotStoreReservedReferenceNode

use of org.graalvm.compiler.hotspot.nodes.HotSpotStoreReservedReferenceNode in project graal by oracle.

the class HotSpotTruffleGraphBuilderPlugins method registerHotspotThreadLocalStubPlugins.

/**
 * These HotSpot thread local plugins are intended for the interpreter access stubs.
 */
static void registerHotspotThreadLocalStubPlugins(InvocationPlugins plugins, WordTypes wordTypes, int jvmciReservedReference0Offset) {
    GraalError.guarantee(jvmciReservedReference0Offset != -1, "jvmciReservedReference0Offset is not available but used.");
    InvocationPlugins.Registration tl = new InvocationPlugins.Registration(plugins, "org.graalvm.compiler.truffle.runtime.hotspot.HotSpotFastThreadLocal");
    tl.register(new RequiredInvocationPlugin("getJVMCIReservedReference") {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
            b.addPush(JavaKind.Object, new HotSpotLoadReservedReferenceNode(b.getMetaAccess(), wordTypes, jvmciReservedReference0Offset));
            return true;
        }
    });
    tl.register(new RequiredInvocationPlugin("setJVMCIReservedReference", Object[].class) {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
            b.add(new HotSpotStoreReservedReferenceNode(wordTypes, value, jvmciReservedReference0Offset));
            return true;
        }
    });
}
Also used : HotSpotLoadReservedReferenceNode(org.graalvm.compiler.hotspot.nodes.HotSpotLoadReservedReferenceNode) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) RequiredInvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.RequiredInvocationPlugin) ValueNode(org.graalvm.compiler.nodes.ValueNode) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) HotSpotStoreReservedReferenceNode(org.graalvm.compiler.hotspot.nodes.HotSpotStoreReservedReferenceNode)

Aggregations

ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)2 HotSpotLoadReservedReferenceNode (org.graalvm.compiler.hotspot.nodes.HotSpotLoadReservedReferenceNode)2 HotSpotStoreReservedReferenceNode (org.graalvm.compiler.hotspot.nodes.HotSpotStoreReservedReferenceNode)2 ValueNode (org.graalvm.compiler.nodes.ValueNode)2 GraphBuilderContext (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext)2 InvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin)1 InlineOnlyInvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.InlineOnlyInvocationPlugin)1 Receiver (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver)1 RequiredInvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.RequiredInvocationPlugin)1 InvocationPlugins (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins)1 Registration (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration)1 SnippetSubstitutionInvocationPlugin (org.graalvm.compiler.replacements.SnippetSubstitutionInvocationPlugin)1