use of com.oracle.svm.hosted.phases.ImageBuildStatisticsCounterPhase in project graal by oracle.
the class NativeImageGenerator method modifySuites.
@SuppressWarnings("unused")
private static Suites modifySuites(SubstrateBackend backend, Suites suites, FeatureHandler featureHandler, RuntimeConfiguration runtimeConfig, SnippetReflectionProvider snippetReflection, boolean hosted, boolean firstTier) {
Providers runtimeCallProviders = backend.getProviders();
PhaseSuite<HighTierContext> highTier = suites.getHighTier();
PhaseSuite<MidTierContext> midTier = suites.getMidTier();
PhaseSuite<LowTierContext> lowTier = suites.getLowTier();
final boolean economy = firstTier || SubstrateOptions.useEconomyCompilerConfig();
ListIterator<BasePhase<? super HighTierContext>> position;
if (hosted) {
position = GraalConfiguration.hostedInstance().createHostedInliners(highTier);
} else {
/* Find the runtime inliner. */
position = highTier.findPhase(InliningPhase.class);
}
if (position != null) {
/* These two phases must be after all method inlining. */
position.add(new DeadStoreRemovalPhase());
position.add(new RemoveUnwindPhase());
} else {
/* There is no inlining, so prepend them in reverse order. */
highTier.prependPhase(new RemoveUnwindPhase());
highTier.prependPhase(new DeadStoreRemovalPhase());
}
lowTier.addBeforeLast(new OptimizeExceptionPathsPhase());
BasePhase<CoreProviders> addressLoweringPhase = backend.newAddressLoweringPhase(runtimeCallProviders.getCodeCache());
if (economy) {
lowTier.findPhase(ExpandLogicPhase.class, true).add(addressLoweringPhase);
} else {
lowTier.findPhase(UseTrappingNullChecksPhase.class).add(addressLoweringPhase);
}
if (SubstrateOptions.MultiThreaded.getValue()) {
/*
* Graal inserts only loop safepoints. We want a SafepointNode also before every return.
* Our safepoint insertion phase inserts both kinds of safepoints.
*/
midTier.findPhase(LoopSafepointInsertionPhase.class).set(new SubstrateSafepointInsertionPhase());
} else {
/* No need for safepoints when we have only one thread. */
VMError.guarantee(midTier.removePhase(LoopSafepointInsertionPhase.class));
}
if (hosted) {
lowTier.appendPhase(new VerifyNoGuardsPhase());
/* Disable the Graal method inlining, since we have our own inlining system. */
highTier.removePhase(InliningPhase.class);
/* Remove phases that are not suitable for AOT compilation. */
highTier.removePhase(ConvertDeoptimizeToGuardPhase.class);
midTier.removePhase(DeoptimizationGroupingPhase.class);
} else {
if (economy) {
ListIterator<BasePhase<? super MidTierContext>> it = midTier.findPhase(FrameStateAssignmentPhase.class);
it.add(new CollectDeoptimizationSourcePositionsPhase());
// On SVM, the economy configuration requires a canonicalization run at the end of
// mid tier.
it = midTier.findLastPhase();
it.add(CanonicalizerPhase.create());
} else {
ListIterator<BasePhase<? super MidTierContext>> it = midTier.findPhase(DeoptimizationGroupingPhase.class);
it.previous();
it.add(new CollectDeoptimizationSourcePositionsPhase());
}
}
featureHandler.forEachGraalFeature(feature -> feature.registerGraalPhases(runtimeCallProviders, snippetReflection, suites, hosted));
if (hosted && ImageBuildStatistics.Options.CollectImageBuildStatistics.getValue(HostedOptionValues.singleton())) {
highTier.prependPhase(new ImageBuildStatisticsCounterPhase(ImageBuildStatistics.CheckCountLocation.BEFORE_HIGH_TIER));
highTier.prependPhase(CanonicalizerPhase.create());
highTier.findLastPhase().add(CanonicalizerPhase.create());
highTier.findLastPhase().add(new ImageBuildStatisticsCounterPhase(ImageBuildStatistics.CheckCountLocation.AFTER_HIGH_TIER));
}
return suites;
}
use of com.oracle.svm.hosted.phases.ImageBuildStatisticsCounterPhase in project graal by oracle.
the class CompileQueue method afterParseCanonicalization.
protected PhaseSuite<HighTierContext> afterParseCanonicalization() {
PhaseSuite<HighTierContext> phaseSuite = new PhaseSuite<>();
phaseSuite.appendPhase(new ImplicitAssertionsPhase());
phaseSuite.appendPhase(new DeadStoreRemovalPhase());
phaseSuite.appendPhase(new DevirtualizeCallsPhase());
phaseSuite.appendPhase(CanonicalizerPhase.create());
phaseSuite.appendPhase(new StrengthenStampsPhase());
phaseSuite.appendPhase(CanonicalizerPhase.create());
phaseSuite.appendPhase(new OptimizeExceptionPathsPhase());
if (ImageBuildStatistics.Options.CollectImageBuildStatistics.getValue(universe.hostVM().options())) {
phaseSuite.appendPhase(CanonicalizerPhase.create());
phaseSuite.appendPhase(new ImageBuildStatisticsCounterPhase(ImageBuildStatistics.CheckCountLocation.AFTER_PARSE_CANONICALIZATION));
}
return phaseSuite;
}
Aggregations