1051 Thread* THREAD) { 1052 1053 // make sure arguments make sense 1054 assert(method->method_holder()->is_instance_klass(), "not an instance method"); 1055 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); 1056 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); 1057 assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized"); 1058 assert(!TieredCompilation || comp_level <= TieredStopAtLevel, "Invalid compilation level"); 1059 // allow any levels for WhiteBox 1060 assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered"); 1061 // return quickly if possible 1062 1063 // lock, make sure that the compilation 1064 // isn't prohibited in a straightforward way. 1065 AbstractCompiler *comp = CompileBroker::compiler(comp_level); 1066 if (!comp->can_compile_method(method) || 1067 compilation_is_prohibited(method, osr_bci, comp_level, directive->ExcludeOption)) { 1068 return NULL; 1069 } 1070 1071 if (osr_bci == InvocationEntryBci) { 1072 // standard compilation 1073 CompiledMethod* method_code = method->code(); 1074 if (method_code != NULL && method_code->is_nmethod()) { 1075 if (compilation_is_complete(method, osr_bci, comp_level)) { 1076 return (nmethod*) method_code; 1077 } 1078 } 1079 if (method->is_not_compilable(comp_level)) { 1080 return NULL; 1081 } 1082 } else { 1083 // osr compilation 1084 #ifndef TIERED 1085 // seems like an assert of dubious value 1086 assert(comp_level == CompLevel_highest_tier, 1087 "all OSR compiles are assumed to be at a single compilation level"); 1088 #endif // TIERED 1089 // We accept a higher level osr method 1090 nmethod* nm = method->lookup_osr_nmethod_for(osr_bci, comp_level, false); | 1051 Thread* THREAD) { 1052 1053 // make sure arguments make sense 1054 assert(method->method_holder()->is_instance_klass(), "not an instance method"); 1055 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); 1056 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); 1057 assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized"); 1058 assert(!TieredCompilation || comp_level <= TieredStopAtLevel, "Invalid compilation level"); 1059 // allow any levels for WhiteBox 1060 assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered"); 1061 // return quickly if possible 1062 1063 // lock, make sure that the compilation 1064 // isn't prohibited in a straightforward way. 1065 AbstractCompiler *comp = CompileBroker::compiler(comp_level); 1066 if (!comp->can_compile_method(method) || 1067 compilation_is_prohibited(method, osr_bci, comp_level, directive->ExcludeOption)) { 1068 return NULL; 1069 } 1070 1071 #if INCLUDE_JVMCI 1072 if (comp->is_jvmci() && !JVMCIRuntime::can_initialize_JVMCI()) { 1073 return NULL; 1074 } 1075 #endif 1076 1077 if (osr_bci == InvocationEntryBci) { 1078 // standard compilation 1079 CompiledMethod* method_code = method->code(); 1080 if (method_code != NULL && method_code->is_nmethod()) { 1081 if (compilation_is_complete(method, osr_bci, comp_level)) { 1082 return (nmethod*) method_code; 1083 } 1084 } 1085 if (method->is_not_compilable(comp_level)) { 1086 return NULL; 1087 } 1088 } else { 1089 // osr compilation 1090 #ifndef TIERED 1091 // seems like an assert of dubious value 1092 assert(comp_level == CompLevel_highest_tier, 1093 "all OSR compiles are assumed to be at a single compilation level"); 1094 #endif // TIERED 1095 // We accept a higher level osr method 1096 nmethod* nm = method->lookup_osr_nmethod_for(osr_bci, comp_level, false); |