Skip to content

Commit f92a8f6

Browse files
committed
OptimizationUtility: if no global self time is available all compilation
units are hot
1 parent dbdbfa8 commit f92a8f6

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/StructuredGraph.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,17 +1337,20 @@ public OptimizationLog getOptimizationLog() {
13371337
*/
13381338
public interface GlobalProfileProvider {
13391339

1340-
GlobalProfileProvider DEFAULT = new GlobalProfileProvider() {
1340+
/**
1341+
* The default time returned when no global profile provider is available on the platform.
1342+
*/
1343+
int GLOBAL_PROFILE_PROVIDER_DISABLED = -1;
13411344

1342-
public static final int DEFAULT_TIME = -1;
1345+
GlobalProfileProvider DEFAULT = new GlobalProfileProvider() {
13431346

13441347
/**
13451348
* The default time provider always returns -1, i.e. the self time is unknown by
13461349
* default.
13471350
*/
13481351
@Override
13491352
public double getGlobalSelfTimePercent() {
1350-
return DEFAULT_TIME;
1353+
return GLOBAL_PROFILE_PROVIDER_DISABLED;
13511354
}
13521355

13531356
/**

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,17 @@ public static <X> X chooseAdaptiveBudgetFactor(StructuredGraph graph, X coldValu
4949
}
5050

5151
/**
52-
* Determine if the given graph should be considered "hot" for additional optimization purposes.
53-
* We define "hot" by inspecting its self time with respect to overall execution time. This is a
54-
* pure heuristical value.
52+
* Determine if the given graph should be considered "hot" for optimization purposes. We define
53+
* "hot" by inspecting its self time with respect to overall execution time. This is a purely
54+
* heuristical value.
5555
*/
5656
public static boolean hotGlobalSelfTime(StructuredGraph graph) {
57-
return graph.globalProfileProvider().getGlobalSelfTimePercent() > Options.HotCodeMinSelfTime.getValue(graph.getOptions());
57+
final double globalSelfTimePercent = graph.globalProfileProvider().getGlobalSelfTimePercent();
58+
if (globalSelfTimePercent == StructuredGraph.GlobalProfileProvider.GLOBAL_PROFILE_PROVIDER_DISABLED) {
59+
// We are in a mode where there is no self time data available. In JIT all compilation
60+
// units are hot.
61+
return true;
62+
}
63+
return globalSelfTimePercent > Options.HotCodeMinSelfTime.getValue(graph.getOptions());
5864
}
5965
}

0 commit comments

Comments
 (0)