use of org.graalvm.compiler.hotspot.phases.OnStackReplacementPhase in project graal by oracle.
the class HotSpotGraalCompiler method configGraphBuilderSuite.
/**
* Reconfigures a given graph builder suite (GBS) if one of the given GBS parameter values is
* not the default.
*
* @param suite the graph builder suite
* @param shouldDebugNonSafepoints specifies if extra debug info should be generated (default is
* false)
* @param isOSR specifies if extra OSR-specific post-processing is required (default is false)
* @return a new suite derived from {@code suite} if any of the GBS parameters did not have a
* default value otherwise {@code suite}
*/
protected PhaseSuite<HighTierContext> configGraphBuilderSuite(PhaseSuite<HighTierContext> suite, boolean shouldDebugNonSafepoints, boolean isOSR) {
if (shouldDebugNonSafepoints || isOSR) {
PhaseSuite<HighTierContext> newGbs = suite.copy();
if (shouldDebugNonSafepoints) {
GraphBuilderPhase graphBuilderPhase = (GraphBuilderPhase) newGbs.findPhase(GraphBuilderPhase.class).previous();
GraphBuilderConfiguration graphBuilderConfig = graphBuilderPhase.getGraphBuilderConfig();
graphBuilderConfig = graphBuilderConfig.withNodeSourcePosition(true);
GraphBuilderPhase newGraphBuilderPhase = new GraphBuilderPhase(graphBuilderConfig);
newGbs.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase);
}
if (isOSR) {
// We must not clear non liveness for OSR compilations.
GraphBuilderPhase graphBuilderPhase = (GraphBuilderPhase) newGbs.findPhase(GraphBuilderPhase.class).previous();
GraphBuilderConfiguration graphBuilderConfig = graphBuilderPhase.getGraphBuilderConfig();
GraphBuilderPhase newGraphBuilderPhase = new GraphBuilderPhase(graphBuilderConfig);
newGbs.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase);
newGbs.appendPhase(new OnStackReplacementPhase());
}
return newGbs;
}
return suite;
}
Aggregations