25
25
#include " precompiled.hpp"
26
26
#include " ci/ciReplay.hpp"
27
27
#include " classfile/vmSymbols.hpp"
28
+ #include " compiler/compilationPolicy.hpp"
28
29
#include " compiler/compileBroker.hpp"
29
30
#include " compiler/compilerEvent.hpp"
30
31
#include " compiler/compileLog.hpp"
@@ -152,8 +153,8 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
152
153
int inline_small_code_size = InlineSmallCode / 4 ;
153
154
int max_inline_size = default_max_inline_size;
154
155
155
- int call_site_count = method () ->scale_count (profile.count ());
156
- int invoke_count = method () ->interpreter_invocation_count ();
156
+ int call_site_count = caller_method ->scale_count (profile.count ());
157
+ int invoke_count = caller_method ->interpreter_invocation_count ();
157
158
158
159
assert (invoke_count != 0 , " require invocation count greater than zero" );
159
160
double freq = (double )call_site_count / (double )invoke_count;
@@ -192,10 +193,8 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
192
193
193
194
194
195
// negative filter: should callee NOT be inlined?
195
- bool InlineTree::should_not_inline (ciMethod *callee_method,
196
- ciMethod* caller_method,
197
- JVMState* jvms) {
198
-
196
+ bool InlineTree::should_not_inline (ciMethod* callee_method, ciMethod* caller_method,
197
+ int caller_bci, ciCallProfile& profile) {
199
198
const char * fail_msg = NULL ;
200
199
201
200
// First check all inlining restrictions which are required for correctness
@@ -233,7 +232,6 @@ bool InlineTree::should_not_inline(ciMethod *callee_method,
233
232
}
234
233
235
234
#ifndef PRODUCT
236
- int caller_bci = jvms->bci ();
237
235
int inline_depth = inline_level ()+1 ;
238
236
if (ciReplay::should_inline (C->replay_inline_data (), callee_method, caller_bci, inline_depth)) {
239
237
set_msg (" force inline by ciReplay" );
@@ -289,7 +287,6 @@ bool InlineTree::should_not_inline(ciMethod *callee_method,
289
287
290
288
// don't use counts with -Xcomp
291
289
if (UseInterpreter) {
292
-
293
290
if (!callee_method->has_compiled_code () &&
294
291
!callee_method->was_executed_more_than (0 )) {
295
292
set_msg (" never executed" );
@@ -299,15 +296,23 @@ bool InlineTree::should_not_inline(ciMethod *callee_method,
299
296
if (is_init_with_ea (callee_method, caller_method, C)) {
300
297
// Escape Analysis: inline all executed constructors
301
298
return false ;
302
- } else {
303
- intx counter_high_value;
304
- // Tiered compilation uses a different "high value" than non-tiered compilation.
305
- // Determine the right value to use.
306
- if (TieredCompilation) {
307
- counter_high_value = InvocationCounter::count_limit / 2 ;
308
- } else {
309
- counter_high_value = CompileThreshold / 2 ;
299
+ }
300
+
301
+ if (MinInlineFrequencyRatio > 0 ) {
302
+ int call_site_count = caller_method->scale_count (profile.count ());
303
+ int invoke_count = caller_method->interpreter_invocation_count ();
304
+ assert (invoke_count != 0 , " require invocation count greater than zero" );
305
+ double freq = (double )call_site_count / (double )invoke_count;
306
+ double min_freq = MAX2 (MinInlineFrequencyRatio, 1.0 / CompilationPolicy::min_invocations ());
307
+
308
+ if (freq < min_freq) {
309
+ set_msg (" low call site frequency" );
310
+ return true ;
310
311
}
312
+ }
313
+
314
+ if (MinInliningThreshold > 0 ) { // Deprecated heuristic
315
+ intx counter_high_value = TieredCompilation ? InvocationCounter::count_limit / 2 : CompileThreshold / 2 ;
311
316
if (!callee_method->was_executed_more_than (MIN2 (MinInliningThreshold, counter_high_value))) {
312
317
set_msg (" executed < MinInliningThreshold times" );
313
318
return true ;
@@ -367,7 +372,7 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method,
367
372
if (!should_inline (callee_method, caller_method, caller_bci, profile)) {
368
373
return false ;
369
374
}
370
- if (should_not_inline (callee_method, caller_method, jvms )) {
375
+ if (should_not_inline (callee_method, caller_method, caller_bci, profile )) {
371
376
return false ;
372
377
}
373
378
0 commit comments