7079673: JSR 292: C1 should inline bytecoded method handle adapters

Reviewed-by: never
This commit is contained in:
Christian Thalinger 2011-09-01 01:31:25 -07:00
parent fa7c124af1
commit fcc2a86582
9 changed files with 241 additions and 78 deletions

View file

@ -394,6 +394,16 @@ bool pass_initial_checks(ciMethod* caller_method, int caller_bci, ciMethod* call
return true;
}
//------------------------------check_can_parse--------------------------------
const char* InlineTree::check_can_parse(ciMethod* callee) {
// Certain methods cannot be parsed at all:
if ( callee->is_native()) return "native method";
if (!callee->can_be_compiled()) return "not compilable (disabled)";
if (!callee->has_balanced_monitors()) return "not compilable (unbalanced monitors)";
if ( callee->get_flow_analysis()->failing()) return "not compilable (flow analysis failed)";
return NULL;
}
//------------------------------print_inlining---------------------------------
// Really, the failure_msg can be a success message also.
void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, const char* failure_msg) const {
@ -423,14 +433,22 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms,
int caller_bci = jvms->bci();
ciMethod *caller_method = jvms->method();
if( !pass_initial_checks(caller_method, caller_bci, callee_method)) {
if( PrintInlining ) {
// Do some initial checks.
if (!pass_initial_checks(caller_method, caller_bci, callee_method)) {
if (PrintInlining) {
failure_msg = "failed_initial_checks";
print_inlining( callee_method, caller_bci, failure_msg);
print_inlining(callee_method, caller_bci, failure_msg);
}
return NULL;
}
// Do some parse checks.
failure_msg = check_can_parse(callee_method);
if (failure_msg != NULL) {
if (PrintInlining) print_inlining(callee_method, caller_bci, failure_msg);
return NULL;
}
// Check if inlining policy says no.
WarmCallInfo wci = *(initial_wci);
failure_msg = try_to_inline(callee_method, caller_method, caller_bci, profile, &wci);
@ -471,7 +489,7 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms,
if (failure_msg == NULL) failure_msg = "inline (hot)";
// Inline!
if( PrintInlining ) print_inlining( callee_method, caller_bci, failure_msg);
if (PrintInlining) print_inlining(callee_method, caller_bci, failure_msg);
if (UseOldInlining)
build_inline_tree_for_callee(callee_method, jvms, caller_bci);
if (InlineWarmCalls && !wci.is_hot())
@ -481,7 +499,7 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms,
// Do not inline
if (failure_msg == NULL) failure_msg = "too cold to inline";
if( PrintInlining ) print_inlining( callee_method, caller_bci, failure_msg);
if (PrintInlining) print_inlining(callee_method, caller_bci, failure_msg);
return NULL;
}