comparison src/share/vm/compiler/compileBroker.cpp @ 4825:20334ed5ed3c

7131259: compile_method and CompilationPolicy::event shouldn't be declared TRAPS Summary: Make sure that CompilationPolicy::event() doesn't throw exceptions Reviewed-by: kvn, never
author iveresov
date Thu, 26 Jan 2012 12:15:24 -0800
parents cc81b9c09bbb
children bf5da1648543 aa3d708d67c4
comparison
equal deleted inserted replaced
4824:5dbed2f542ff 4825:20334ed5ed3c
959 int osr_bci, 959 int osr_bci,
960 int comp_level, 960 int comp_level,
961 methodHandle hot_method, 961 methodHandle hot_method,
962 int hot_count, 962 int hot_count,
963 const char* comment, 963 const char* comment,
964 TRAPS) { 964 Thread* thread) {
965 // do nothing if compiler thread(s) is not available 965 // do nothing if compiler thread(s) is not available
966 if (!_initialized ) { 966 if (!_initialized ) {
967 return; 967 return;
968 } 968 }
969 969
1035 bool blocking = false; 1035 bool blocking = false;
1036 CompileQueue* queue = compile_queue(comp_level); 1036 CompileQueue* queue = compile_queue(comp_level);
1037 1037
1038 // Acquire our lock. 1038 // Acquire our lock.
1039 { 1039 {
1040 MutexLocker locker(queue->lock(), THREAD); 1040 MutexLocker locker(queue->lock(), thread);
1041 1041
1042 // Make sure the method has not slipped into the queues since 1042 // Make sure the method has not slipped into the queues since
1043 // last we checked; note that those checks were "fast bail-outs". 1043 // last we checked; note that those checks were "fast bail-outs".
1044 // Here we need to be more careful, see 14012000 below. 1044 // Here we need to be more careful, see 14012000 below.
1045 if (compilation_is_in_queue(method, osr_bci)) { 1045 if (compilation_is_in_queue(method, osr_bci)) {
1117 1117
1118 1118
1119 nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci, 1119 nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
1120 int comp_level, 1120 int comp_level,
1121 methodHandle hot_method, int hot_count, 1121 methodHandle hot_method, int hot_count,
1122 const char* comment, TRAPS) { 1122 const char* comment, Thread* THREAD) {
1123 // make sure arguments make sense 1123 // make sure arguments make sense
1124 assert(method->method_holder()->klass_part()->oop_is_instance(), "not an instance method"); 1124 assert(method->method_holder()->klass_part()->oop_is_instance(), "not an instance method");
1125 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); 1125 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range");
1126 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); 1126 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods");
1127 assert(!instanceKlass::cast(method->method_holder())->is_not_initialized(), "method holder must be initialized"); 1127 assert(!instanceKlass::cast(method->method_holder())->is_not_initialized(), "method holder must be initialized");
1171 } 1171 }
1172 1172
1173 assert(!HAS_PENDING_EXCEPTION, "No exception should be present"); 1173 assert(!HAS_PENDING_EXCEPTION, "No exception should be present");
1174 // some prerequisites that are compiler specific 1174 // some prerequisites that are compiler specific
1175 if (compiler(comp_level)->is_c2() || compiler(comp_level)->is_shark()) { 1175 if (compiler(comp_level)->is_c2() || compiler(comp_level)->is_shark()) {
1176 method->constants()->resolve_string_constants(CHECK_0); 1176 method->constants()->resolve_string_constants(CHECK_AND_CLEAR_NULL);
1177 // Resolve all classes seen in the signature of the method 1177 // Resolve all classes seen in the signature of the method
1178 // we are compiling. 1178 // we are compiling.
1179 methodOopDesc::load_signature_classes(method, CHECK_0); 1179 methodOopDesc::load_signature_classes(method, CHECK_AND_CLEAR_NULL);
1180 } 1180 }
1181 1181
1182 // If the method is native, do the lookup in the thread requesting 1182 // If the method is native, do the lookup in the thread requesting
1183 // the compilation. Native lookups can load code, which is not 1183 // the compilation. Native lookups can load code, which is not
1184 // permitted during compilation. 1184 // permitted during compilation.
1228 (void) AdapterHandlerLibrary::create_native_wrapper(method, compile_id); 1228 (void) AdapterHandlerLibrary::create_native_wrapper(method, compile_id);
1229 } else { 1229 } else {
1230 return NULL; 1230 return NULL;
1231 } 1231 }
1232 } else { 1232 } else {
1233 compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, CHECK_0); 1233 compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, THREAD);
1234 } 1234 }
1235 1235
1236 // return requested nmethod 1236 // return requested nmethod
1237 // We accept a higher level osr method 1237 // We accept a higher level osr method
1238 return osr_bci == InvocationEntryBci ? method->code() : method->lookup_osr_nmethod_for(osr_bci, comp_level, false); 1238 return osr_bci == InvocationEntryBci ? method->code() : method->lookup_osr_nmethod_for(osr_bci, comp_level, false);