Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/bytecodeInfo.cpp @ 17672:1419657ed891
8032490: Remove -XX:+-UseOldInlining
Summary: Move the option to obsolete options list, purge the redundant compiler code.
Reviewed-by: kvn, jrose
author | shade |
---|---|
date | Fri, 24 Jan 2014 15:26:56 +0400 |
parents | 849eb7bfceac |
children | d8041d695d19 73c839dda17e |
comparison
equal
deleted
inserted
replaced
17671:de95063c0e34 | 17672:1419657ed891 |
---|---|
61 assert(!caller_jvms->should_reexecute(), "there should be no reexecute bytecode with inlining"); | 61 assert(!caller_jvms->should_reexecute(), "there should be no reexecute bytecode with inlining"); |
62 } | 62 } |
63 assert(_caller_jvms->same_calls_as(caller_jvms), "consistent JVMS"); | 63 assert(_caller_jvms->same_calls_as(caller_jvms), "consistent JVMS"); |
64 assert((caller_tree == NULL ? 0 : caller_tree->stack_depth() + 1) == stack_depth(), "correct (redundant) depth parameter"); | 64 assert((caller_tree == NULL ? 0 : caller_tree->stack_depth() + 1) == stack_depth(), "correct (redundant) depth parameter"); |
65 assert(caller_bci == this->caller_bci(), "correct (redundant) bci parameter"); | 65 assert(caller_bci == this->caller_bci(), "correct (redundant) bci parameter"); |
66 if (UseOldInlining) { | 66 // Update hierarchical counts, count_inline_bcs() and count_inlines() |
67 // Update hierarchical counts, count_inline_bcs() and count_inlines() | 67 InlineTree *caller = (InlineTree *)caller_tree; |
68 InlineTree *caller = (InlineTree *)caller_tree; | 68 for( ; caller != NULL; caller = ((InlineTree *)(caller->caller_tree())) ) { |
69 for( ; caller != NULL; caller = ((InlineTree *)(caller->caller_tree())) ) { | 69 caller->_count_inline_bcs += count_inline_bcs(); |
70 caller->_count_inline_bcs += count_inline_bcs(); | 70 NOT_PRODUCT(caller->_count_inlines++;) |
71 NOT_PRODUCT(caller->_count_inlines++;) | 71 } |
72 } | |
73 } | |
74 } | |
75 | |
76 InlineTree::InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvms, | |
77 float site_invoke_ratio, int max_inline_level) : | |
78 C(c), | |
79 _caller_jvms(caller_jvms), | |
80 _caller_tree(NULL), | |
81 _method(callee_method), | |
82 _site_invoke_ratio(site_invoke_ratio), | |
83 _max_inline_level(max_inline_level), | |
84 _count_inline_bcs(method()->code_size()), | |
85 _msg(NULL) | |
86 { | |
87 #ifndef PRODUCT | |
88 _count_inlines = 0; | |
89 _forced_inline = false; | |
90 #endif | |
91 assert(!UseOldInlining, "do not use for old stuff"); | |
92 } | 72 } |
93 | 73 |
94 /** | 74 /** |
95 * Return true when EA is ON and a java constructor is called or | 75 * Return true when EA is ON and a java constructor is called or |
96 * a super constructor is called from an inlined java constructor. | 76 * a super constructor is called from an inlined java constructor. |
159 } | 139 } |
160 set_msg("many throws"); | 140 set_msg("many throws"); |
161 return true; | 141 return true; |
162 } | 142 } |
163 | 143 |
164 if (!UseOldInlining) { | |
165 set_msg("!UseOldInlining"); | |
166 return true; // size and frequency are represented in a new way | |
167 } | |
168 | |
169 int default_max_inline_size = C->max_inline_size(); | 144 int default_max_inline_size = C->max_inline_size(); |
170 int inline_small_code_size = InlineSmallCode / 4; | 145 int inline_small_code_size = InlineSmallCode / 4; |
171 int max_inline_size = default_max_inline_size; | 146 int max_inline_size = default_max_inline_size; |
172 | 147 |
173 int call_site_count = method()->scale_count(profile.count()); | 148 int call_site_count = method()->scale_count(profile.count()); |
225 fail_msg = "method holder not initialized"; | 200 fail_msg = "method holder not initialized"; |
226 } else if ( callee_method->is_native()) { | 201 } else if ( callee_method->is_native()) { |
227 fail_msg = "native method"; | 202 fail_msg = "native method"; |
228 } else if ( callee_method->dont_inline()) { | 203 } else if ( callee_method->dont_inline()) { |
229 fail_msg = "don't inline by annotation"; | 204 fail_msg = "don't inline by annotation"; |
230 } | |
231 | |
232 if (!UseOldInlining) { | |
233 if (fail_msg != NULL) { | |
234 *wci_result = *(WarmCallInfo::always_cold()); | |
235 set_msg(fail_msg); | |
236 return true; | |
237 } | |
238 | |
239 if (callee_method->has_unloaded_classes_in_signature()) { | |
240 wci_result->set_profit(wci_result->profit() * 0.1); | |
241 } | |
242 | |
243 // don't inline exception code unless the top method belongs to an | |
244 // exception class | |
245 if (callee_method->holder()->is_subclass_of(C->env()->Throwable_klass())) { | |
246 ciMethod* top_method = jvms->caller() != NULL ? jvms->caller()->of_depth(1)->method() : method(); | |
247 if (!top_method->holder()->is_subclass_of(C->env()->Throwable_klass())) { | |
248 wci_result->set_profit(wci_result->profit() * 0.1); | |
249 } | |
250 } | |
251 | |
252 if (callee_method->has_compiled_code() && | |
253 callee_method->instructions_size() > InlineSmallCode) { | |
254 wci_result->set_profit(wci_result->profit() * 0.1); | |
255 // %%% adjust wci_result->size()? | |
256 } | |
257 | |
258 return false; | |
259 } | 205 } |
260 | 206 |
261 // one more inlining restriction | 207 // one more inlining restriction |
262 if (fail_msg == NULL && callee_method->has_unloaded_classes_in_signature()) { | 208 if (fail_msg == NULL && callee_method->has_unloaded_classes_in_signature()) { |
263 fail_msg = "unloaded signature classes"; | 209 fail_msg = "unloaded signature classes"; |
358 // Relocated from "InliningClosure::try_to_inline" | 304 // Relocated from "InliningClosure::try_to_inline" |
359 bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, | 305 bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, |
360 int caller_bci, JVMState* jvms, ciCallProfile& profile, | 306 int caller_bci, JVMState* jvms, ciCallProfile& profile, |
361 WarmCallInfo* wci_result, bool& should_delay) { | 307 WarmCallInfo* wci_result, bool& should_delay) { |
362 | 308 |
363 // Old algorithm had funny accumulating BC-size counters | 309 if (ClipInlining && (int)count_inline_bcs() >= DesiredMethodLimit) { |
364 if (UseOldInlining && ClipInlining | |
365 && (int)count_inline_bcs() >= DesiredMethodLimit) { | |
366 if (!callee_method->force_inline() || !IncrementalInline) { | 310 if (!callee_method->force_inline() || !IncrementalInline) { |
367 set_msg("size > DesiredMethodLimit"); | 311 set_msg("size > DesiredMethodLimit"); |
368 return false; | 312 return false; |
369 } else if (!C->inlining_incrementally()) { | 313 } else if (!C->inlining_incrementally()) { |
370 should_delay = true; | 314 should_delay = true; |
463 } | 407 } |
464 } | 408 } |
465 | 409 |
466 int size = callee_method->code_size_for_inlining(); | 410 int size = callee_method->code_size_for_inlining(); |
467 | 411 |
468 if (UseOldInlining && ClipInlining | 412 if (ClipInlining && (int)count_inline_bcs() + size >= DesiredMethodLimit) { |
469 && (int)count_inline_bcs() + size >= DesiredMethodLimit) { | |
470 if (!callee_method->force_inline() || !IncrementalInline) { | 413 if (!callee_method->force_inline() || !IncrementalInline) { |
471 set_msg("size > DesiredMethodLimit"); | 414 set_msg("size > DesiredMethodLimit"); |
472 return false; | 415 return false; |
473 } else if (!C->inlining_incrementally()) { | 416 } else if (!C->inlining_incrementally()) { |
474 should_delay = true; | 417 should_delay = true; |
582 WarmCallInfo wci = *(initial_wci); | 525 WarmCallInfo wci = *(initial_wci); |
583 bool success = try_to_inline(callee_method, caller_method, caller_bci, | 526 bool success = try_to_inline(callee_method, caller_method, caller_bci, |
584 jvms, profile, &wci, should_delay); | 527 jvms, profile, &wci, should_delay); |
585 | 528 |
586 #ifndef PRODUCT | 529 #ifndef PRODUCT |
587 if (UseOldInlining && InlineWarmCalls | 530 if (InlineWarmCalls && (PrintOpto || C->print_inlining())) { |
588 && (PrintOpto || C->print_inlining())) { | |
589 bool cold = wci.is_cold(); | 531 bool cold = wci.is_cold(); |
590 bool hot = !cold && wci.is_hot(); | 532 bool hot = !cold && wci.is_hot(); |
591 bool old_cold = !success; | 533 bool old_cold = !success; |
592 if (old_cold != cold || (Verbose || WizardMode)) { | 534 if (old_cold != cold || (Verbose || WizardMode)) { |
593 if (msg() == NULL) { | 535 if (msg() == NULL) { |
597 old_cold ? "cold" : "hot", msg()); | 539 old_cold ? "cold" : "hot", msg()); |
598 wci.print(); | 540 wci.print(); |
599 } | 541 } |
600 } | 542 } |
601 #endif | 543 #endif |
602 if (UseOldInlining) { | 544 if (success) { |
603 if (success) { | 545 wci = *(WarmCallInfo::always_hot()); |
604 wci = *(WarmCallInfo::always_hot()); | 546 } else { |
605 } else { | 547 wci = *(WarmCallInfo::always_cold()); |
606 wci = *(WarmCallInfo::always_cold()); | 548 } |
607 } | 549 |
608 } | |
609 if (!InlineWarmCalls) { | 550 if (!InlineWarmCalls) { |
610 if (!wci.is_cold() && !wci.is_hot()) { | 551 if (!wci.is_cold() && !wci.is_hot()) { |
611 // Do not inline the warm calls. | 552 // Do not inline the warm calls. |
612 wci = *(WarmCallInfo::always_cold()); | 553 wci = *(WarmCallInfo::always_cold()); |
613 } | 554 } |
617 // Inline! | 558 // Inline! |
618 if (msg() == NULL) { | 559 if (msg() == NULL) { |
619 set_msg("inline (hot)"); | 560 set_msg("inline (hot)"); |
620 } | 561 } |
621 print_inlining(callee_method, caller_bci, true /* success */); | 562 print_inlining(callee_method, caller_bci, true /* success */); |
622 if (UseOldInlining) | 563 build_inline_tree_for_callee(callee_method, jvms, caller_bci); |
623 build_inline_tree_for_callee(callee_method, jvms, caller_bci); | |
624 if (InlineWarmCalls && !wci.is_hot()) | 564 if (InlineWarmCalls && !wci.is_hot()) |
625 return new (C) WarmCallInfo(wci); // copy to heap | 565 return new (C) WarmCallInfo(wci); // copy to heap |
626 return WarmCallInfo::always_hot(); | 566 return WarmCallInfo::always_hot(); |
627 } | 567 } |
628 | 568 |