< prev index next >

src/hotspot/share/opto/bytecodeInfo.cpp

Print this page




 304       return false;
 305     } else {
 306       intx counter_high_value;
 307       // Tiered compilation uses a different "high value" than non-tiered compilation.
 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 //-----------------------------try_to_inline-----------------------------------
 325 // return true if ok
 326 // Relocated from "InliningClosure::try_to_inline"
 327 bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method,
 328                                int caller_bci, JVMState* jvms, ciCallProfile& profile,
 329                                WarmCallInfo* wci_result, bool& should_delay) {
 330 
 331   if (ClipInlining && (int)count_inline_bcs() >= DesiredMethodLimit) {
 332     if (!callee_method->force_inline() || !IncrementalInline) {
 333       set_msg("size > DesiredMethodLimit");
 334       return false;
 335     } else if (!C->inlining_incrementally()) {
 336       should_delay = true;
 337     }
 338   }
 339 
 340   _forced_inline = false; // Reset
 341   if (!should_inline(callee_method, caller_method, caller_bci, profile,
 342                      wci_result)) {
 343     return false;


 355   // suppress a few checks for accessors and trivial methods
 356   if (callee_method->code_size() > MaxTrivialSize) {
 357 
 358     // don't inline into giant methods
 359     if (C->over_inlining_cutoff()) {
 360       if ((!callee_method->force_inline() && !caller_method->is_compiled_lambda_form())
 361           || !IncrementalInline) {
 362         set_msg("NodeCountInliningCutoff");
 363         return false;
 364       } else {
 365         should_delay = true;
 366       }
 367     }
 368 
 369     if (!UseInterpreter &&
 370         is_init_with_ea(callee_method, caller_method, C)) {
 371       // Escape Analysis stress testing when running Xcomp:
 372       // inline constructors even if they are not reached.
 373     } else if (forced_inline()) {
 374       // Inlining was forced by CompilerOracle, ciReplay or annotation
 375     } else if (profile.count() == 0) {
 376       // don't inline unreached call sites
 377        set_msg("call site not reached");
 378        return false;
 379     }
 380   }
 381 
 382   if (!C->do_inlining() && InlineAccessors) {
 383     set_msg("not an accessor");
 384     return false;
 385   }
 386 
 387   // Limit inlining depth in case inlining is forced or
 388   // _max_inline_level was increased to compensate for lambda forms.
 389   if (inline_level() > MaxForceInlineLevel) {
 390     set_msg("MaxForceInlineLevel");
 391     return false;
 392   }
 393   if (inline_level() > _max_inline_level) {
 394     if (!callee_method->force_inline() || !IncrementalInline) {
 395       set_msg("inlining too deep");




 304       return false;
 305     } else {
 306       intx counter_high_value;
 307       // Tiered compilation uses a different "high value" than non-tiered compilation.
 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)  return false; // -Xcomp
 326 
 327   if (profile.count() > 0)   return false; // reachable according to profile
 328 
 329   if (!callee_method->was_executed_more_than(0))  return true; // callee was never executed
 330 
 331   if (caller_method->is_not_reached(caller_bci))  return true; // call site not resolved
 332 
 333   if (profile.count() == -1) {
 334     return false; // immature profile; optimistically treat as reached
 335   }
 336   assert(profile.count() == 0, "sanity");
 337 
 338   // Profile info is scarce.
 339   // Try to guess: check if the call site belongs to a start block.
 340   // Call sites in a start block should be reachable if no exception is thrown earlier.
 341   ciMethodBlocks* caller_blocks = caller_method->get_method_blocks();
 342   bool is_start_block = caller_blocks->block_containing(caller_bci)->start_bci() == 0;
 343   if (is_start_block) {
 344     return false; // treat the call reached as part of start block
 345   }
 346   return true; // give up and treat the call site as not reached
 347 }
 348 
 349 //-----------------------------try_to_inline-----------------------------------
 350 // return true if ok
 351 // Relocated from "InliningClosure::try_to_inline"
 352 bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method,
 353                                int caller_bci, JVMState* jvms, ciCallProfile& profile,
 354                                WarmCallInfo* wci_result, bool& should_delay) {
 355 
 356   if (ClipInlining && (int)count_inline_bcs() >= DesiredMethodLimit) {
 357     if (!callee_method->force_inline() || !IncrementalInline) {
 358       set_msg("size > DesiredMethodLimit");
 359       return false;
 360     } else if (!C->inlining_incrementally()) {
 361       should_delay = true;
 362     }
 363   }
 364 
 365   _forced_inline = false; // Reset
 366   if (!should_inline(callee_method, caller_method, caller_bci, profile,
 367                      wci_result)) {
 368     return false;


 380   // suppress a few checks for accessors and trivial methods
 381   if (callee_method->code_size() > MaxTrivialSize) {
 382 
 383     // don't inline into giant methods
 384     if (C->over_inlining_cutoff()) {
 385       if ((!callee_method->force_inline() && !caller_method->is_compiled_lambda_form())
 386           || !IncrementalInline) {
 387         set_msg("NodeCountInliningCutoff");
 388         return false;
 389       } else {
 390         should_delay = true;
 391       }
 392     }
 393 
 394     if (!UseInterpreter &&
 395         is_init_with_ea(callee_method, caller_method, C)) {
 396       // Escape Analysis stress testing when running Xcomp:
 397       // inline constructors even if they are not reached.
 398     } else if (forced_inline()) {
 399       // Inlining was forced by CompilerOracle, ciReplay or annotation
 400     } else if (is_not_reached(callee_method, caller_method, caller_bci, profile)) {
 401       // don't inline unreached call sites
 402        set_msg("call site not reached");
 403        return false;
 404     }
 405   }
 406 
 407   if (!C->do_inlining() && InlineAccessors) {
 408     set_msg("not an accessor");
 409     return false;
 410   }
 411 
 412   // Limit inlining depth in case inlining is forced or
 413   // _max_inline_level was increased to compensate for lambda forms.
 414   if (inline_level() > MaxForceInlineLevel) {
 415     set_msg("MaxForceInlineLevel");
 416     return false;
 417   }
 418   if (inline_level() > _max_inline_level) {
 419     if (!callee_method->force_inline() || !IncrementalInline) {
 420       set_msg("inlining too deep");


< prev index next >