1045 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); 1046 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); 1047 assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized"); 1048 assert(!TieredCompilation || comp_level <= TieredStopAtLevel, "Invalid compilation level"); 1049 // allow any levels for WhiteBox 1050 assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered"); 1051 // return quickly if possible 1052 1053 // Lambda forms with an Object in their signature can be passed a 1054 // value type. If compiled as root of a compilation, C2 has no way 1055 // to know a value type is passed. 1056 if (ValueTypePassFieldsAsArgs && method->is_compiled_lambda_form()) { 1057 ResourceMark rm; 1058 for (SignatureStream ss(method->signature()); !ss.at_return_type(); ss.next()) { 1059 if (ss.type() == T_VALUETYPE) { 1060 return NULL; 1061 } 1062 } 1063 } 1064 1065 // lock, make sure that the compilation 1066 // isn't prohibited in a straightforward way. 1067 AbstractCompiler* comp = CompileBroker::compiler(comp_level); 1068 if (comp == NULL || !comp->can_compile_method(method) || 1069 compilation_is_prohibited(method, osr_bci, comp_level, directive->ExcludeOption)) { 1070 return NULL; 1071 } 1072 1073 #if INCLUDE_JVMCI 1074 if (comp->is_jvmci() && !JVMCIRuntime::can_initialize_JVMCI()) { 1075 return NULL; 1076 } 1077 #endif 1078 1079 if (osr_bci == InvocationEntryBci) { 1080 // standard compilation 1081 CompiledMethod* method_code = method->code(); 1082 if (method_code != NULL && method_code->is_nmethod()) { 1083 if (compilation_is_complete(method, osr_bci, comp_level)) { 1084 return (nmethod*) method_code; | 1045 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); 1046 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); 1047 assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized"); 1048 assert(!TieredCompilation || comp_level <= TieredStopAtLevel, "Invalid compilation level"); 1049 // allow any levels for WhiteBox 1050 assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered"); 1051 // return quickly if possible 1052 1053 // Lambda forms with an Object in their signature can be passed a 1054 // value type. If compiled as root of a compilation, C2 has no way 1055 // to know a value type is passed. 1056 if (ValueTypePassFieldsAsArgs && method->is_compiled_lambda_form()) { 1057 ResourceMark rm; 1058 for (SignatureStream ss(method->signature()); !ss.at_return_type(); ss.next()) { 1059 if (ss.type() == T_VALUETYPE) { 1060 return NULL; 1061 } 1062 } 1063 } 1064 1065 // Returning a value type as a pointer can break if the compiled 1066 // call site knows the value type being returned and expects it in 1067 // registers. 1068 if (ValueTypeReturnedAsFields && method->is_compiled_lambda_form() && method->is_returning_vt()) { 1069 return NULL; 1070 } 1071 1072 // lock, make sure that the compilation 1073 // isn't prohibited in a straightforward way. 1074 AbstractCompiler* comp = CompileBroker::compiler(comp_level); 1075 if (comp == NULL || !comp->can_compile_method(method) || 1076 compilation_is_prohibited(method, osr_bci, comp_level, directive->ExcludeOption)) { 1077 return NULL; 1078 } 1079 1080 #if INCLUDE_JVMCI 1081 if (comp->is_jvmci() && !JVMCIRuntime::can_initialize_JVMCI()) { 1082 return NULL; 1083 } 1084 #endif 1085 1086 if (osr_bci == InvocationEntryBci) { 1087 // standard compilation 1088 CompiledMethod* method_code = method->code(); 1089 if (method_code != NULL && method_code->is_nmethod()) { 1090 if (compilation_is_complete(method, osr_bci, comp_level)) { 1091 return (nmethod*) method_code; |