< prev index next >

src/hotspot/share/runtime/tieredThresholdPolicy.cpp

Print this page
rev 56252 : imported patch 8226705-v2


 428 }
 429 
 430 // Check if the method can be compiled, change level if necessary
 431 void TieredThresholdPolicy::compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread) {
 432   assert(level <= TieredStopAtLevel, "Invalid compilation level");
 433   if (level == CompLevel_none) {
 434     return;
 435   }
 436   if (level == CompLevel_aot) {
 437     if (mh->has_aot_code()) {
 438       if (PrintTieredEvents) {
 439         print_event(COMPILE, mh, mh, bci, level);
 440       }
 441       MutexLocker ml(Compile_lock);
 442       NoSafepointVerifier nsv;
 443       if (mh->has_aot_code() && mh->code() != mh->aot_code()) {
 444         mh->aot_code()->make_entrant();
 445         if (mh->has_compiled_code()) {
 446           mh->code()->make_not_entrant();
 447         }

 448         Method::set_code(mh, mh->aot_code());
 449       }
 450     }
 451     return;
 452   }
 453 
 454   // Check if the method can be compiled. If it cannot be compiled with C1, continue profiling
 455   // in the interpreter and then compile with C2 (the transition function will request that,
 456   // see common() ). If the method cannot be compiled with C2 but still can with C1, compile it with
 457   // pure C1.
 458   if ((bci == InvocationEntryBci && !can_be_compiled(mh, level))) {
 459     if (level == CompLevel_full_optimization && can_be_compiled(mh, CompLevel_simple)) {
 460       compile(mh, bci, CompLevel_simple, thread);
 461     }
 462     return;
 463   }
 464   if ((bci != InvocationEntryBci && !can_be_osr_compiled(mh, level))) {
 465     if (level == CompLevel_full_optimization && can_be_osr_compiled(mh, CompLevel_simple)) {
 466       nmethod* osr_nm = mh->lookup_osr_nmethod_for(bci, CompLevel_simple, false);
 467       if (osr_nm != NULL && osr_nm->comp_level() > CompLevel_simple) {




 428 }
 429 
 430 // Check if the method can be compiled, change level if necessary
 431 void TieredThresholdPolicy::compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread) {
 432   assert(level <= TieredStopAtLevel, "Invalid compilation level");
 433   if (level == CompLevel_none) {
 434     return;
 435   }
 436   if (level == CompLevel_aot) {
 437     if (mh->has_aot_code()) {
 438       if (PrintTieredEvents) {
 439         print_event(COMPILE, mh, mh, bci, level);
 440       }
 441       MutexLocker ml(Compile_lock);
 442       NoSafepointVerifier nsv;
 443       if (mh->has_aot_code() && mh->code() != mh->aot_code()) {
 444         mh->aot_code()->make_entrant();
 445         if (mh->has_compiled_code()) {
 446           mh->code()->make_not_entrant();
 447         }
 448         MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
 449         Method::set_code(mh, mh->aot_code());
 450       }
 451     }
 452     return;
 453   }
 454 
 455   // Check if the method can be compiled. If it cannot be compiled with C1, continue profiling
 456   // in the interpreter and then compile with C2 (the transition function will request that,
 457   // see common() ). If the method cannot be compiled with C2 but still can with C1, compile it with
 458   // pure C1.
 459   if ((bci == InvocationEntryBci && !can_be_compiled(mh, level))) {
 460     if (level == CompLevel_full_optimization && can_be_compiled(mh, CompLevel_simple)) {
 461       compile(mh, bci, CompLevel_simple, thread);
 462     }
 463     return;
 464   }
 465   if ((bci != InvocationEntryBci && !can_be_osr_compiled(mh, level))) {
 466     if (level == CompLevel_full_optimization && can_be_osr_compiled(mh, CompLevel_simple)) {
 467       nmethod* osr_nm = mh->lookup_osr_nmethod_for(bci, CompLevel_simple, false);
 468       if (osr_nm != NULL && osr_nm->comp_level() > CompLevel_simple) {


< prev index next >