comparison src/share/vm/opto/bytecodeInfo.cpp @ 10278:6f3fd5150b67

6934604: enable parts of EliminateAutoBox by default Summary: Resurrected autobox elimination code and enabled part of it by default. Reviewed-by: roland, twisti
author kvn
date Wed, 08 May 2013 15:08:01 -0700
parents 80208f353616
children 1da5d70655e9
comparison
equal deleted inserted replaced
10277:aabf54ccedb1 10278:6f3fd5150b67
95 caller_method != C->method() && 95 caller_method != C->method() &&
96 caller_method->holder()->is_subclass_of(callee_method->holder())) 96 caller_method->holder()->is_subclass_of(callee_method->holder()))
97 ); 97 );
98 } 98 }
99 99
100 static bool is_unboxing_method(ciMethod* callee_method, Compile* C) {
101 // Force inlining unboxing accessor.
102 return C->eliminate_boxing() && callee_method->is_unboxing_method();
103 }
104
100 // positive filter: should callee be inlined? 105 // positive filter: should callee be inlined?
101 bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method, 106 bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
102 int caller_bci, ciCallProfile& profile, 107 int caller_bci, ciCallProfile& profile,
103 WarmCallInfo* wci_result) { 108 WarmCallInfo* wci_result) {
104 // Allows targeted inlining 109 // Allows targeted inlining
142 int freq = call_site_count / invoke_count; 147 int freq = call_site_count / invoke_count;
143 148
144 // bump the max size if the call is frequent 149 // bump the max size if the call is frequent
145 if ((freq >= InlineFrequencyRatio) || 150 if ((freq >= InlineFrequencyRatio) ||
146 (call_site_count >= InlineFrequencyCount) || 151 (call_site_count >= InlineFrequencyCount) ||
152 is_unboxing_method(callee_method, C) ||
147 is_init_with_ea(callee_method, caller_method, C)) { 153 is_init_with_ea(callee_method, caller_method, C)) {
148 154
149 max_inline_size = C->freq_inline_size(); 155 max_inline_size = C->freq_inline_size();
150 if (size <= max_inline_size && TraceFrequencyInlining) { 156 if (size <= max_inline_size && TraceFrequencyInlining) {
151 CompileTask::print_inline_indent(inline_level()); 157 CompileTask::print_inline_indent(inline_level());
235 if (callee_method->should_inline()) { 241 if (callee_method->should_inline()) {
236 set_msg("force inline by CompilerOracle"); 242 set_msg("force inline by CompilerOracle");
237 return false; 243 return false;
238 } 244 }
239 245
246 if (callee_method->should_not_inline()) {
247 set_msg("disallowed by CompilerOracle");
248 return true;
249 }
250
251 #ifndef PRODUCT
252 if (ciReplay::should_not_inline(callee_method)) {
253 set_msg("disallowed by ciReplay");
254 return true;
255 }
256 #endif
257
240 // Now perform checks which are heuristic 258 // Now perform checks which are heuristic
259
260 if (is_unboxing_method(callee_method, C)) {
261 // Inline unboxing methods.
262 return false;
263 }
241 264
242 if (!callee_method->force_inline()) { 265 if (!callee_method->force_inline()) {
243 if (callee_method->has_compiled_code() && 266 if (callee_method->has_compiled_code() &&
244 callee_method->instructions_size() > InlineSmallCode) { 267 callee_method->instructions_size() > InlineSmallCode) {
245 set_msg("already compiled into a big method"); 268 set_msg("already compiled into a big method");
258 set_msg("exception method"); 281 set_msg("exception method");
259 return true; 282 return true;
260 } 283 }
261 } 284 }
262 285
263 if (callee_method->should_not_inline()) {
264 set_msg("disallowed by CompilerOracle");
265 return true;
266 }
267
268 #ifndef PRODUCT
269 if (ciReplay::should_not_inline(callee_method)) {
270 set_msg("disallowed by ciReplay");
271 return true;
272 }
273 #endif
274
275 if (UseStringCache) { 286 if (UseStringCache) {
276 // Do not inline StringCache::profile() method used only at the beginning. 287 // Do not inline StringCache::profile() method used only at the beginning.
277 if (callee_method->name() == ciSymbol::profile_name() && 288 if (callee_method->name() == ciSymbol::profile_name() &&
278 callee_method->holder()->name() == ciSymbol::java_lang_StringCache()) { 289 callee_method->holder()->name() == ciSymbol::java_lang_StringCache()) {
279 set_msg("profiling method"); 290 set_msg("profiling method");
294 set_msg("never executed"); 305 set_msg("never executed");
295 return true; 306 return true;
296 } 307 }
297 308
298 if (is_init_with_ea(callee_method, caller_method, C)) { 309 if (is_init_with_ea(callee_method, caller_method, C)) {
299
300 // Escape Analysis: inline all executed constructors 310 // Escape Analysis: inline all executed constructors
301 311 return false;
302 } else if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold, 312 } else if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold,
303 CompileThreshold >> 1))) { 313 CompileThreshold >> 1))) {
304 set_msg("executed < MinInliningThreshold times"); 314 set_msg("executed < MinInliningThreshold times");
305 return true; 315 return true;
306 } 316 }