466 }
467
468 // Determine if we should do an OSR compilation of a given method.
469 CompLevel AdvancedThresholdPolicy::loop_event(Method* method, CompLevel cur_level) {
470 CompLevel next_level = common(&AdvancedThresholdPolicy::loop_predicate, method, cur_level, true);
471 if (cur_level == CompLevel_none) {
472 // If there is a live OSR method that means that we deopted to the interpreter
473 // for the transition.
474 CompLevel osr_level = MIN2((CompLevel)method->highest_osr_comp_level(), next_level);
475 if (osr_level > CompLevel_none) {
476 return osr_level;
477 }
478 }
479 return next_level;
480 }
481
482 // Update the rate and submit compile
483 void AdvancedThresholdPolicy::submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread) {
484 int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count();
485 update_rate(os::javaTimeMillis(), mh());
486 CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", thread);
487 }
488
489 // Handle the invocation event.
490 void AdvancedThresholdPolicy::method_invocation_event(const methodHandle& mh, const methodHandle& imh,
491 CompLevel level, nmethod* nm, JavaThread* thread) {
492 if (should_create_mdo(mh(), level)) {
493 create_mdo(mh, thread);
494 }
495 if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
496 CompLevel next_level = call_event(mh(), level);
497 if (next_level != level) {
498 compile(mh, InvocationEntryBci, next_level, thread);
499 }
500 }
501 }
502
503 // Handle the back branch event. Notice that we can compile the method
504 // with a regular entry from here.
505 void AdvancedThresholdPolicy::method_back_branch_event(const methodHandle& mh, const methodHandle& imh,
506 int bci, CompLevel level, nmethod* nm, JavaThread* thread) {
|
466 }
467
468 // Determine if we should do an OSR compilation of a given method.
469 CompLevel AdvancedThresholdPolicy::loop_event(Method* method, CompLevel cur_level) {
470 CompLevel next_level = common(&AdvancedThresholdPolicy::loop_predicate, method, cur_level, true);
471 if (cur_level == CompLevel_none) {
472 // If there is a live OSR method that means that we deopted to the interpreter
473 // for the transition.
474 CompLevel osr_level = MIN2((CompLevel)method->highest_osr_comp_level(), next_level);
475 if (osr_level > CompLevel_none) {
476 return osr_level;
477 }
478 }
479 return next_level;
480 }
481
482 // Update the rate and submit compile
483 void AdvancedThresholdPolicy::submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread) {
484 int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count();
485 update_rate(os::javaTimeMillis(), mh());
486 CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", false, thread);
487 }
488
489 // Handle the invocation event.
490 void AdvancedThresholdPolicy::method_invocation_event(const methodHandle& mh, const methodHandle& imh,
491 CompLevel level, nmethod* nm, JavaThread* thread) {
492 if (should_create_mdo(mh(), level)) {
493 create_mdo(mh, thread);
494 }
495 if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
496 CompLevel next_level = call_event(mh(), level);
497 if (next_level != level) {
498 compile(mh, InvocationEntryBci, next_level, thread);
499 }
500 }
501 }
502
503 // Handle the back branch event. Notice that we can compile the method
504 // with a regular entry from here.
505 void AdvancedThresholdPolicy::method_back_branch_event(const methodHandle& mh, const methodHandle& imh,
506 int bci, CompLevel level, nmethod* nm, JavaThread* thread) {
|