JDK-8275676 : Deprecate MinInliningThreshold
  • Type: CSR
  • Component: hotspot
  • Sub-Component: compiler
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 18
  • Submitted: 2021-10-20
  • Updated: 2021-10-22
  • Resolved: 2021-10-22
Related Reports
CSR :  
Description
Summary
-------

In [JDK-8273712](https://bugs.openjdk.java.net/browse/JDK-8273712) we'd like to enhance the inlining policy so that it doesn't rely on absolute counters but rather on call site frequencies.

Problem
-------

Currently the inlining heuristic uses absolute method invocation count to reject methods that are rarely executed (see MinInliningThreshold and its uses). 

This presents two problems: 

1) Method can be rarely used in a particular caller, yet if its total execution count is high it may be still inlined. 

2) The use of absolute counts is inherently problematic with the current compilation policy (adaptive threshold and background compilation). It leads to instabilities of inlining decisions. 

Solution
--------

The proposed solution is to consider call site execution ratio in order to reject callees that are rarely executed.

Set the old product flag `-XX:MinInliningThreshold=250` to 0 to essentially disable it and later deprecate it.

And use new diagnostic flag `-XX:MinInlineFrequencyRatio=0.0085` to specify execution ratio.

Specification
-------------

See [PR for 8273712](https://github.com/openjdk/jdk/pull/6046) for full changes.
```
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
index 299613611c01..86b38eca4ed7 100644
--- a/src/hotspot/share/runtime/globals.hpp
+++ b/src/hotspot/share/runtime/globals.hpp
@@ -1351,9 +1351,9 @@ const intx ObjectAlignmentInBytes = 8;
           "(using CompileCommand or marked w/ @ForceInline)")               \
           range(0, max_jint)                                                \
                                                                             \
-  product(intx, MinInliningThreshold, 250,                                  \
-          "The minimum invocation count a method needs to have to be "      \
-          "inlined")                                                        \
+  product(intx, MinInliningThreshold, 0,                                    \
+          "(Deprecated) The minimum invocation count a method needs to"     \
+          "have to be inlined")                                             \
           range(0, max_jint)                                                \
                                                                             \
   develop(intx, MethodHistogramCutoff, 100,                                 \
@@ -1407,6 +1407,10 @@ const intx ObjectAlignmentInBytes = 8;
   product(double, InlineFrequencyRatio, 0.25, DIAGNOSTIC,                   \
           "Ratio of call site execution to caller method invocation")       \
                                                                             \
+  product(double, MinInlineFrequencyRatio, 0.0085, DIAGNOSTIC,              \
+          "Minimum ratio of call site execution to caller method"           \
+          "invocation to be considered for inlining")                       \
+                                                                            \
   develop(intx, InlineThrowCount,    50,                                    \
           "Force inlining of interpreted methods that throw this often")    \
           range(0, max_jint)                                                \
```




Comments
Moving to Approved for putting the flag through the usual deprecation procedures.
22-10-2021