1043 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); 1044 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); 1045 assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized"); 1046 assert(!TieredCompilation || comp_level <= TieredStopAtLevel, "Invalid compilation level"); 1047 // allow any levels for WhiteBox 1048 assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered"); 1049 // return quickly if possible 1050 1051 // Lambda forms with an Object in their signature can be passed a 1052 // value type. If compiled as root of a compilation, C2 has no way 1053 // to know a value type is passed. 1054 if (ValueTypePassFieldsAsArgs && method->is_compiled_lambda_form()) { 1055 ResourceMark rm; 1056 for (SignatureStream ss(method->signature()); !ss.at_return_type(); ss.next()) { 1057 if (ss.type() == T_VALUETYPE) { 1058 return NULL; 1059 } 1060 } 1061 } 1062 1063 // Don't compile methods in __Value if value types are disabled 1064 if (!EnableMVT && !EnableValhalla && method->method_holder()->name() == vmSymbols::java_lang____Value()) { 1065 // This may happen with CompileTheWorld, ReplayCompiles or compilations triggered through the WhiteBox API 1066 return NULL; 1067 } 1068 1069 // lock, make sure that the compilation 1070 // isn't prohibited in a straightforward way. 1071 AbstractCompiler* comp = CompileBroker::compiler(comp_level); 1072 if (comp == NULL || !comp->can_compile_method(method) || 1073 compilation_is_prohibited(method, osr_bci, comp_level, directive->ExcludeOption)) { 1074 return NULL; 1075 } 1076 1077 #if INCLUDE_JVMCI 1078 if (comp->is_jvmci() && !JVMCIRuntime::can_initialize_JVMCI()) { 1079 return NULL; 1080 } 1081 #endif 1082 1083 if (osr_bci == InvocationEntryBci) { 1084 // standard compilation 1085 CompiledMethod* method_code = method->code(); 1086 if (method_code != NULL && method_code->is_nmethod()) { 1087 if (compilation_is_complete(method, osr_bci, comp_level)) { 1088 return (nmethod*) method_code; | 1043 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); 1044 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); 1045 assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized"); 1046 assert(!TieredCompilation || comp_level <= TieredStopAtLevel, "Invalid compilation level"); 1047 // allow any levels for WhiteBox 1048 assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered"); 1049 // return quickly if possible 1050 1051 // Lambda forms with an Object in their signature can be passed a 1052 // value type. If compiled as root of a compilation, C2 has no way 1053 // to know a value type is passed. 1054 if (ValueTypePassFieldsAsArgs && method->is_compiled_lambda_form()) { 1055 ResourceMark rm; 1056 for (SignatureStream ss(method->signature()); !ss.at_return_type(); ss.next()) { 1057 if (ss.type() == T_VALUETYPE) { 1058 return NULL; 1059 } 1060 } 1061 } 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 == NULL || !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; |