Adding method->is_empty_method() to SimpleThresholdPolicy::is_trivial(Method* method) would allow tiered compilation to shortcut an unnecessary pass through tier 3:
diff -r 770679787db5 src/hotspot/share/runtime/simpleThresholdPolicy.inline.hpp
--- a/src/hotspot/share/runtime/simpleThresholdPolicy.inline.hpp Thu Apr 26 17:14:04 2018 +0200
+++ b/src/hotspot/share/runtime/simpleThresholdPolicy.inline.hpp Thu Apr 26 18:13:46 2018 +0200
@@ -73,7 +73,8 @@
// Determine if a given method is such a case.
bool SimpleThresholdPolicy::is_trivial(Method* method) {
if (method->is_accessor() ||
- method->is_constant_getter()) {
+ method->is_constant_getter() ||
+ method->is_empty_method()) {
return true;
}
#if INCLUDE_JVMCI
The current Method::is_empty_method implicitly avoids treating Object.<init> as a trivial method, so it's possible that it'd be worthwhile to add an alternative method that would include Object.<init> by using java_code_at(0) == Bytecodes::_return rather than *code_base() == Bytecodes::_return