use of org.graalvm.compiler.replacements.InlineDuringParsingPlugin in project graal by oracle.
the class HotSpotGraphBuilderPlugins method create.
/**
* Creates a {@link Plugins} object that should be used when running on HotSpot.
*
* @param constantReflection
* @param snippetReflection
* @param foreignCalls
* @param stampProvider
*/
public static Plugins create(CompilerConfiguration compilerConfiguration, GraalHotSpotVMConfig config, HotSpotWordTypes wordTypes, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, SnippetReflectionProvider snippetReflection, ForeignCallsProvider foreignCalls, LoweringProvider lowerer, StampProvider stampProvider, ReplacementsImpl replacements) {
InvocationPlugins invocationPlugins = new HotSpotInvocationPlugins(config, compilerConfiguration);
Plugins plugins = new Plugins(invocationPlugins);
NodeIntrinsificationProvider nodeIntrinsificationProvider = new NodeIntrinsificationProvider(metaAccess, snippetReflection, foreignCalls, lowerer, wordTypes);
HotSpotWordOperationPlugin wordOperationPlugin = new HotSpotWordOperationPlugin(snippetReflection, wordTypes);
HotSpotNodePlugin nodePlugin = new HotSpotNodePlugin(wordOperationPlugin);
plugins.appendTypePlugin(nodePlugin);
plugins.appendNodePlugin(nodePlugin);
OptionValues options = replacements.getOptions();
if (!GeneratePIC.getValue(options)) {
plugins.appendNodePlugin(new MethodHandlePlugin(constantReflection.getMethodHandleAccess(), true));
}
plugins.appendInlineInvokePlugin(replacements);
if (InlineDuringParsing.getValue(options)) {
plugins.appendInlineInvokePlugin(new InlineDuringParsingPlugin());
}
if (GeneratePIC.getValue(options)) {
plugins.setClassInitializationPlugin(new HotSpotClassInitializationPlugin());
if (TieredAOT.getValue(options)) {
plugins.setProfilingPlugin(new HotSpotAOTProfilingPlugin());
}
}
invocationPlugins.defer(new Runnable() {
@Override
public void run() {
BytecodeProvider replacementBytecodeProvider = replacements.getDefaultReplacementBytecodeProvider();
registerObjectPlugins(invocationPlugins, options, replacementBytecodeProvider);
registerClassPlugins(plugins, config, replacementBytecodeProvider);
registerSystemPlugins(invocationPlugins, foreignCalls);
registerThreadPlugins(invocationPlugins, metaAccess, wordTypes, config, replacementBytecodeProvider);
if (!GeneratePIC.getValue(options)) {
registerCallSitePlugins(invocationPlugins);
}
registerReflectionPlugins(invocationPlugins, replacementBytecodeProvider);
registerConstantPoolPlugins(invocationPlugins, wordTypes, config, replacementBytecodeProvider);
registerAESPlugins(invocationPlugins, config, replacementBytecodeProvider);
registerCRC32Plugins(invocationPlugins, config, replacementBytecodeProvider);
registerCRC32CPlugins(invocationPlugins, config, replacementBytecodeProvider);
registerBigIntegerPlugins(invocationPlugins, config, replacementBytecodeProvider);
registerSHAPlugins(invocationPlugins, config, replacementBytecodeProvider);
registerUnsafePlugins(invocationPlugins, replacementBytecodeProvider);
StandardGraphBuilderPlugins.registerInvocationPlugins(metaAccess, snippetReflection, invocationPlugins, replacementBytecodeProvider, true);
registerArrayPlugins(invocationPlugins, replacementBytecodeProvider);
for (NodeIntrinsicPluginFactory factory : GraalServices.load(NodeIntrinsicPluginFactory.class)) {
factory.registerPlugins(invocationPlugins, nodeIntrinsificationProvider);
}
}
});
return plugins;
}
use of org.graalvm.compiler.replacements.InlineDuringParsingPlugin in project graal by oracle.
the class PartialEvaluator method createGraphDecoder.
@SuppressWarnings("unused")
protected PEGraphDecoder createGraphDecoder(StructuredGraph graph, final HighTierContext tierContext, LoopExplosionPlugin loopExplosionPlugin, InvocationPlugins invocationPlugins, InlineInvokePlugin[] inlineInvokePlugins, ParameterPlugin parameterPlugin, NodePlugin[] nodePluginList, ResolvedJavaMethod callInlined, SourceLanguagePositionProvider sourceLanguagePositionProvider) {
final GraphBuilderConfiguration newConfig = configForParsing.copy();
if (newConfig.trackNodeSourcePosition()) {
graph.setTrackNodeSourcePosition();
}
InvocationPlugins parsingInvocationPlugins = newConfig.getPlugins().getInvocationPlugins();
Plugins plugins = newConfig.getPlugins();
ReplacementsImpl replacements = (ReplacementsImpl) providers.getReplacements();
plugins.clearInlineInvokePlugins();
plugins.appendInlineInvokePlugin(replacements);
plugins.appendInlineInvokePlugin(new ParsingInlineInvokePlugin(replacements, parsingInvocationPlugins, loopExplosionPlugin));
if (!TruffleCompilerOptions.getValue(PrintTruffleExpansionHistogram)) {
plugins.appendInlineInvokePlugin(new InlineDuringParsingPlugin());
}
Providers compilationUnitProviders = providers.copyWith(new TruffleConstantFieldProvider(providers.getConstantFieldProvider(), providers.getMetaAccess()));
return new CachingPEGraphDecoder(architecture, graph, compilationUnitProviders, newConfig, TruffleCompilerImpl.Optimizations, AllowAssumptions.ifNonNull(graph.getAssumptions()), loopExplosionPlugin, decodingInvocationPlugins, inlineInvokePlugins, parameterPlugin, nodePluginList, callInlined, sourceLanguagePositionProvider);
}
Aggregations