1158 // We may want to decay our counter a bit here to prevent 1159 // multiple denied requests for compilation. This is an 1160 // open compilation policy issue. Note: The other possibility, 1161 // in the case that this is a blocking compile request, is to have 1162 // all subsequent blocking requesters wait for completion of 1163 // ongoing compiles. Note that in this case we'll need a protocol 1164 // for freeing the associated compile tasks. [Or we could have 1165 // a single static monitor on which all these waiters sleep.] 1166 return; 1167 } 1168 1169 // If the requesting thread is holding the pending list lock 1170 // then we just return. We can't risk blocking while holding 1171 // the pending list lock or a 3-way deadlock may occur 1172 // between the reference handler thread, a GC (instigated 1173 // by a compiler thread), and compiled method registration. 1174 if (InstanceRefKlass::owns_pending_list_lock(JavaThread::current())) { 1175 return; 1176 } 1177 1178 // Outputs from the following MutexLocker block: 1179 CompileTask* task = NULL; 1180 bool blocking = false; 1181 CompileQueue* queue = compile_queue(comp_level); 1182 1183 // Acquire our lock. 1184 { 1185 MutexLocker locker(queue->lock(), thread); 1186 1187 // Make sure the method has not slipped into the queues since 1188 // last we checked; note that those checks were "fast bail-outs". 1189 // Here we need to be more careful, see 14012000 below. 1190 if (compilation_is_in_queue(method, osr_bci)) { 1191 return; 1192 } 1193 1194 // We need to check again to see if the compilation has 1195 // completed. A previous compilation may have registered 1196 // some result. 1197 if (compilation_is_complete(method, osr_bci, comp_level)) { | 1158 // We may want to decay our counter a bit here to prevent 1159 // multiple denied requests for compilation. This is an 1160 // open compilation policy issue. Note: The other possibility, 1161 // in the case that this is a blocking compile request, is to have 1162 // all subsequent blocking requesters wait for completion of 1163 // ongoing compiles. Note that in this case we'll need a protocol 1164 // for freeing the associated compile tasks. [Or we could have 1165 // a single static monitor on which all these waiters sleep.] 1166 return; 1167 } 1168 1169 // If the requesting thread is holding the pending list lock 1170 // then we just return. We can't risk blocking while holding 1171 // the pending list lock or a 3-way deadlock may occur 1172 // between the reference handler thread, a GC (instigated 1173 // by a compiler thread), and compiled method registration. 1174 if (InstanceRefKlass::owns_pending_list_lock(JavaThread::current())) { 1175 return; 1176 } 1177 1178 if (TieredCompilation) { 1179 // Tiered policy requires MethodCounters to exist before adding a method to 1180 // the queue. Create if we don't have them yet. 1181 method->get_method_counters(thread); 1182 } 1183 1184 // Outputs from the following MutexLocker block: 1185 CompileTask* task = NULL; 1186 bool blocking = false; 1187 CompileQueue* queue = compile_queue(comp_level); 1188 1189 // Acquire our lock. 1190 { 1191 MutexLocker locker(queue->lock(), thread); 1192 1193 // Make sure the method has not slipped into the queues since 1194 // last we checked; note that those checks were "fast bail-outs". 1195 // Here we need to be more careful, see 14012000 below. 1196 if (compilation_is_in_queue(method, osr_bci)) { 1197 return; 1198 } 1199 1200 // We need to check again to see if the compilation has 1201 // completed. A previous compilation may have registered 1202 // some result. 1203 if (compilation_is_complete(method, osr_bci, comp_level)) { |