Mercurial > hg > truffle
comparison src/share/vm/opto/doCall.cpp @ 5927:b40ac3579043
6658428: C2 doesn't inline java method if corresponding intrinsic failed to inline.
Summary: Allow fallback to non-intrinsic inline case
Reviewed-by: kvn, jrose, never
Contributed-by: nils.eliasson@oracle.com
author | never |
---|---|
date | Mon, 05 Mar 2012 18:10:31 -0800 |
parents | a04a201f0f5a |
children | cdd249497b34 |
comparison
equal
deleted
inserted
replaced
5926:e5f73be4c7f1 | 5927:b40ac3579043 |
---|---|
59 } | 59 } |
60 #endif | 60 #endif |
61 | 61 |
62 CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, | 62 CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, |
63 JVMState* jvms, bool allow_inline, | 63 JVMState* jvms, bool allow_inline, |
64 float prof_factor) { | 64 float prof_factor, bool allow_intrinsics) { |
65 ciMethod* caller = jvms->method(); | 65 ciMethod* caller = jvms->method(); |
66 int bci = jvms->bci(); | 66 int bci = jvms->bci(); |
67 Bytecodes::Code bytecode = caller->java_code_at_bci(bci); | 67 Bytecodes::Code bytecode = caller->java_code_at_bci(bci); |
68 guarantee(call_method != NULL, "failed method resolution"); | 68 guarantee(call_method != NULL, "failed method resolution"); |
69 | 69 |
106 // Special case the handling of certain common, profitable library | 106 // Special case the handling of certain common, profitable library |
107 // methods. If these methods are replaced with specialized code, | 107 // methods. If these methods are replaced with specialized code, |
108 // then we return it as the inlined version of the call. | 108 // then we return it as the inlined version of the call. |
109 // We do this before the strict f.p. check below because the | 109 // We do this before the strict f.p. check below because the |
110 // intrinsics handle strict f.p. correctly. | 110 // intrinsics handle strict f.p. correctly. |
111 if (allow_inline) { | 111 if (allow_inline && allow_intrinsics) { |
112 CallGenerator* cg = find_intrinsic(call_method, call_is_virtual); | 112 CallGenerator* cg = find_intrinsic(call_method, call_is_virtual); |
113 if (cg != NULL) return cg; | 113 if (cg != NULL) return cg; |
114 } | 114 } |
115 | 115 |
116 // Do method handle calls. | 116 // Do method handle calls. |
453 // it may contaminate the current compile state, making it | 453 // it may contaminate the current compile state, making it |
454 // impossible to pull back and try again. Once we call | 454 // impossible to pull back and try again. Once we call |
455 // cg->generate(), we are committed. If it fails, the whole | 455 // cg->generate(), we are committed. If it fails, the whole |
456 // compilation task is compromised. | 456 // compilation task is compromised. |
457 if (failing()) return; | 457 if (failing()) return; |
458 #ifndef PRODUCT | 458 |
459 if (PrintOpto || PrintOptoInlining || PrintInlining) { | |
460 // Only one fall-back, so if an intrinsic fails, ignore any bytecodes. | |
461 if (cg->is_intrinsic() && call_method->code_size() > 0) { | |
462 tty->print("Bailed out of intrinsic, will not inline: "); | |
463 call_method->print_name(); tty->cr(); | |
464 } | |
465 } | |
466 #endif | |
467 // This can happen if a library intrinsic is available, but refuses | 459 // This can happen if a library intrinsic is available, but refuses |
468 // the call site, perhaps because it did not match a pattern the | 460 // the call site, perhaps because it did not match a pattern the |
469 // intrinsic was expecting to optimize. The fallback position is | 461 // intrinsic was expecting to optimize. Should always be possible to |
470 // to call out-of-line. | 462 // get a normal java call that may inline in that case |
471 try_inline = false; // Inline tactic bailed out. | 463 cg = C->call_generator(call_method, vtable_index, call_is_virtual, jvms, try_inline, prof_factor(), /* allow_intrinsics= */ false); |
472 cg = C->call_generator(call_method, vtable_index, call_is_virtual, jvms, try_inline, prof_factor()); | |
473 if ((new_jvms = cg->generate(jvms)) == NULL) { | 464 if ((new_jvms = cg->generate(jvms)) == NULL) { |
474 guarantee(failing(), "call failed to generate: calls should work"); | 465 guarantee(failing(), "call failed to generate: calls should work"); |
475 return; | 466 return; |
476 } | 467 } |
477 } | 468 } |