src/hotspot/share/gc/shared/genCollectedHeap.cpp
changeset 51598 c88019b32bc4
parent 51332 c25572739e7c
child 51801 09e8e51c948a
equal deleted inserted replaced
51597:4c78f4fd8370 51598:c88019b32bc4
   790   // _n_termination for _process_strong_tasks should be set up stream
   790   // _n_termination for _process_strong_tasks should be set up stream
   791   // in a method not running in a GC worker.  Otherwise the GC worker
   791   // in a method not running in a GC worker.  Otherwise the GC worker
   792   // could be trying to change the termination condition while the task
   792   // could be trying to change the termination condition while the task
   793   // is executing in another GC worker.
   793   // is executing in another GC worker.
   794 
   794 
   795   if (!_process_strong_tasks->is_task_claimed(GCH_PS_ClassLoaderDataGraph_oops_do)) {
   795   if (_process_strong_tasks->try_claim_task(GCH_PS_ClassLoaderDataGraph_oops_do)) {
   796     ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure);
   796     ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure);
   797   }
   797   }
   798 
   798 
   799   // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway
   799   // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway
   800   CodeBlobToOopClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
   800   CodeBlobToOopClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
   801 
   801 
   802   bool is_par = scope->n_threads() > 1;
   802   bool is_par = scope->n_threads() > 1;
   803   Threads::possibly_parallel_oops_do(is_par, strong_roots, roots_from_code_p);
   803   Threads::possibly_parallel_oops_do(is_par, strong_roots, roots_from_code_p);
   804 
   804 
   805   if (!_process_strong_tasks->is_task_claimed(GCH_PS_Universe_oops_do)) {
   805   if (_process_strong_tasks->try_claim_task(GCH_PS_Universe_oops_do)) {
   806     Universe::oops_do(strong_roots);
   806     Universe::oops_do(strong_roots);
   807   }
   807   }
   808   // Global (strong) JNI handles
   808   // Global (strong) JNI handles
   809   if (!_process_strong_tasks->is_task_claimed(GCH_PS_JNIHandles_oops_do)) {
   809   if (_process_strong_tasks->try_claim_task(GCH_PS_JNIHandles_oops_do)) {
   810     JNIHandles::oops_do(strong_roots);
   810     JNIHandles::oops_do(strong_roots);
   811   }
   811   }
   812 
   812 
   813   if (!_process_strong_tasks->is_task_claimed(GCH_PS_ObjectSynchronizer_oops_do)) {
   813   if (_process_strong_tasks->try_claim_task(GCH_PS_ObjectSynchronizer_oops_do)) {
   814     ObjectSynchronizer::oops_do(strong_roots);
   814     ObjectSynchronizer::oops_do(strong_roots);
   815   }
   815   }
   816   if (!_process_strong_tasks->is_task_claimed(GCH_PS_Management_oops_do)) {
   816   if (_process_strong_tasks->try_claim_task(GCH_PS_Management_oops_do)) {
   817     Management::oops_do(strong_roots);
   817     Management::oops_do(strong_roots);
   818   }
   818   }
   819   if (!_process_strong_tasks->is_task_claimed(GCH_PS_jvmti_oops_do)) {
   819   if (_process_strong_tasks->try_claim_task(GCH_PS_jvmti_oops_do)) {
   820     JvmtiExport::oops_do(strong_roots);
   820     JvmtiExport::oops_do(strong_roots);
   821   }
   821   }
   822   if (UseAOT && !_process_strong_tasks->is_task_claimed(GCH_PS_aot_oops_do)) {
   822   if (UseAOT && _process_strong_tasks->try_claim_task(GCH_PS_aot_oops_do)) {
   823     AOTLoader::oops_do(strong_roots);
   823     AOTLoader::oops_do(strong_roots);
   824   }
   824   }
   825 
   825 
   826   if (!_process_strong_tasks->is_task_claimed(GCH_PS_SystemDictionary_oops_do)) {
   826   if (_process_strong_tasks->try_claim_task(GCH_PS_SystemDictionary_oops_do)) {
   827     SystemDictionary::oops_do(strong_roots);
   827     SystemDictionary::oops_do(strong_roots);
   828   }
   828   }
   829 
   829 
   830   if (!_process_strong_tasks->is_task_claimed(GCH_PS_CodeCache_oops_do)) {
   830   if (_process_strong_tasks->try_claim_task(GCH_PS_CodeCache_oops_do)) {
   831     if (so & SO_ScavengeCodeCache) {
   831     if (so & SO_ScavengeCodeCache) {
   832       assert(code_roots != NULL, "must supply closure for code cache");
   832       assert(code_roots != NULL, "must supply closure for code cache");
   833 
   833 
   834       // We only visit parts of the CodeCache when scavenging.
   834       // We only visit parts of the CodeCache when scavenging.
   835       CodeCache::scavenge_root_nmethods_do(code_roots);
   835       CodeCache::scavenge_root_nmethods_do(code_roots);
   874 
   874 
   875   process_roots(scope, SO_ScavengeCodeCache, root_closure,
   875   process_roots(scope, SO_ScavengeCodeCache, root_closure,
   876                 cld_closure, cld_closure, &mark_code_closure);
   876                 cld_closure, cld_closure, &mark_code_closure);
   877   process_string_table_roots(scope, root_closure, par_state_string);
   877   process_string_table_roots(scope, root_closure, par_state_string);
   878 
   878 
   879   if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
   879   if (_process_strong_tasks->try_claim_task(GCH_PS_younger_gens)) {
   880     root_closure->reset_generation();
   880     root_closure->reset_generation();
   881   }
   881   }
   882 
   882 
   883   // When collection is parallel, all threads get to cooperate to do
   883   // When collection is parallel, all threads get to cooperate to do
   884   // old generation scanning.
   884   // old generation scanning.