use of org.graalvm.compiler.replacements.ReplacementsImpl 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);
}
use of org.graalvm.compiler.replacements.ReplacementsImpl in project graal by oracle.
the class PartialEvaluator method doGraphPE.
protected void doGraphPE(CompilableTruffleAST compilable, StructuredGraph graph, HighTierContext tierContext, TruffleInliningPlan inliningDecision) {
LoopExplosionPlugin loopExplosionPlugin = new PELoopExplosionPlugin();
ParameterPlugin parameterPlugin = new InterceptReceiverPlugin(compilable);
ReplacementsImpl replacements = (ReplacementsImpl) providers.getReplacements();
InlineInvokePlugin[] inlineInvokePlugins;
InlineInvokePlugin inlineInvokePlugin = new PEInlineInvokePlugin(inliningDecision);
HistogramInlineInvokePlugin histogramPlugin = null;
if (TruffleCompilerOptions.getValue(PrintTruffleExpansionHistogram)) {
histogramPlugin = new HistogramInlineInvokePlugin(graph);
inlineInvokePlugins = new InlineInvokePlugin[] { replacements, inlineInvokePlugin, histogramPlugin };
} else {
inlineInvokePlugins = new InlineInvokePlugin[] { replacements, inlineInvokePlugin };
}
SourceLanguagePositionProvider sourceLanguagePosition = new TruffleSourceLanguagePositionProvider(inliningDecision);
PEGraphDecoder decoder = createGraphDecoder(graph, tierContext, loopExplosionPlugin, decodingInvocationPlugins, inlineInvokePlugins, parameterPlugin, nodePlugins, callInlinedMethod, sourceLanguagePosition);
decoder.decode(graph.method(), graph.trackNodeSourcePosition());
if (TruffleCompilerOptions.getValue(PrintTruffleExpansionHistogram)) {
histogramPlugin.print(compilable);
}
}
use of org.graalvm.compiler.replacements.ReplacementsImpl in project graal by oracle.
the class ReplacementsTest method getSystemClassLoaderBytecodeProvider.
/**
* Gets a {@link ClassfileBytecodeProvider} that enables snippets and intrinsics to be loaded
* from the system class path (instead of from the JVMCI class path or Graal module).
*/
protected final ClassfileBytecodeProvider getSystemClassLoaderBytecodeProvider() {
ReplacementsImpl d = (ReplacementsImpl) getReplacements();
MetaAccessProvider metaAccess = d.providers.getMetaAccess();
ClassfileBytecodeProvider bytecodeProvider = new ClassfileBytecodeProvider(metaAccess, d.snippetReflection, ClassLoader.getSystemClassLoader());
return bytecodeProvider;
}
Aggregations