use of org.graalvm.compiler.hotspot.replacements.CallSiteTargetNode in project graal by oracle.
the class HotSpotGraphBuilderPlugins method registerCallSitePlugins.
private static void registerCallSitePlugins(InvocationPlugins plugins) {
InvocationPlugin plugin = new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
ValueNode callSite = receiver.get();
ValueNode folded = CallSiteTargetNode.tryFold(GraphUtil.originalValue(callSite), b.getMetaAccess(), b.getAssumptions());
if (folded != null) {
b.addPush(JavaKind.Object, folded);
} else {
b.addPush(JavaKind.Object, new CallSiteTargetNode(b.getInvokeKind(), targetMethod, b.bci(), b.getInvokeReturnStamp(b.getAssumptions()), callSite));
}
return true;
}
@Override
public boolean inlineOnly() {
return true;
}
};
plugins.register(plugin, ConstantCallSite.class, "getTarget", Receiver.class);
plugins.register(plugin, MutableCallSite.class, "getTarget", Receiver.class);
plugins.register(plugin, VolatileCallSite.class, "getTarget", Receiver.class);
}
Aggregations