use of org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.RequiredInvocationPlugin in project graal by oracle.
the class Target_org_graalvm_compiler_truffle_runtime_OptimizedCallTarget method registerNeverPartOfCompilation.
private void registerNeverPartOfCompilation(InvocationPlugins plugins) {
InvocationPlugins.Registration r = new InvocationPlugins.Registration(plugins, CompilerAsserts.class);
r.setAllowOverwrite(true);
r.register(new RequiredInvocationPlugin("neverPartOfCompilation") {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
return handleNeverPartOfCompilation(b, targetMethod, null);
}
});
r.register(new RequiredInvocationPlugin("neverPartOfCompilation", String.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode message) {
return handleNeverPartOfCompilation(b, targetMethod, message);
}
});
}
use of org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.RequiredInvocationPlugin in project graal by oracle.
the class SubstrateTruffleGraphBuilderPlugins method registerOptimizedCallTargetPlugins.
private static void registerOptimizedCallTargetPlugins(InvocationPlugins plugins) {
InvocationPlugins.Registration r0 = new InvocationPlugins.Registration(plugins, SubstrateOptimizedCallTarget.class);
r0.register(new RequiredInvocationPlugin("safepointBarrier") {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
b.add(new MembarNode(MembarNode.FenceKind.NONE));
return true;
}
});
}
use of org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.RequiredInvocationPlugin in project graal by oracle.
the class SubstrateTruffleGraphBuilderPlugins method registerCompilationFinalReferencePlugins.
private static void registerCompilationFinalReferencePlugins(InvocationPlugins plugins, boolean canDelayIntrinsification, SubstrateKnownTruffleTypes types) {
InvocationPlugins.Registration r0 = new InvocationPlugins.Registration(plugins, Reference.class);
r0.register(new RequiredInvocationPlugin("get", InvocationPlugin.Receiver.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
if (!canDelayIntrinsification && receiver.isConstant()) {
JavaConstant reference = (JavaConstant) receiver.get().asConstant();
if (reference.isNonNull()) {
JavaConstant referent = b.getConstantReflection().readFieldValue(types.referentField, reference);
b.addPush(JavaKind.Object, ConstantNode.forConstant(referent, b.getMetaAccess()));
return true;
}
}
return false;
}
});
}
use of org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.RequiredInvocationPlugin in project graal by oracle.
the class Target_com_oracle_truffle_api_nodes_Node method registerInvocationPlugins.
@Override
public void registerInvocationPlugins(Providers providers, SnippetReflectionProvider snippetReflection, Plugins plugins, ParsingReason reason) {
StaticObjectSupport.registerInvocationPlugins(plugins, reason);
/*
* We need to constant-fold Profile.isProfilingEnabled already during static analysis, so
* that we get exact types for fields that store profiles.
*/
Registration r = new Registration(plugins.getInvocationPlugins(), Profile.class);
r.register(new RequiredInvocationPlugin("isProfilingEnabled") {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
b.addPush(JavaKind.Boolean, ConstantNode.forBoolean(profilingEnabled));
return true;
}
});
if (reason != ParsingReason.JITCompilation) {
r = new Registration(plugins.getInvocationPlugins(), CompilerDirectives.class);
/*
* For AOT compilation and static analysis, we intrinsify CompilerDirectives.castExact
* with explicit exception edges. For runtime compilation, TruffleGraphBuilderPlugins
* registers a plugin that uses deoptimization.
*/
SubstrateGraphBuilderPlugins.registerCastExact(r);
}
}
use of org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.RequiredInvocationPlugin in project graal by oracle.
the class TruffleGraphBuilderPlugins method registerOptimizedCallTargetPlugins.
public static void registerOptimizedCallTargetPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess, boolean canDelayIntrinsification, KnownTruffleTypes types, EconomicSet<ResolvedJavaType> primitiveBoxingTypes) {
final ResolvedJavaType optimizedCallTargetType = getRuntime().resolveType(metaAccess, "org.graalvm.compiler.truffle.runtime.OptimizedCallTarget");
Registration r = new Registration(plugins, new ResolvedJavaSymbol(optimizedCallTargetType));
r.register(new RequiredInvocationPlugin("createFrame", new ResolvedJavaSymbol(types.classFrameDescriptor), Object[].class) {
@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.register(new RequiredInvocationPlugin("castArrayFixedLength", Object[].class, int.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode args, ValueNode length) {
if (canDelayIntrinsification) {
return false;
}
if (args.isConstant()) {
b.addPush(JavaKind.Object, args);
return true;
}
b.addPush(JavaKind.Object, new PiArrayNode(args, length, args.stamp(NodeView.DEFAULT)));
return true;
}
});
registerUnsafeCast(r, canDelayIntrinsification, primitiveBoxingTypes);
}
Aggregations