src/share/vm/compiler/compileBroker.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-comp Sdiff src/share/vm/compiler

src/share/vm/compiler/compileBroker.cpp

Print this page




1189     // We may want to decay our counter a bit here to prevent
1190     // multiple denied requests for compilation.  This is an
1191     // open compilation policy issue. Note: The other possibility,
1192     // in the case that this is a blocking compile request, is to have
1193     // all subsequent blocking requesters wait for completion of
1194     // ongoing compiles. Note that in this case we'll need a protocol
1195     // for freeing the associated compile tasks. [Or we could have
1196     // a single static monitor on which all these waiters sleep.]
1197     return;
1198   }
1199 
1200   // If the requesting thread is holding the pending list lock
1201   // then we just return. We can't risk blocking while holding
1202   // the pending list lock or a 3-way deadlock may occur
1203   // between the reference handler thread, a GC (instigated
1204   // by a compiler thread), and compiled method registration.
1205   if (InstanceRefKlass::owns_pending_list_lock(JavaThread::current())) {
1206     return;
1207   }
1208 






1209   // Outputs from the following MutexLocker block:
1210   CompileTask* task     = NULL;
1211   bool         blocking = false;
1212   CompileQueue* queue  = compile_queue(comp_level);
1213 
1214   // Acquire our lock.
1215   {
1216     MutexLocker locker(queue->lock(), thread);
1217 
1218     // Make sure the method has not slipped into the queues since
1219     // last we checked; note that those checks were "fast bail-outs".
1220     // Here we need to be more careful, see 14012000 below.
1221     if (compilation_is_in_queue(method)) {
1222       return;
1223     }
1224 
1225     // We need to check again to see if the compilation has
1226     // completed.  A previous compilation may have registered
1227     // some result.
1228     if (compilation_is_complete(method, osr_bci, comp_level)) {




1189     // We may want to decay our counter a bit here to prevent
1190     // multiple denied requests for compilation.  This is an
1191     // open compilation policy issue. Note: The other possibility,
1192     // in the case that this is a blocking compile request, is to have
1193     // all subsequent blocking requesters wait for completion of
1194     // ongoing compiles. Note that in this case we'll need a protocol
1195     // for freeing the associated compile tasks. [Or we could have
1196     // a single static monitor on which all these waiters sleep.]
1197     return;
1198   }
1199 
1200   // If the requesting thread is holding the pending list lock
1201   // then we just return. We can't risk blocking while holding
1202   // the pending list lock or a 3-way deadlock may occur
1203   // between the reference handler thread, a GC (instigated
1204   // by a compiler thread), and compiled method registration.
1205   if (InstanceRefKlass::owns_pending_list_lock(JavaThread::current())) {
1206     return;
1207   }
1208 
1209   if (TieredCompilation) {
1210     // Tiered policy requires MethodCounters to exist before adding a method to
1211     // the queue. Create if we don't have them yet.
1212     method->get_method_counters(thread);
1213   }
1214 
1215   // Outputs from the following MutexLocker block:
1216   CompileTask* task     = NULL;
1217   bool         blocking = false;
1218   CompileQueue* queue  = compile_queue(comp_level);
1219 
1220   // Acquire our lock.
1221   {
1222     MutexLocker locker(queue->lock(), thread);
1223 
1224     // Make sure the method has not slipped into the queues since
1225     // last we checked; note that those checks were "fast bail-outs".
1226     // Here we need to be more careful, see 14012000 below.
1227     if (compilation_is_in_queue(method)) {
1228       return;
1229     }
1230 
1231     // We need to check again to see if the compilation has
1232     // completed.  A previous compilation may have registered
1233     // some result.
1234     if (compilation_is_complete(method, osr_bci, comp_level)) {


src/share/vm/compiler/compileBroker.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File