-
Bug
-
Resolution: Fixed
-
P3
-
9, 10
-
b36
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8193747 | 11 | Dean Long | P3 | Resolved | Fixed | team |
The relevant code in SimpleThresholdPolicy was apparently introduced by JDK-8056071. It now consults MDO to see if method is trivial. However, there are cases when that guess is wrong, notably when we are dealing with intrinsics or simple calls inside the method.
bool SimpleThresholdPolicy::is_trivial(Method* method) {
...
MethodData* mdo = method->method_data();
if (mdo != NULL && !mdo->would_profile() &&
(method->code_size() < 5 || (mdo->num_blocks() < 4))) {
return true;
}
return false;
}
See e.g. the benchmark against Unsafe.putOrdered:
http://cr.openjdk.java.net/~shade/8145579/BadMDOPolicy.java
http://cr.openjdk.java.net/~shade/8145579/benchmarks.jar
It works significantly worse with TieredCompilation enabled, because it gets to compile with C1 only.
Update: Perhaps, even more alarming is that Object::<init> is accepted as trivial, which makes tiered mode slower than non-tiered mode, if Object::<init> had not inlined into a hotpath:
http://cr.openjdk.java.net/~shade/8145579/ObjectInit.java
bool SimpleThresholdPolicy::is_trivial(Method* method) {
...
MethodData* mdo = method->method_data();
if (mdo != NULL && !mdo->would_profile() &&
(method->code_size() < 5 || (mdo->num_blocks() < 4))) {
return true;
}
return false;
}
See e.g. the benchmark against Unsafe.putOrdered:
http://cr.openjdk.java.net/~shade/8145579/BadMDOPolicy.java
http://cr.openjdk.java.net/~shade/8145579/benchmarks.jar
It works significantly worse with TieredCompilation enabled, because it gets to compile with C1 only.
Update: Perhaps, even more alarming is that Object::<init> is accepted as trivial, which makes tiered mode slower than non-tiered mode, if Object::<init> had not inlined into a hotpath:
http://cr.openjdk.java.net/~shade/8145579/ObjectInit.java
- backported by
-
JDK-8193747 SimpleThresholdPolicy assumes non-trivial methods to be trivial
-
- Resolved
-
- relates to
-
JDK-8076988 reevaluate trivial method policy
-
- Resolved
-
-
JDK-8056071 compiler/whitebox/IsMethodCompilableTest.java fails with 'method() is not compilable after 3 iterations'
-
- Resolved
-
-
JDK-8216375 Revert JDK-8145579 after JDK-8076988 is resolved
-
- Resolved
-
-
JDK-8130398 Coalesce prolog and epilog for empty methods
-
- Closed
-
-
JDK-8202332 Empty methods should be considered trivial by SimpleThresholdPolicy
-
- Closed
-
(1 relates to)