221 // method == inlinee if the event originated in the main method 222 method_back_branch_event(method, inlinee, bci, comp_level, nm, thread); 223 // Check if event led to a higher level OSR compilation 224 nmethod* osr_nm = inlinee->lookup_osr_nmethod_for(bci, comp_level, false); 225 if (osr_nm != NULL && osr_nm->comp_level() > comp_level) { 226 // Perform OSR with new nmethod 227 return osr_nm; 228 } 229 } 230 return NULL; 231 } 232 233 // Check if the method can be compiled, change level if necessary 234 void SimpleThresholdPolicy::compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread) { 235 assert(level <= TieredStopAtLevel, "Invalid compilation level"); 236 if (level == CompLevel_none) { 237 return; 238 } 239 240 #if INCLUDE_JVMCI 241 // We can't compile with a JVMCI compiler until the module system is initialized. 242 if (level == CompLevel_full_optimization && UseJVMCICompiler && !Universe::is_module_initialized()) { 243 return; 244 } 245 #endif 246 247 // Check if the method can be compiled. If it cannot be compiled with C1, continue profiling 248 // in the interpreter and then compile with C2 (the transition function will request that, 249 // see common() ). If the method cannot be compiled with C2 but still can with C1, compile it with 250 // pure C1. 251 if (!can_be_compiled(mh, level)) { 252 if (level == CompLevel_full_optimization && can_be_compiled(mh, CompLevel_simple)) { 253 compile(mh, bci, CompLevel_simple, thread); 254 } 255 return; 256 } 257 if (bci != InvocationEntryBci && mh->is_not_osr_compilable(level)) { 258 return; 259 } 260 if (!CompileBroker::compilation_is_in_queue(mh)) { 261 if (PrintTieredEvents) { 262 print_event(COMPILE, mh, mh, bci, level); | 221 // method == inlinee if the event originated in the main method 222 method_back_branch_event(method, inlinee, bci, comp_level, nm, thread); 223 // Check if event led to a higher level OSR compilation 224 nmethod* osr_nm = inlinee->lookup_osr_nmethod_for(bci, comp_level, false); 225 if (osr_nm != NULL && osr_nm->comp_level() > comp_level) { 226 // Perform OSR with new nmethod 227 return osr_nm; 228 } 229 } 230 return NULL; 231 } 232 233 // Check if the method can be compiled, change level if necessary 234 void SimpleThresholdPolicy::compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread) { 235 assert(level <= TieredStopAtLevel, "Invalid compilation level"); 236 if (level == CompLevel_none) { 237 return; 238 } 239 240 #if INCLUDE_JVMCI 241 // We can't compile with a JVMCI compiler until the module system is initialized past 242 // phase 3. The JVMCI API itself isn't available until phase 2 and ServiceLoader isn't 243 // usable until after phase 3. 244 if (level == CompLevel_full_optimization && UseJVMCICompiler && SystemDictionary::java_system_loader() == NULL) { 245 assert(Universe::is_module_initialized(), "must be"); 246 return; 247 } 248 #endif 249 250 // Check if the method can be compiled. If it cannot be compiled with C1, continue profiling 251 // in the interpreter and then compile with C2 (the transition function will request that, 252 // see common() ). If the method cannot be compiled with C2 but still can with C1, compile it with 253 // pure C1. 254 if (!can_be_compiled(mh, level)) { 255 if (level == CompLevel_full_optimization && can_be_compiled(mh, CompLevel_simple)) { 256 compile(mh, bci, CompLevel_simple, thread); 257 } 258 return; 259 } 260 if (bci != InvocationEntryBci && mh->is_not_osr_compilable(level)) { 261 return; 262 } 263 if (!CompileBroker::compilation_is_in_queue(mh)) { 264 if (PrintTieredEvents) { 265 print_event(COMPILE, mh, mh, bci, level); |