use of org.graalvm.compiler.nodes.PiArrayNode in project graal by oracle.
the class TruffleGraphBuilderPlugins method registerOptimizedCallTargetPlugins.
public static void registerOptimizedCallTargetPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess, boolean canDelayIntrinsification, KnownTruffleTypes types) {
final ResolvedJavaType optimizedCallTargetType = getRuntime().resolveType(metaAccess, "org.graalvm.compiler.truffle.runtime.OptimizedCallTarget");
Registration r = new Registration(plugins, new ResolvedJavaSymbol(optimizedCallTargetType));
r.register2("createFrame", new ResolvedJavaSymbol(types.classFrameDescriptor), Object[].class, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode descriptor, ValueNode args) {
if (canDelayIntrinsification) {
return false;
}
if (!descriptor.isJavaConstant()) {
throw b.bailout("Parameter 'descriptor' is not a compile-time constant");
}
ValueNode nonNullArguments = b.add(PiNode.create(args, StampFactory.objectNonNull(StampTool.typeReferenceOrNull(args))));
b.addPush(JavaKind.Object, new NewFrameNode(b, descriptor, nonNullArguments, types));
return true;
}
});
r.register2("castArrayFixedLength", Object[].class, int.class, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode args, ValueNode length) {
b.addPush(JavaKind.Object, new PiArrayNode(args, length, args.stamp(NodeView.DEFAULT)));
return true;
}
});
registerUnsafeCast(r, canDelayIntrinsification);
}
Aggregations