/** * Modifies the {@link GraphBuilderConfiguration} to build extra {@linkplain DebugInfoMode#Simple * debug info} if the VM {@linkplain CompilerToVM#shouldDebugNonSafepoints() requests} it. * * @param gbs the current graph builder suite * @return a possibly modified graph builder suite */ public static PhaseSuite<HighTierContext> withSimpleDebugInfoIfRequested( PhaseSuite<HighTierContext> gbs) { if (HotSpotGraalRuntime.runtime().getCompilerToVM().shouldDebugNonSafepoints()) { PhaseSuite<HighTierContext> newGbs = gbs.copy(); GraphBuilderPhase graphBuilderPhase = (GraphBuilderPhase) newGbs.findPhase(GraphBuilderPhase.class).previous(); GraphBuilderConfiguration graphBuilderConfig = graphBuilderPhase.getGraphBuilderConfig(); GraphBuilderPhase newGraphBuilderPhase = new GraphBuilderPhase(graphBuilderConfig.withDebugInfoMode(DebugInfoMode.Simple)); newGbs.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase); return newGbs; } return gbs; }