308 // Determine the right value to use. 309 if (TieredCompilation) { 310 counter_high_value = InvocationCounter::count_limit / 2; 311 } else { 312 counter_high_value = CompileThreshold / 2; 313 } 314 if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold, counter_high_value))) { 315 set_msg("executed < MinInliningThreshold times"); 316 return true; 317 } 318 } 319 } 320 321 return false; 322 } 323 324 bool InlineTree::is_not_reached(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile) { 325 if (!UseInterpreter) { 326 return false; // -Xcomp 327 } 328 if (profile.count() > 0) { 329 return false; // reachable according to profile 330 } 331 if (!callee_method->was_executed_more_than(0)) { 332 return true; // callee was never executed 333 } 334 if (caller_method->is_not_reached(caller_bci)) { 335 return true; // call site not resolved 336 } 337 if (profile.count() == -1) { 338 return false; // immature profile; optimistically treat as reached 339 } 340 assert(profile.count() == 0, "sanity"); 341 342 // Profile info is scarce. 343 // Try to guess: check if the call site belongs to a start block. 344 // Call sites in a start block should be reachable if no exception is thrown earlier. 345 ciMethodBlocks* caller_blocks = caller_method->get_method_blocks(); 346 bool is_start_block = caller_blocks->block_containing(caller_bci)->start_bci() == 0; 347 if (is_start_block) { 348 return false; // treat the call reached as part of start block 349 } 350 return true; // give up and treat the call site as not reached 351 } 352 353 //-----------------------------try_to_inline----------------------------------- 354 // return true if ok 355 // Relocated from "InliningClosure::try_to_inline" 356 bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, 357 int caller_bci, JVMState* jvms, ciCallProfile& profile, 358 WarmCallInfo* wci_result, bool& should_delay) { 359 360 if (ClipInlining && (int)count_inline_bcs() >= DesiredMethodLimit) { 361 if (!callee_method->force_inline() || !IncrementalInline) { 362 set_msg("size > DesiredMethodLimit"); 363 return false; 364 } else if (!C->inlining_incrementally()) { 365 should_delay = true; 366 } 367 } 368 | 308 // Determine the right value to use. 309 if (TieredCompilation) { 310 counter_high_value = InvocationCounter::count_limit / 2; 311 } else { 312 counter_high_value = CompileThreshold / 2; 313 } 314 if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold, counter_high_value))) { 315 set_msg("executed < MinInliningThreshold times"); 316 return true; 317 } 318 } 319 } 320 321 return false; 322 } 323 324 bool InlineTree::is_not_reached(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile) { 325 if (!UseInterpreter) { 326 return false; // -Xcomp 327 } 328 329 // Get the snapshot of profile.count() 330 int profile_count = profile.count(); 331 if (profile_count > 0) { 332 return false; // reachable according to profile 333 } 334 if (!callee_method->was_executed_more_than(0)) { 335 return true; // callee was never executed 336 } 337 if (caller_method->is_not_reached(caller_bci)) { 338 return true; // call site not resolved 339 } 340 if (profile_count <= -1) { 341 return false; // immature or typecheck profile; optimistically treat as reached 342 } 343 assert(profile_count == 0, "sanity"); 344 345 // Profile info is scarce. 346 // Try to guess: check if the call site belongs to a start block. 347 // Call sites in a start block should be reachable if no exception is thrown earlier. 348 ciMethodBlocks* caller_blocks = caller_method->get_method_blocks(); 349 bool is_start_block = caller_blocks->block_containing(caller_bci)->start_bci() == 0; 350 if (is_start_block) { 351 return false; // treat the call reached as part of start block 352 } 353 354 // Re-sample the profile.count() before giving up 355 if (profile.count() > 0) { 356 return false; 357 } 358 return true; // give up and treat the call site as not reached 359 } 360 361 //-----------------------------try_to_inline----------------------------------- 362 // return true if ok 363 // Relocated from "InliningClosure::try_to_inline" 364 bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, 365 int caller_bci, JVMState* jvms, ciCallProfile& profile, 366 WarmCallInfo* wci_result, bool& should_delay) { 367 368 if (ClipInlining && (int)count_inline_bcs() >= DesiredMethodLimit) { 369 if (!callee_method->force_inline() || !IncrementalInline) { 370 set_msg("size > DesiredMethodLimit"); 371 return false; 372 } else if (!C->inlining_incrementally()) { 373 should_delay = true; 374 } 375 } 376 |