use of org.graalvm.compiler.nodes.graphbuilderconf.ForeignCallPlugin in project graal by oracle.
the class HotSpotGraphBuilderPlugins method registerSystemPlugins.
private static void registerSystemPlugins(InvocationPlugins plugins, ForeignCallsProvider foreignCalls) {
Registration r = new Registration(plugins, System.class);
r.register0("currentTimeMillis", new ForeignCallPlugin(foreignCalls, HotSpotHostForeignCallsProvider.JAVA_TIME_MILLIS));
r.register0("nanoTime", new ForeignCallPlugin(foreignCalls, HotSpotHostForeignCallsProvider.JAVA_TIME_NANOS));
r.register1("identityHashCode", Object.class, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode object) {
b.addPush(JavaKind.Int, new IdentityHashCodeNode(object));
return true;
}
@Override
public boolean inlineOnly() {
return true;
}
});
r.register5("arraycopy", Object.class, int.class, Object.class, int.class, int.class, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode src, ValueNode srcPos, ValueNode dst, ValueNode dstPos, ValueNode length) {
b.add(new ArrayCopyNode(b.bci(), src, srcPos, dst, dstPos, length));
return true;
}
@Override
public boolean inlineOnly() {
return true;
}
});
}
Aggregations