Mercurial > hg > graal-compiler
comparison src/share/vm/opto/bytecodeInfo.cpp @ 14232:183bd5c00828
8028468: Add inlining information into ciReplay
Summary: Allow dump and replay inlining for specified method during a program execution.
Reviewed-by: roland, twisti
author | kvn |
---|---|
date | Wed, 08 Jan 2014 10:25:50 -0800 |
parents | de6a9e811145 |
children | 17ec2d5c43e8 |
comparison
equal
deleted
inserted
replaced
14231:303c352ba1a8 | 14232:183bd5c00828 |
---|---|
48 _max_inline_level(max_inline_level), | 48 _max_inline_level(max_inline_level), |
49 _count_inline_bcs(method()->code_size_for_inlining()), | 49 _count_inline_bcs(method()->code_size_for_inlining()), |
50 _subtrees(c->comp_arena(), 2, 0, NULL), | 50 _subtrees(c->comp_arena(), 2, 0, NULL), |
51 _msg(NULL) | 51 _msg(NULL) |
52 { | 52 { |
53 NOT_PRODUCT(_count_inlines = 0;) | 53 #ifndef PRODUCT |
54 _count_inlines = 0; | |
55 _forced_inline = false; | |
56 #endif | |
54 if (_caller_jvms != NULL) { | 57 if (_caller_jvms != NULL) { |
55 // Keep a private copy of the caller_jvms: | 58 // Keep a private copy of the caller_jvms: |
56 _caller_jvms = new (C) JVMState(caller_jvms->method(), caller_tree->caller_jvms()); | 59 _caller_jvms = new (C) JVMState(caller_jvms->method(), caller_tree->caller_jvms()); |
57 _caller_jvms->set_bci(caller_jvms->bci()); | 60 _caller_jvms->set_bci(caller_jvms->bci()); |
58 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"); |
79 _site_invoke_ratio(site_invoke_ratio), | 82 _site_invoke_ratio(site_invoke_ratio), |
80 _max_inline_level(max_inline_level), | 83 _max_inline_level(max_inline_level), |
81 _count_inline_bcs(method()->code_size()), | 84 _count_inline_bcs(method()->code_size()), |
82 _msg(NULL) | 85 _msg(NULL) |
83 { | 86 { |
84 NOT_PRODUCT(_count_inlines = 0;) | 87 #ifndef PRODUCT |
88 _count_inlines = 0; | |
89 _forced_inline = false; | |
90 #endif | |
85 assert(!UseOldInlining, "do not use for old stuff"); | 91 assert(!UseOldInlining, "do not use for old stuff"); |
86 } | 92 } |
87 | 93 |
88 /** | 94 /** |
89 * Return true when EA is ON and a java constructor is called or | 95 * Return true when EA is ON and a java constructor is called or |
126 if (C->print_inlining() && Verbose) { | 132 if (C->print_inlining() && Verbose) { |
127 CompileTask::print_inline_indent(inline_level()); | 133 CompileTask::print_inline_indent(inline_level()); |
128 tty->print_cr("Inlined method is hot: "); | 134 tty->print_cr("Inlined method is hot: "); |
129 } | 135 } |
130 set_msg("force inline by CompilerOracle"); | 136 set_msg("force inline by CompilerOracle"); |
131 return true; | 137 _forced_inline = true; |
132 } | 138 return true; |
139 } | |
140 | |
141 #ifndef PRODUCT | |
142 int inline_depth = inline_level()+1; | |
143 if (ciReplay::should_inline(C->replay_inline_data(), callee_method, caller_bci, inline_depth)) { | |
144 set_msg("force inline by ciReplay"); | |
145 _forced_inline = true; | |
146 return true; | |
147 } | |
148 #endif | |
133 | 149 |
134 int size = callee_method->code_size_for_inlining(); | 150 int size = callee_method->code_size_for_inlining(); |
135 | 151 |
136 // Check for too many throws (and not too huge) | 152 // Check for too many throws (and not too huge) |
137 if(callee_method->interpreter_throwout_count() > InlineThrowCount && | 153 if(callee_method->interpreter_throwout_count() > InlineThrowCount && |
262 set_msg("disallowed by CompilerOracle"); | 278 set_msg("disallowed by CompilerOracle"); |
263 return true; | 279 return true; |
264 } | 280 } |
265 | 281 |
266 #ifndef PRODUCT | 282 #ifndef PRODUCT |
283 int caller_bci = jvms->bci(); | |
284 int inline_depth = inline_level()+1; | |
285 if (ciReplay::should_inline(C->replay_inline_data(), callee_method, caller_bci, inline_depth)) { | |
286 set_msg("force inline by ciReplay"); | |
287 return false; | |
288 } | |
289 | |
290 if (ciReplay::should_not_inline(C->replay_inline_data(), callee_method, caller_bci, inline_depth)) { | |
291 set_msg("disallowed by ciReplay"); | |
292 return true; | |
293 } | |
294 | |
267 if (ciReplay::should_not_inline(callee_method)) { | 295 if (ciReplay::should_not_inline(callee_method)) { |
268 set_msg("disallowed by ciReplay"); | 296 set_msg("disallowed by ciReplay"); |
269 return true; | 297 return true; |
270 } | 298 } |
271 #endif | 299 #endif |
341 } else if (!C->inlining_incrementally()) { | 369 } else if (!C->inlining_incrementally()) { |
342 should_delay = true; | 370 should_delay = true; |
343 } | 371 } |
344 } | 372 } |
345 | 373 |
374 _forced_inline = false; // Reset | |
346 if (!should_inline(callee_method, caller_method, caller_bci, profile, | 375 if (!should_inline(callee_method, caller_method, caller_bci, profile, |
347 wci_result)) { | 376 wci_result)) { |
348 return false; | 377 return false; |
349 } | 378 } |
350 if (should_not_inline(callee_method, caller_method, jvms, wci_result)) { | 379 if (should_not_inline(callee_method, caller_method, jvms, wci_result)) { |
371 } | 400 } |
372 } | 401 } |
373 | 402 |
374 if ((!UseInterpreter || CompileTheWorld) && | 403 if ((!UseInterpreter || CompileTheWorld) && |
375 is_init_with_ea(callee_method, caller_method, C)) { | 404 is_init_with_ea(callee_method, caller_method, C)) { |
376 | |
377 // Escape Analysis stress testing when running Xcomp or CTW: | 405 // Escape Analysis stress testing when running Xcomp or CTW: |
378 // inline constructors even if they are not reached. | 406 // inline constructors even if they are not reached. |
379 | 407 } else if (forced_inline()) { |
408 // Inlining was forced by CompilerOracle or ciReplay | |
380 } else if (profile.count() == 0) { | 409 } else if (profile.count() == 0) { |
381 // don't inline unreached call sites | 410 // don't inline unreached call sites |
382 set_msg("call site not reached"); | 411 set_msg("call site not reached"); |
383 return false; | 412 return false; |
384 } | 413 } |
698 iltp = sub; | 727 iltp = sub; |
699 } | 728 } |
700 return iltp; | 729 return iltp; |
701 } | 730 } |
702 | 731 |
732 // Count number of nodes in this subtree | |
733 int InlineTree::count() const { | |
734 int result = 1; | |
735 for (int i = 0 ; i < _subtrees.length(); i++) { | |
736 result += _subtrees.at(i)->count(); | |
737 } | |
738 return result; | |
739 } | |
740 | |
741 void InlineTree::dump_replay_data(outputStream* out) { | |
742 out->print(" %d %d ", inline_level(), caller_bci()); | |
743 method()->dump_name_as_ascii(out); | |
744 for (int i = 0 ; i < _subtrees.length(); i++) { | |
745 _subtrees.at(i)->dump_replay_data(out); | |
746 } | |
747 } | |
703 | 748 |
704 | 749 |
705 #ifndef PRODUCT | 750 #ifndef PRODUCT |
706 void InlineTree::print_impl(outputStream* st, int indent) const { | 751 void InlineTree::print_impl(outputStream* st, int indent) const { |
707 for (int i = 0; i < indent; i++) st->print(" "); | 752 for (int i = 0; i < indent; i++) st->print(" "); |
708 st->print(" @ %d ", caller_bci()); | 753 st->print(" @ %d", caller_bci()); |
709 method()->print_short_name(st); | 754 method()->print_short_name(st); |
710 st->cr(); | 755 st->cr(); |
711 | 756 |
712 for (int i = 0 ; i < _subtrees.length(); i++) { | 757 for (int i = 0 ; i < _subtrees.length(); i++) { |
713 _subtrees.at(i)->print_impl(st, indent + 2); | 758 _subtrees.at(i)->print_impl(st, indent + 2); |