comparison src/share/vm/opto/bytecodeInfo.cpp @ 3900:a32de5085326

7079673: JSR 292: C1 should inline bytecoded method handle adapters Reviewed-by: never
author twisti
date Thu, 01 Sep 2011 01:31:25 -0700
parents de847cac9235
children c26de9aef2ed
comparison
equal deleted inserted replaced
3899:c124e2e7463e 3900:a32de5085326
392 if( callee_method->should_exclude() ) return false; 392 if( callee_method->should_exclude() ) return false;
393 393
394 return true; 394 return true;
395 } 395 }
396 396
397 //------------------------------check_can_parse--------------------------------
398 const char* InlineTree::check_can_parse(ciMethod* callee) {
399 // Certain methods cannot be parsed at all:
400 if ( callee->is_native()) return "native method";
401 if (!callee->can_be_compiled()) return "not compilable (disabled)";
402 if (!callee->has_balanced_monitors()) return "not compilable (unbalanced monitors)";
403 if ( callee->get_flow_analysis()->failing()) return "not compilable (flow analysis failed)";
404 return NULL;
405 }
406
397 //------------------------------print_inlining--------------------------------- 407 //------------------------------print_inlining---------------------------------
398 // Really, the failure_msg can be a success message also. 408 // Really, the failure_msg can be a success message also.
399 void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, const char* failure_msg) const { 409 void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, const char* failure_msg) const {
400 CompileTask::print_inlining(callee_method, inline_level(), caller_bci, failure_msg ? failure_msg : "inline"); 410 CompileTask::print_inlining(callee_method, inline_level(), caller_bci, failure_msg ? failure_msg : "inline");
401 if (callee_method == NULL) tty->print(" callee not monotonic or profiled"); 411 if (callee_method == NULL) tty->print(" callee not monotonic or profiled");
421 #endif 431 #endif
422 const char *failure_msg = NULL; 432 const char *failure_msg = NULL;
423 int caller_bci = jvms->bci(); 433 int caller_bci = jvms->bci();
424 ciMethod *caller_method = jvms->method(); 434 ciMethod *caller_method = jvms->method();
425 435
426 if( !pass_initial_checks(caller_method, caller_bci, callee_method)) { 436 // Do some initial checks.
427 if( PrintInlining ) { 437 if (!pass_initial_checks(caller_method, caller_bci, callee_method)) {
438 if (PrintInlining) {
428 failure_msg = "failed_initial_checks"; 439 failure_msg = "failed_initial_checks";
429 print_inlining( callee_method, caller_bci, failure_msg); 440 print_inlining(callee_method, caller_bci, failure_msg);
430 } 441 }
442 return NULL;
443 }
444
445 // Do some parse checks.
446 failure_msg = check_can_parse(callee_method);
447 if (failure_msg != NULL) {
448 if (PrintInlining) print_inlining(callee_method, caller_bci, failure_msg);
431 return NULL; 449 return NULL;
432 } 450 }
433 451
434 // Check if inlining policy says no. 452 // Check if inlining policy says no.
435 WarmCallInfo wci = *(initial_wci); 453 WarmCallInfo wci = *(initial_wci);
469 if (!wci.is_cold()) { 487 if (!wci.is_cold()) {
470 // In -UseOldInlining, the failure_msg may also be a success message. 488 // In -UseOldInlining, the failure_msg may also be a success message.
471 if (failure_msg == NULL) failure_msg = "inline (hot)"; 489 if (failure_msg == NULL) failure_msg = "inline (hot)";
472 490
473 // Inline! 491 // Inline!
474 if( PrintInlining ) print_inlining( callee_method, caller_bci, failure_msg); 492 if (PrintInlining) print_inlining(callee_method, caller_bci, failure_msg);
475 if (UseOldInlining) 493 if (UseOldInlining)
476 build_inline_tree_for_callee(callee_method, jvms, caller_bci); 494 build_inline_tree_for_callee(callee_method, jvms, caller_bci);
477 if (InlineWarmCalls && !wci.is_hot()) 495 if (InlineWarmCalls && !wci.is_hot())
478 return new (C) WarmCallInfo(wci); // copy to heap 496 return new (C) WarmCallInfo(wci); // copy to heap
479 return WarmCallInfo::always_hot(); 497 return WarmCallInfo::always_hot();
480 } 498 }
481 499
482 // Do not inline 500 // Do not inline
483 if (failure_msg == NULL) failure_msg = "too cold to inline"; 501 if (failure_msg == NULL) failure_msg = "too cold to inline";
484 if( PrintInlining ) print_inlining( callee_method, caller_bci, failure_msg); 502 if (PrintInlining) print_inlining(callee_method, caller_bci, failure_msg);
485 return NULL; 503 return NULL;
486 } 504 }
487 505
488 //------------------------------compute_callee_frequency----------------------- 506 //------------------------------compute_callee_frequency-----------------------
489 float InlineTree::compute_callee_frequency( int caller_bci ) const { 507 float InlineTree::compute_callee_frequency( int caller_bci ) const {