Search in sources :

Example 1 with OnStackReplacementPhase

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;
}
Also used : GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) OnStackReplacementPhase(org.graalvm.compiler.hotspot.phases.OnStackReplacementPhase)

Aggregations

OnStackReplacementPhase (org.graalvm.compiler.hotspot.phases.OnStackReplacementPhase)1 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)1 GraphBuilderConfiguration (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration)1 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)1