Mercurial > hg > truffle
comparison src/share/vm/opto/bytecodeInfo.cpp @ 10408:836a62f43af9
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 19 Jun 2013 10:45:56 +0200 |
parents | b9a918201d47 1da5d70655e9 |
children | 6b0fd0964b87 |
comparison
equal
deleted
inserted
replaced
10086:e0fb8a213650 | 10408:836a62f43af9 |
---|---|
83 { | 83 { |
84 NOT_PRODUCT(_count_inlines = 0;) | 84 NOT_PRODUCT(_count_inlines = 0;) |
85 assert(!UseOldInlining, "do not use for old stuff"); | 85 assert(!UseOldInlining, "do not use for old stuff"); |
86 } | 86 } |
87 | 87 |
88 /** | |
89 * Return true when EA is ON and a java constructor is called or | |
90 * a super constructor is called from an inlined java constructor. | |
91 * Also return true for boxing methods. | |
92 */ | |
88 static bool is_init_with_ea(ciMethod* callee_method, | 93 static bool is_init_with_ea(ciMethod* callee_method, |
89 ciMethod* caller_method, Compile* C) { | 94 ciMethod* caller_method, Compile* C) { |
90 // True when EA is ON and a java constructor is called or | 95 if (!C->do_escape_analysis() || !EliminateAllocations) { |
91 // a super constructor is called from an inlined java constructor. | 96 return false; // EA is off |
92 return C->do_escape_analysis() && EliminateAllocations && | 97 } |
93 ( callee_method->is_initializer() || | 98 if (callee_method->is_initializer()) { |
94 (caller_method->is_initializer() && | 99 return true; // constuctor |
95 caller_method != C->method() && | 100 } |
96 caller_method->holder()->is_subclass_of(callee_method->holder())) | 101 if (caller_method->is_initializer() && |
97 ); | 102 caller_method != C->method() && |
103 caller_method->holder()->is_subclass_of(callee_method->holder())) { | |
104 return true; // super constructor is called from inlined constructor | |
105 } | |
106 if (C->eliminate_boxing() && callee_method->is_boxing_method()) { | |
107 return true; | |
108 } | |
109 return false; | |
110 } | |
111 | |
112 /** | |
113 * Force inlining unboxing accessor. | |
114 */ | |
115 static bool is_unboxing_method(ciMethod* callee_method, Compile* C) { | |
116 return C->eliminate_boxing() && callee_method->is_unboxing_method(); | |
98 } | 117 } |
99 | 118 |
100 // positive filter: should callee be inlined? | 119 // positive filter: should callee be inlined? |
101 bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method, | 120 bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method, |
102 int caller_bci, ciCallProfile& profile, | 121 int caller_bci, ciCallProfile& profile, |
142 int freq = call_site_count / invoke_count; | 161 int freq = call_site_count / invoke_count; |
143 | 162 |
144 // bump the max size if the call is frequent | 163 // bump the max size if the call is frequent |
145 if ((freq >= InlineFrequencyRatio) || | 164 if ((freq >= InlineFrequencyRatio) || |
146 (call_site_count >= InlineFrequencyCount) || | 165 (call_site_count >= InlineFrequencyCount) || |
166 is_unboxing_method(callee_method, C) || | |
147 is_init_with_ea(callee_method, caller_method, C)) { | 167 is_init_with_ea(callee_method, caller_method, C)) { |
148 | 168 |
149 max_inline_size = C->freq_inline_size(); | 169 max_inline_size = C->freq_inline_size(); |
150 if (size <= max_inline_size && TraceFrequencyInlining) { | 170 if (size <= max_inline_size && TraceFrequencyInlining) { |
151 CompileTask::print_inline_indent(inline_level()); | 171 CompileTask::print_inline_indent(inline_level()); |
239 if (callee_method->should_not_inline()) { | 259 if (callee_method->should_not_inline()) { |
240 set_msg("disallowed by CompilerOracle"); | 260 set_msg("disallowed by CompilerOracle"); |
241 return false; | 261 return false; |
242 } | 262 } |
243 | 263 |
264 if (callee_method->should_not_inline()) { | |
265 set_msg("disallowed by CompilerOracle"); | |
266 return true; | |
267 } | |
268 | |
269 #ifndef PRODUCT | |
270 if (ciReplay::should_not_inline(callee_method)) { | |
271 set_msg("disallowed by ciReplay"); | |
272 return true; | |
273 } | |
274 #endif | |
275 | |
244 // Now perform checks which are heuristic | 276 // Now perform checks which are heuristic |
277 | |
278 if (is_unboxing_method(callee_method, C)) { | |
279 // Inline unboxing methods. | |
280 return false; | |
281 } | |
245 | 282 |
246 if (!callee_method->force_inline()) { | 283 if (!callee_method->force_inline()) { |
247 if (callee_method->has_compiled_code() && | 284 if (callee_method->has_compiled_code() && |
248 callee_method->instructions_size() > InlineSmallCode) { | 285 callee_method->instructions_size() > InlineSmallCode) { |
249 set_msg("already compiled into a big method"); | 286 set_msg("already compiled into a big method"); |
262 set_msg("exception method"); | 299 set_msg("exception method"); |
263 return true; | 300 return true; |
264 } | 301 } |
265 } | 302 } |
266 | 303 |
267 if (callee_method->should_not_inline()) { | |
268 set_msg("disallowed by CompilerOracle"); | |
269 return true; | |
270 } | |
271 | |
272 #ifndef PRODUCT | |
273 if (ciReplay::should_not_inline(callee_method)) { | |
274 set_msg("disallowed by ciReplay"); | |
275 return true; | |
276 } | |
277 #endif | |
278 | |
279 if (UseStringCache) { | 304 if (UseStringCache) { |
280 // Do not inline StringCache::profile() method used only at the beginning. | 305 // Do not inline StringCache::profile() method used only at the beginning. |
281 if (callee_method->name() == ciSymbol::profile_name() && | 306 if (callee_method->name() == ciSymbol::profile_name() && |
282 callee_method->holder()->name() == ciSymbol::java_lang_StringCache()) { | 307 callee_method->holder()->name() == ciSymbol::java_lang_StringCache()) { |
283 set_msg("profiling method"); | 308 set_msg("profiling method"); |
298 set_msg("never executed"); | 323 set_msg("never executed"); |
299 return true; | 324 return true; |
300 } | 325 } |
301 | 326 |
302 if (is_init_with_ea(callee_method, caller_method, C)) { | 327 if (is_init_with_ea(callee_method, caller_method, C)) { |
303 | |
304 // Escape Analysis: inline all executed constructors | 328 // Escape Analysis: inline all executed constructors |
305 | 329 return false; |
306 } else if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold, | 330 } else if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold, |
307 CompileThreshold >> 1))) { | 331 CompileThreshold >> 1))) { |
308 set_msg("executed < MinInliningThreshold times"); | 332 set_msg("executed < MinInliningThreshold times"); |
309 return true; | 333 return true; |
310 } | 334 } |