8272873: C2: Inlining should not depend on absolute call site counts

Reviewed-by: kvn, vlivanov, dlong
This commit is contained in:
Igor Veresov 2021-08-26 00:17:15 +00:00
parent 7212561dd1
commit 673ce7efa5
10 changed files with 5 additions and 17 deletions

View File

@ -39,7 +39,6 @@ define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs
define_pd_global(uintx, CodeCacheSegmentSize, 64 COMPILER1_AND_COMPILER2_PRESENT(+64)); // Tiered compilation has large code-entry alignment.
define_pd_global(intx, CodeEntryAlignment, 64);
define_pd_global(intx, OptoLoopAlignment, 16);
define_pd_global(intx, InlineFrequencyCount, 100);
#define DEFAULT_STACK_YELLOW_PAGES (2)
#define DEFAULT_STACK_RED_PAGES (1)

View File

@ -53,7 +53,6 @@ define_pd_global(intx, StackRedPages, DEFAULT_STACK_RED_PAGES);
define_pd_global(intx, StackShadowPages, DEFAULT_STACK_SHADOW_PAGES);
define_pd_global(intx, StackReservedPages, DEFAULT_STACK_RESERVED_PAGES);
define_pd_global(intx, InlineFrequencyCount, 50);
#if defined(COMPILER1) || defined(COMPILER2)
define_pd_global(intx, InlineSmallCode, 1500);
#endif

View File

@ -58,7 +58,6 @@ define_pd_global(intx, StackReservedPages, DEFAULT_STACK_RESERVED_PAGES);
define_pd_global(uintx, CodeCacheSegmentSize, 128);
define_pd_global(intx, CodeEntryAlignment, 128);
define_pd_global(intx, OptoLoopAlignment, 16);
define_pd_global(intx, InlineFrequencyCount, 100);
define_pd_global(intx, InlineSmallCode, 1500);
// Flags for template interpreter.

View File

@ -43,7 +43,6 @@ define_pd_global(uintx, CodeCacheSegmentSize, 256);
// code size significantly by padding nops between IVC and second UEP.
define_pd_global(intx, CodeEntryAlignment, 64);
define_pd_global(intx, OptoLoopAlignment, 2);
define_pd_global(intx, InlineFrequencyCount, 100);
define_pd_global(intx, InlineSmallCode, 2000);
#define DEFAULT_STACK_YELLOW_PAGES (2)

View File

@ -49,7 +49,6 @@ define_pd_global(intx, CodeEntryAlignment, 32);
define_pd_global(intx, CodeEntryAlignment, 16);
#endif // COMPILER2_OR_JVMCI
define_pd_global(intx, OptoLoopAlignment, 16);
define_pd_global(intx, InlineFrequencyCount, 100);
define_pd_global(intx, InlineSmallCode, 1000);
#define DEFAULT_STACK_YELLOW_PAGES (NOT_WINDOWS(2) WINDOWS_ONLY(3))

View File

@ -39,7 +39,6 @@ define_pd_global(bool, UncommonNullCast, true);
define_pd_global(uintx, CodeCacheSegmentSize, 64 COMPILER1_AND_COMPILER2_PRESENT(+64)); // Tiered compilation has large code-entry alignment.
define_pd_global(intx, CodeEntryAlignment, 32);
define_pd_global(intx, OptoLoopAlignment, 16);
define_pd_global(intx, InlineFrequencyCount, 100);
define_pd_global(intx, InlineSmallCode, 1000);
// not used, but must satisfy following constraints:

View File

@ -156,18 +156,17 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
int invoke_count = method()->interpreter_invocation_count();
assert(invoke_count != 0, "require invocation count greater than zero");
int freq = call_site_count / invoke_count;
double freq = (double)call_site_count / (double)invoke_count;
// bump the max size if the call is frequent
if ((freq >= InlineFrequencyRatio) ||
(call_site_count >= InlineFrequencyCount) ||
is_unboxing_method(callee_method, C) ||
is_init_with_ea(callee_method, caller_method, C)) {
max_inline_size = C->freq_inline_size();
if (size <= max_inline_size && TraceFrequencyInlining) {
CompileTask::print_inline_indent(inline_level());
tty->print_cr("Inlined frequent method (freq=%d count=%d):", freq, call_site_count);
tty->print_cr("Inlined frequent method (freq=%lf):", freq);
CompileTask::print_inline_indent(inline_level());
callee_method->print();
tty->cr();

View File

@ -534,6 +534,7 @@ static SpecialFlag const special_jvm_flags[] = {
// -------------- Obsolete Flags - sorted by expired_in --------------
{ "CriticalJNINatives", JDK_Version::jdk(16), JDK_Version::jdk(18), JDK_Version::jdk(19) },
{ "InlineFrequencyCount", JDK_Version::undefined(), JDK_Version::jdk(18), JDK_Version::jdk(19) },
{ "G1RSetRegionEntries", JDK_Version::undefined(), JDK_Version::jdk(18), JDK_Version::jdk(19) },
{ "G1RSetSparseRegionEntries", JDK_Version::undefined(), JDK_Version::jdk(18), JDK_Version::jdk(19) },
{ "AlwaysLockClassLoader", JDK_Version::jdk(17), JDK_Version::jdk(18), JDK_Version::jdk(19) },

View File

@ -1400,14 +1400,8 @@ const intx ObjectAlignmentInBytes = 8;
product(intx, SpecTrapLimitExtraEntries, 3, EXPERIMENTAL, \
"Extra method data trap entries for speculation") \
\
develop(intx, InlineFrequencyRatio, 20, \
product(double, InlineFrequencyRatio, 0.25, DIAGNOSTIC, \
"Ratio of call site execution to caller method invocation") \
range(0, max_jint) \
\
product_pd(intx, InlineFrequencyCount, DIAGNOSTIC, \
"Count of call site execution necessary to trigger frequent " \
"inlining") \
range(0, max_jint) \
\
develop(intx, InlineThrowCount, 50, \
"Force inlining of interpreted methods that throw this often") \

View File

@ -36,7 +36,7 @@
import jdk.test.lib.Platform;
public class IntxTest {
private static final String FLAG_NAME = "OnStackReplacePercentage";
private static final String FLAG_DEBUG_NAME = "InlineFrequencyCount";
private static final String FLAG_DEBUG_NAME = "BciProfileWidth";
private static final long COMPILE_THRESHOLD = VmFlagTest.WHITE_BOX.getIntxVMFlag("CompileThreshold");
private static final Long[] TESTS = {0L, 100L, (long)(Integer.MAX_VALUE>>3)*100L};