Search in sources :

Example 1 with InlineDuringParsingPlugin

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;
}
Also used : InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) OptionValues(org.graalvm.compiler.options.OptionValues) InlineDuringParsingPlugin(org.graalvm.compiler.replacements.InlineDuringParsingPlugin) NodeIntrinsicPluginFactory(org.graalvm.compiler.nodes.graphbuilderconf.NodeIntrinsicPluginFactory) BytecodeProvider(org.graalvm.compiler.bytecode.BytecodeProvider) NodeIntrinsificationProvider(org.graalvm.compiler.replacements.NodeIntrinsificationProvider) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins) StandardGraphBuilderPlugins(org.graalvm.compiler.replacements.StandardGraphBuilderPlugins) MethodHandlePlugin(org.graalvm.compiler.replacements.MethodHandlePlugin)

Example 2 with InlineDuringParsingPlugin

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);
}
Also used : InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) InlineDuringParsingPlugin(org.graalvm.compiler.replacements.InlineDuringParsingPlugin) ReplacementsImpl(org.graalvm.compiler.replacements.ReplacementsImpl) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) Providers(org.graalvm.compiler.phases.util.Providers) CachingPEGraphDecoder(org.graalvm.compiler.replacements.CachingPEGraphDecoder) TruffleGraphBuilderPlugins(org.graalvm.compiler.truffle.compiler.substitutions.TruffleGraphBuilderPlugins) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Aggregations

Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)2 InvocationPlugins (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins)2 InlineDuringParsingPlugin (org.graalvm.compiler.replacements.InlineDuringParsingPlugin)2 BytecodeProvider (org.graalvm.compiler.bytecode.BytecodeProvider)1 GraphBuilderConfiguration (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration)1 NodeIntrinsicPluginFactory (org.graalvm.compiler.nodes.graphbuilderconf.NodeIntrinsicPluginFactory)1 OptionValues (org.graalvm.compiler.options.OptionValues)1 Providers (org.graalvm.compiler.phases.util.Providers)1 CachingPEGraphDecoder (org.graalvm.compiler.replacements.CachingPEGraphDecoder)1 MethodHandlePlugin (org.graalvm.compiler.replacements.MethodHandlePlugin)1 NodeIntrinsificationProvider (org.graalvm.compiler.replacements.NodeIntrinsificationProvider)1 ReplacementsImpl (org.graalvm.compiler.replacements.ReplacementsImpl)1 StandardGraphBuilderPlugins (org.graalvm.compiler.replacements.StandardGraphBuilderPlugins)1 TruffleGraphBuilderPlugins (org.graalvm.compiler.truffle.compiler.substitutions.TruffleGraphBuilderPlugins)1