use of org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration in project graal by oracle.
the class StandardGraphBuilderPlugins method registerIntegerLongPlugins.
private static void registerIntegerLongPlugins(InvocationPlugins plugins, JavaKind kind) {
Class<?> declaringClass = kind.toBoxedJavaClass();
Class<?> type = kind.toJavaClass();
Registration r = new Registration(plugins, declaringClass);
r.register1("reverseBytes", type, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
b.push(kind, b.append(new ReverseBytesNode(value).canonical(null)));
return true;
}
});
r.register2("divideUnsigned", type, type, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode dividend, ValueNode divisor) {
b.push(kind, b.append(UnsignedDivNode.create(dividend, divisor, NodeView.DEFAULT)));
return true;
}
});
r.register2("remainderUnsigned", type, type, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode dividend, ValueNode divisor) {
b.push(kind, b.append(UnsignedRemNode.create(dividend, divisor, NodeView.DEFAULT)));
return true;
}
});
}
use of org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration in project graal by oracle.
the class PointstoGraphBuilderPlugins method registerObjectPlugins.
public static void registerObjectPlugins(InvocationPlugins plugins) {
Registration r = new Registration(plugins, Object.class);
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 AnalysisObjectCloneNode(b.getInvokeKind(), targetMethod, b.bci(), b.getInvokeReturnStamp(b.getAssumptions()), object));
return true;
}
});
}
use of org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration in project graal by oracle.
the class CGlobalDataFeature method registerInvocationPlugins.
@Override
public void registerInvocationPlugins(Providers providers, SnippetReflectionProvider snippetReflection, InvocationPlugins invocationPlugins, boolean hosted) {
Registration r = new Registration(invocationPlugins, CGlobalData.class);
r.register1("get", Receiver.class, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
VMError.guarantee(receiver.get().isConstant(), "Accessed CGlobalData is not a compile-time constant: " + b.getMethod().asStackTraceElement(b.bci()));
CGlobalDataImpl<?> data = (CGlobalDataImpl<?>) SubstrateObjectConstant.asObject(receiver.get().asConstant());
CGlobalDataInfo info = CGlobalDataFeature.this.map.get(data);
b.addPush(targetMethod.getSignature().getReturnKind(), new CGlobalDataLoadAddressNode(info));
return true;
}
});
}
use of org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration in project graal by oracle.
the class ReplacementsParseTest method registerInvocationPlugins.
@Override
protected void registerInvocationPlugins(InvocationPlugins invocationPlugins) {
BytecodeProvider replacementBytecodeProvider = getSystemClassLoaderBytecodeProvider();
Registration r = new Registration(invocationPlugins, TestObject.class, replacementBytecodeProvider);
NodeIntrinsicPluginFactory.InjectionProvider injections = new DummyInjectionProvider();
new PluginFactory_ReplacementsParseTest().registerPlugins(invocationPlugins, injections);
r.registerMethodSubstitution(TestObjectSubstitutions.class, "nextAfter", double.class, double.class);
r.registerMethodSubstitution(TestObjectSubstitutions.class, "stringize", Object.class);
r.registerMethodSubstitution(TestObjectSubstitutions.class, "stringizeId", Receiver.class);
r.registerMethodSubstitution(TestObjectSubstitutions.class, "copyFirst", byte[].class, byte[].class, boolean.class);
r.registerMethodSubstitution(TestObjectSubstitutions.class, "copyFirstL2R", byte[].class, byte[].class);
r.registerMethodSubstitution(TestObjectSubstitutions.class, "nonVoidIntrinsicWithCall", int.class, int.class);
r.registerMethodSubstitution(TestObjectSubstitutions.class, "nonVoidIntrinsicWithOptimizedSplit", int.class);
if (replacementBytecodeProvider.supportsInvokedynamic()) {
r.registerMethodSubstitution(TestObjectSubstitutions.class, "identity", String.class);
}
super.registerInvocationPlugins(invocationPlugins);
}
use of org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration in project graal by oracle.
the class SubstitutionsTest method registerInvocationPlugins.
@Override
protected void registerInvocationPlugins(InvocationPlugins invocationPlugins) {
new PluginFactory_SubstitutionsTest().registerPlugins(invocationPlugins, null);
ClassfileBytecodeProvider bytecodeProvider = getSystemClassLoaderBytecodeProvider();
Registration r = new Registration(invocationPlugins, TestMethod.class, bytecodeProvider);
r.registerMethodSubstitution(TestMethodSubstitution.class, "test");
super.registerInvocationPlugins(invocationPlugins);
}
Aggregations