src/share/vm/opto/bytecodeInfo.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/opto/bytecodeInfo.cpp	Tue May 10 00:41:38 2011
--- new/src/share/vm/opto/bytecodeInfo.cpp	Tue May 10 00:41:37 2011

*** 87,97 **** --- 87,97 ---- caller_method->holder()->is_subclass_of(callee_method->holder())) ); } // positive filter: should send be inlined? returns NULL, if yes, or rejection msg ! const char* InlineTree::shouldInline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) const { ! const char* InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) const { // Allows targeted inlining if(callee_method->should_inline()) { *wci_result = *(WarmCallInfo::always_hot()); if (PrintInlining && Verbose) { CompileTask::print_inline_indent(inline_depth());
*** 100,110 **** --- 100,109 ---- return NULL; } // positive filter: should send be inlined? returns NULL (--> yes) // or rejection msg int max_size = C->max_inline_size(); int size = callee_method->code_size(); // Check for too many throws (and not too huge) if(callee_method->interpreter_throwout_count() > InlineThrowCount && size < InlineThrowMaxSize ) {
*** 118,162 **** --- 117,179 ---- if (!UseOldInlining) { return NULL; // size and frequency are represented in a new way } + int default_max_inline_size = C->max_inline_size(); + int inline_small_code_size = InlineSmallCode / 4; + int max_inline_size = default_max_inline_size; + int call_site_count = method()->scale_count(profile.count()); int invoke_count = method()->interpreter_invocation_count(); assert( invoke_count != 0, "Require invokation count greater than zero"); int freq = call_site_count/invoke_count; + + // Bytecoded method handle adapters do not have interpreter + // profiling data but only made up MDO data. Get the counter from + // there. + if (caller_method->is_method_handle_adapter()) { + assert(method()->method_data_or_null(), "must have an MDO"); + ciMethodData* mdo = method()->method_data(); + ciProfileData* mha_profile = mdo->bci_to_data(caller_bci); + assert(mha_profile, "must exist"); + CounterData* cd = mha_profile->as_CounterData(); + invoke_count = cd->count(); + call_site_count = invoke_count; // use the same value + } + + assert(invoke_count != 0, "require invocation count greater than zero"); + int freq = call_site_count / invoke_count; // bump the max size if the call is frequent if ((freq >= InlineFrequencyRatio) || (call_site_count >= InlineFrequencyCount) || is_init_with_ea(callee_method, caller_method, C)) { ! max_size = C->freq_inline_size(); ! if (size <= max_size && TraceFrequencyInlining) { ! max_inline_size = C->freq_inline_size(); ! if (size <= max_inline_size && TraceFrequencyInlining) { CompileTask::print_inline_indent(inline_depth()); tty->print_cr("Inlined frequent method (freq=%d count=%d):", freq, call_site_count); CompileTask::print_inline_indent(inline_depth()); callee_method->print(); tty->cr(); } } else { // Not hot. Check for medium-sized pre-existing nmethod at cold sites. if (callee_method->has_compiled_code() && ! callee_method->instructions_size(CompLevel_full_optimization) > InlineSmallCode/4) ! callee_method->instructions_size(CompLevel_full_optimization) > inline_small_code_size) return "already compiled into a medium method"; } ! if (size > max_size) { ! if (max_size > C->max_inline_size()) ! if (size > max_inline_size) { ! if (max_inline_size > default_max_inline_size) return "hot method too big"; return "too big"; } return NULL; } // negative filter: should send NOT be inlined? returns NULL, ok to inline, or rejection msg ! const char* InlineTree::shouldNotInline(ciMethod *callee_method, ciMethod* caller_method, WarmCallInfo* wci_result) const { ! const char* InlineTree::should_not_inline(ciMethod *callee_method, ciMethod* caller_method, WarmCallInfo* wci_result) const { // negative filter: should send NOT be inlined? returns NULL (--> inline) or rejection msg if (!UseOldInlining) { const char* fail = NULL; if (callee_method->is_abstract()) fail = "abstract method"; // note: we allow ik->is_abstract()
*** 267,284 **** --- 284,300 ---- && (int)count_inline_bcs() >= DesiredMethodLimit) { return "size > DesiredMethodLimit"; } const char *msg = NULL; if ((msg = shouldInline(callee_method, caller_method, caller_bci, profile, wci_result)) != NULL) { + msg = should_inline(callee_method, caller_method, caller_bci, profile, wci_result); + if (msg != NULL) return msg; } if ((msg = shouldNotInline(callee_method, caller_method, wci_result)) != NULL) { + + msg = should_not_inline(callee_method, caller_method, wci_result); + if (msg != NULL) return msg; } if (InlineAccessors && callee_method->is_accessor()) { // accessor methods are not subject to any of the following limits. return NULL; }
*** 490,502 **** --- 506,517 ---- new_depth_adjust -= 1; // don't count actions in MH or indy adapter frames else if (callee_method->is_method_handle_invoke()) { new_depth_adjust -= 1; // don't count method handle calls from java.lang.invoke implem } if (new_depth_adjust != 0 && PrintInlining) { ! stringStream nm1; caller_jvms->method()->print_name(&nm1); ! stringStream nm2; callee_method->print_name(&nm2); tty->print_cr("discounting inlining depth from %s to %s", nm1.base(), nm2.base()); ! CompileTask::print_inline_indent(inline_depth()); ! tty->print_cr(" \\-> discounting inline depth"); } if (new_depth_adjust != 0 && C->log()) { int id1 = C->log()->identify(caller_jvms->method()); int id2 = C->log()->identify(callee_method); C->log()->elem("inline_depth_discount caller='%d' callee='%d'", id1, id2);

src/share/vm/opto/bytecodeInfo.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File