Skip to content

Commit

Permalink
Reuse the loopExplosionPlugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-spas committed Mar 14, 2022
1 parent de76a62 commit 7d77e43
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,26 @@
*/
public abstract class PartialEvaluator {

// Configs
public final TruffleCompilerConfiguration config;
volatile GraphBuilderConfiguration configForParsing;
// Methods
final ResolvedJavaMethod callDirectMethod;
protected final ResolvedJavaMethod callInlined;
final ResolvedJavaMethod callIndirectMethod;
private final ResolvedJavaMethod profiledPERoot;
final ResolvedJavaMethod callBoundary;
// Plugins
private final GraphBuilderConfiguration configPrototype;
private final InvocationPlugins firstTierDecodingPlugins;
private final InvocationPlugins lastTierDecodingPlugins;
protected final PELoopExplosionPlugin loopExplosionPlugin = new PELoopExplosionPlugin();
private final NodePlugin[] nodePlugins;
// Misc
final KnownTruffleTypes knownTruffleTypes;
final ResolvedJavaMethod callBoundary;
volatile GraphBuilderConfiguration configForParsing;

/**
* Holds instrumentation options initialized in
* {@link #initialize(OptionValues, GraphBuilderConfiguration)} method before the first
* compilation. These options are not engine aware.
* Holds instrumentation options initialized in {@link #initialize(OptionValues)} method before
* the first compilation. These options are not engine aware.
*/
public volatile InstrumentPhase.InstrumentationConfiguration instrumentationCfg;
/**
Expand All @@ -117,7 +120,6 @@ public abstract class PartialEvaluator {
* the TruffleRuntime object is created.
*/
protected volatile InstrumentPhase.Instrumentation instrumentation;

protected final TruffleConstantFieldProvider compilationLocalConstantProvider;

public PartialEvaluator(TruffleCompilerConfiguration config, GraphBuilderConfiguration configForRoot, KnownTruffleTypes knownFields) {
Expand Down Expand Up @@ -308,7 +310,7 @@ public SourceLanguagePosition getPosition(JavaConstant node) {
}
}

private class PELoopExplosionPlugin implements LoopExplosionPlugin {
private static final class PELoopExplosionPlugin implements LoopExplosionPlugin {

@Override
public LoopExplosionKind loopExplosionKind(ResolvedJavaMethod method) {
Expand All @@ -334,10 +336,8 @@ public LoopExplosionKind loopExplosionKind(ResolvedJavaMethod method) {
}

@SuppressWarnings("unused")
protected PEGraphDecoder createGraphDecoder(TruffleTierContext context, LoopExplosionPlugin loopExplosionPlugin,
InvocationPlugins invocationPlugins,
InlineInvokePlugin[] inlineInvokePlugins, ParameterPlugin parameterPlugin, NodePlugin[] nodePluginList,
SourceLanguagePositionProvider sourceLanguagePositionProvider, EconomicMap<ResolvedJavaMethod, EncodedGraph> graphCache) {
protected PEGraphDecoder createGraphDecoder(TruffleTierContext context, InvocationPlugins invocationPlugins, InlineInvokePlugin[] inlineInvokePlugins, ParameterPlugin parameterPlugin,
NodePlugin[] nodePluginList, SourceLanguagePositionProvider sourceLanguagePositionProvider, EconomicMap<ResolvedJavaMethod, EncodedGraph> graphCache) {
final GraphBuilderConfiguration newConfig = configForParsing.copy();
InvocationPlugins parsingInvocationPlugins = newConfig.getPlugins().getInvocationPlugins();

Expand Down Expand Up @@ -368,7 +368,6 @@ public void doGraphPE(TruffleTierContext context, InlineInvokePlugin inlineInvok
inlineInvokePlugin
};
PEGraphDecoder decoder = createGraphDecoder(context,
new PELoopExplosionPlugin(),
context.isFirstTier() ? firstTierDecodingPlugins : lastTierDecodingPlugins,
inlineInvokePlugins,
new InterceptReceiverPlugin(context.compilable),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins;
import org.graalvm.compiler.nodes.graphbuilderconf.InlineInvokePlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;
import org.graalvm.compiler.nodes.graphbuilderconf.LoopExplosionPlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.NodePlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.ParameterPlugin;
import org.graalvm.compiler.phases.util.Providers;
Expand Down Expand Up @@ -62,14 +61,10 @@ public SubstratePartialEvaluator(TruffleCompilerConfiguration config, GraphBuild
}

@Override
protected PEGraphDecoder createGraphDecoder(TruffleTierContext context, LoopExplosionPlugin loopExplosionPlugin,
InvocationPlugins invocationPlugins,
InlineInvokePlugin[] inlineInvokePlugins, ParameterPlugin parameterPlugin, NodePlugin[] nodePlugins, SourceLanguagePositionProvider sourceLanguagePositionProvider,
EconomicMap<ResolvedJavaMethod, EncodedGraph> graphCache) {
protected PEGraphDecoder createGraphDecoder(TruffleTierContext context, InvocationPlugins invocationPlugins, InlineInvokePlugin[] inlineInvokePlugins, ParameterPlugin parameterPlugin,
NodePlugin[] nodePlugins, SourceLanguagePositionProvider sourceLanguagePositionProvider, EconomicMap<ResolvedJavaMethod, EncodedGraph> graphCache) {
return new SubstratePEGraphDecoder(config.architecture(), context.graph, config.lastTier().providers().copyWith(compilationLocalConstantProvider), loopExplosionPlugin, invocationPlugins,
inlineInvokePlugins,
parameterPlugin, nodePlugins, callInlined, sourceLanguagePositionProvider,
specialCallTargetCache, invocationPluginsCache);
inlineInvokePlugins, parameterPlugin, nodePlugins, callInlined, sourceLanguagePositionProvider, specialCallTargetCache, invocationPluginsCache);
}

@Override
Expand Down

0 comments on commit 7d77e43

Please sign in to comment.