package org.graalvm.compiler.hotspot.replacements;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import java.lang.annotation.Annotation;
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
import org.graalvm.compiler.nodes.graphbuilderconf.GeneratedInvocationPlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;
import org.graalvm.compiler.nodes.graphbuilderconf.NodeIntrinsicPluginFactory;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import org.graalvm.compiler.nodes.ConstantNode;
public class PluginFactory_StringToBytesSnippets implements NodeIntrinsicPluginFactory {
private static final class StringToBytesSnippets_arrayBaseOffset extends GeneratedInvocationPlugin {
@Override
public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] args) {
long result = org.graalvm.compiler.hotspot.replacements.StringToBytesSnippets.arrayBaseOffset();
JavaConstant constant = JavaConstant.forLong(result);
ConstantNode node = ConstantNode.forConstant(constant, b.getMetaAccess(), b.getGraph());
b.push(JavaKind.Long, node);
b.notifyReplacedCall(targetMethod, node);
return true;
}
@Override
public Class<? extends Annotation> getSource() {
return org.graalvm.compiler.api.replacements.Fold.class;
}
}
@Override
public void registerPlugins(InvocationPlugins plugins, InjectionProvider injection) {
plugins.register(new StringToBytesSnippets_arrayBaseOffset(), org.graalvm.compiler.hotspot.replacements.StringToBytesSnippets.class, "arrayBaseOffset");
}
}