1036 bool blocking = false; |
1036 bool blocking = false; |
1037 CompileQueue* queue = compile_queue(comp_level); |
1037 CompileQueue* queue = compile_queue(comp_level); |
1038 |
1038 |
1039 // Acquire our lock. |
1039 // Acquire our lock. |
1040 { |
1040 { |
1041 MutexLocker locker(queue->lock(), THREAD); |
1041 MutexLocker locker(queue->lock(), thread); |
1042 |
1042 |
1043 // Make sure the method has not slipped into the queues since |
1043 // Make sure the method has not slipped into the queues since |
1044 // last we checked; note that those checks were "fast bail-outs". |
1044 // last we checked; note that those checks were "fast bail-outs". |
1045 // Here we need to be more careful, see 14012000 below. |
1045 // Here we need to be more careful, see 14012000 below. |
1046 if (compilation_is_in_queue(method, osr_bci)) { |
1046 if (compilation_is_in_queue(method, osr_bci)) { |
1118 |
1118 |
1119 |
1119 |
1120 nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci, |
1120 nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci, |
1121 int comp_level, |
1121 int comp_level, |
1122 methodHandle hot_method, int hot_count, |
1122 methodHandle hot_method, int hot_count, |
1123 const char* comment, TRAPS) { |
1123 const char* comment, Thread* THREAD) { |
1124 // make sure arguments make sense |
1124 // make sure arguments make sense |
1125 assert(method->method_holder()->klass_part()->oop_is_instance(), "not an instance method"); |
1125 assert(method->method_holder()->klass_part()->oop_is_instance(), "not an instance method"); |
1126 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); |
1126 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); |
1127 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); |
1127 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); |
1128 assert(!instanceKlass::cast(method->method_holder())->is_not_initialized(), "method holder must be initialized"); |
1128 assert(!instanceKlass::cast(method->method_holder())->is_not_initialized(), "method holder must be initialized"); |
1172 } |
1172 } |
1173 |
1173 |
1174 assert(!HAS_PENDING_EXCEPTION, "No exception should be present"); |
1174 assert(!HAS_PENDING_EXCEPTION, "No exception should be present"); |
1175 // some prerequisites that are compiler specific |
1175 // some prerequisites that are compiler specific |
1176 if (compiler(comp_level)->is_c2() || compiler(comp_level)->is_shark()) { |
1176 if (compiler(comp_level)->is_c2() || compiler(comp_level)->is_shark()) { |
1177 method->constants()->resolve_string_constants(CHECK_0); |
1177 method->constants()->resolve_string_constants(CHECK_AND_CLEAR_NULL); |
1178 // Resolve all classes seen in the signature of the method |
1178 // Resolve all classes seen in the signature of the method |
1179 // we are compiling. |
1179 // we are compiling. |
1180 methodOopDesc::load_signature_classes(method, CHECK_0); |
1180 methodOopDesc::load_signature_classes(method, CHECK_AND_CLEAR_NULL); |
1181 } |
1181 } |
1182 |
1182 |
1183 // If the method is native, do the lookup in the thread requesting |
1183 // If the method is native, do the lookup in the thread requesting |
1184 // the compilation. Native lookups can load code, which is not |
1184 // the compilation. Native lookups can load code, which is not |
1185 // permitted during compilation. |
1185 // permitted during compilation. |
1229 (void) AdapterHandlerLibrary::create_native_wrapper(method, compile_id); |
1229 (void) AdapterHandlerLibrary::create_native_wrapper(method, compile_id); |
1230 } else { |
1230 } else { |
1231 return NULL; |
1231 return NULL; |
1232 } |
1232 } |
1233 } else { |
1233 } else { |
1234 compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, CHECK_0); |
1234 compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, THREAD); |
1235 } |
1235 } |
1236 |
1236 |
1237 // return requested nmethod |
1237 // return requested nmethod |
1238 // We accept a higher level osr method |
1238 // We accept a higher level osr method |
1239 return osr_bci == InvocationEntryBci ? method->code() : method->lookup_osr_nmethod_for(osr_bci, comp_level, false); |
1239 return osr_bci == InvocationEntryBci ? method->code() : method->lookup_osr_nmethod_for(osr_bci, comp_level, false); |