1.1 --- a/src/share/vm/opto/bytecodeInfo.cpp Fri Dec 21 10:27:49 2012 -0800 1.2 +++ b/src/share/vm/opto/bytecodeInfo.cpp Sun Dec 23 17:08:22 2012 +0100 1.3 @@ -46,7 +46,8 @@ 1.4 _method(callee), 1.5 _site_invoke_ratio(site_invoke_ratio), 1.6 _max_inline_level(max_inline_level), 1.7 - _count_inline_bcs(method()->code_size_for_inlining()) 1.8 + _count_inline_bcs(method()->code_size_for_inlining()), 1.9 + _subtrees(c->comp_arena(), 2, 0, NULL) 1.10 { 1.11 NOT_PRODUCT(_count_inlines = 0;) 1.12 if (_caller_jvms != NULL) { 1.13 @@ -209,16 +210,18 @@ 1.14 if ( callee_method->dont_inline()) return "don't inline by annotation"; 1.15 if ( callee_method->has_unloaded_classes_in_signature()) return "unloaded signature classes"; 1.16 1.17 - if (callee_method->force_inline() || callee_method->should_inline()) { 1.18 + if (callee_method->should_inline()) { 1.19 // ignore heuristic controls on inlining 1.20 return NULL; 1.21 } 1.22 1.23 // Now perform checks which are heuristic 1.24 1.25 - if (callee_method->has_compiled_code() && 1.26 - callee_method->instructions_size() > InlineSmallCode) { 1.27 + if (!callee_method->force_inline()) { 1.28 + if (callee_method->has_compiled_code() && 1.29 + callee_method->instructions_size() > InlineSmallCode) { 1.30 return "already compiled into a big method"; 1.31 + } 1.32 } 1.33 1.34 // don't inline exception code unless the top method belongs to an 1.35 @@ -277,12 +280,15 @@ 1.36 //-----------------------------try_to_inline----------------------------------- 1.37 // return NULL if ok, reason for not inlining otherwise 1.38 // Relocated from "InliningClosure::try_to_inline" 1.39 -const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) { 1.40 - 1.41 +const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result, bool& should_delay) { 1.42 // Old algorithm had funny accumulating BC-size counters 1.43 if (UseOldInlining && ClipInlining 1.44 && (int)count_inline_bcs() >= DesiredMethodLimit) { 1.45 - return "size > DesiredMethodLimit"; 1.46 + if (!callee_method->force_inline() || !IncrementalInline) { 1.47 + return "size > DesiredMethodLimit"; 1.48 + } else if (!C->inlining_incrementally()) { 1.49 + should_delay = true; 1.50 + } 1.51 } 1.52 1.53 const char *msg = NULL; 1.54 @@ -303,8 +309,13 @@ 1.55 if (callee_method->code_size() > MaxTrivialSize) { 1.56 1.57 // don't inline into giant methods 1.58 - if (C->unique() > (uint)NodeCountInliningCutoff) { 1.59 - return "NodeCountInliningCutoff"; 1.60 + if (C->over_inlining_cutoff()) { 1.61 + if ((!callee_method->force_inline() && !caller_method->is_compiled_lambda_form()) 1.62 + || !IncrementalInline) { 1.63 + return "NodeCountInliningCutoff"; 1.64 + } else { 1.65 + should_delay = true; 1.66 + } 1.67 } 1.68 1.69 if ((!UseInterpreter || CompileTheWorld) && 1.70 @@ -323,7 +334,11 @@ 1.71 return "not an accessor"; 1.72 } 1.73 if (inline_level() > _max_inline_level) { 1.74 - return "inlining too deep"; 1.75 + if (!callee_method->force_inline() || !IncrementalInline) { 1.76 + return "inlining too deep"; 1.77 + } else if (!C->inlining_incrementally()) { 1.78 + should_delay = true; 1.79 + } 1.80 } 1.81 1.82 // detect direct and indirect recursive inlining 1.83 @@ -348,7 +363,11 @@ 1.84 1.85 if (UseOldInlining && ClipInlining 1.86 && (int)count_inline_bcs() + size >= DesiredMethodLimit) { 1.87 - return "size > DesiredMethodLimit"; 1.88 + if (!callee_method->force_inline() || !IncrementalInline) { 1.89 + return "size > DesiredMethodLimit"; 1.90 + } else if (!C->inlining_incrementally()) { 1.91 + should_delay = true; 1.92 + } 1.93 } 1.94 1.95 // ok, inline this method 1.96 @@ -413,8 +432,9 @@ 1.97 } 1.98 1.99 //------------------------------ok_to_inline----------------------------------- 1.100 -WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallProfile& profile, WarmCallInfo* initial_wci) { 1.101 +WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallProfile& profile, WarmCallInfo* initial_wci, bool& should_delay) { 1.102 assert(callee_method != NULL, "caller checks for optimized virtual!"); 1.103 + assert(!should_delay, "should be initialized to false"); 1.104 #ifdef ASSERT 1.105 // Make sure the incoming jvms has the same information content as me. 1.106 // This means that we can eventually make this whole class AllStatic. 1.107 @@ -444,7 +464,7 @@ 1.108 1.109 // Check if inlining policy says no. 1.110 WarmCallInfo wci = *(initial_wci); 1.111 - failure_msg = try_to_inline(callee_method, caller_method, caller_bci, profile, &wci); 1.112 + failure_msg = try_to_inline(callee_method, caller_method, caller_bci, profile, &wci, should_delay); 1.113 if (failure_msg != NULL && C->log() != NULL) { 1.114 C->log()->inline_fail(failure_msg); 1.115 }