Skip to content

Commit 950d08f

Browse files
committed
[GR-61673] Refactorings loop utility APIs.
PullRequest: graal/19921
2 parents c712894 + 527ceb8 commit 950d08f

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/loop/phases/LoopSafepointEliminationPhase.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,16 @@ private int disableSafepointsByBodyNodes(LoopSafepointPlan safepointPlan, Loop l
304304
}
305305

306306
public LoopSafepointPlan optimizeSafepoints() {
307+
LoopsData loops = context.getLoopsDataProvider().getLoopsData(graph);
308+
loops.detectCountedLoops();
309+
return optimizeSafepoints(loops);
310+
}
311+
312+
public LoopSafepointPlan optimizeSafepoints(LoopsData loops) {
307313
LoopSafepointPlan graphWidePlan = new LoopSafepointPlan(graph);
308314

309315
final boolean optimisticallyRemoveLoopSafepoints = Options.RemoveLoopSafepoints.getValue(graph.getOptions());
310316

311-
LoopsData loops = context.getLoopsDataProvider().getLoopsData(graph);
312-
loops.detectCountedLoops();
313-
314317
for (Loop loop : loops.loops()) {
315318
if (!allowGuestSafepoints()) {
316319
graphWidePlan.setGuestEndStateAllEnds(loop, SafepointState.MUST_NEVER_SAFEPOINT);

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/phases/common/LazyValue.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -51,4 +51,8 @@ public T get() {
5151
}
5252
return value;
5353
}
54+
55+
public boolean isAvailable() {
56+
return value != null;
57+
}
5458
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/phases/common/util/LoopUtility.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,13 @@ public static boolean isInt(ValueNode v) {
254254
* @param canonicalizer must not be {@code null}, will be applied incrementally to nodes whose
255255
* inputs changed
256256
*/
257-
@SuppressWarnings("try")
258257
public static void removeObsoleteProxies(StructuredGraph graph, CoreProviders context, CanonicalizerPhase canonicalizer) {
259258
LoopsData loopsData = context.getLoopsDataProvider().getLoopsData(graph);
259+
removeObsoleteProxies(graph, context, canonicalizer, loopsData);
260+
}
261+
262+
@SuppressWarnings("try")
263+
public static void removeObsoleteProxies(StructuredGraph graph, CoreProviders context, CanonicalizerPhase canonicalizer, LoopsData loopsData) {
260264
final EconomicSetNodeEventListener inputChanges = new EconomicSetNodeEventListener(EnumSet.of(NodeEvent.INPUT_CHANGED));
261265
try (NodeEventScope s = graph.trackNodeEvents(inputChanges)) {
262266
for (Loop loop : loopsData.loops()) {

0 commit comments

Comments
 (0)