< prev index next >

src/share/vm/gc/shared/workgroup.cpp

Print this page
rev 11259 : 8157373: Active workers should not be reset in AbstractWorkGang initialize()
Reviewed-by:


  27 #include "gc/shared/workgroup.hpp"
  28 #include "gc/shared/workerManager.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "memory/allocation.inline.hpp"
  31 #include "runtime/atomic.inline.hpp"
  32 #include "runtime/os.hpp"
  33 #include "runtime/semaphore.hpp"
  34 #include "runtime/thread.inline.hpp"
  35 
  36 // Definitions of WorkGang methods.
  37 
  38 // The current implementation will exit if the allocation
  39 // of any worker fails.
  40 void  AbstractWorkGang::initialize_workers() {
  41   log_develop_trace(gc, workgang)("Constructing work gang %s with %u threads", name(), total_workers());
  42   _workers = NEW_C_HEAP_ARRAY(AbstractGangWorker*, total_workers(), mtInternal);
  43   if (_workers == NULL) {
  44     vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GangWorker array.");
  45   }
  46 
  47   _active_workers = ParallelGCThreads;
  48   if (UseDynamicNumberOfGCThreads && !FLAG_IS_CMDLINE(ParallelGCThreads)) {
  49     _active_workers = 1U;
  50   }
  51 
  52   add_workers(true);
  53 }
  54 
  55 
  56 AbstractGangWorker* AbstractWorkGang::install_worker(uint worker_id) {
  57   AbstractGangWorker* new_worker = allocate_worker(worker_id);
  58   set_thread(worker_id, new_worker);
  59   return new_worker;
  60 }
  61 
  62 void AbstractWorkGang::add_workers(bool initializing) {
  63 
  64   os::ThreadType worker_type;
  65   if (are_ConcurrentGC_threads()) {
  66     worker_type = os::cgc_thread;
  67   } else {
  68     worker_type = os::pgc_thread;
  69   }
  70 
  71   _created_workers = WorkerManager::add_workers(this,




  27 #include "gc/shared/workgroup.hpp"
  28 #include "gc/shared/workerManager.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "memory/allocation.inline.hpp"
  31 #include "runtime/atomic.inline.hpp"
  32 #include "runtime/os.hpp"
  33 #include "runtime/semaphore.hpp"
  34 #include "runtime/thread.inline.hpp"
  35 
  36 // Definitions of WorkGang methods.
  37 
  38 // The current implementation will exit if the allocation
  39 // of any worker fails.
  40 void  AbstractWorkGang::initialize_workers() {
  41   log_develop_trace(gc, workgang)("Constructing work gang %s with %u threads", name(), total_workers());
  42   _workers = NEW_C_HEAP_ARRAY(AbstractGangWorker*, total_workers(), mtInternal);
  43   if (_workers == NULL) {
  44     vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GangWorker array.");
  45   }
  46 





  47   add_workers(true);
  48 }
  49 
  50 
  51 AbstractGangWorker* AbstractWorkGang::install_worker(uint worker_id) {
  52   AbstractGangWorker* new_worker = allocate_worker(worker_id);
  53   set_thread(worker_id, new_worker);
  54   return new_worker;
  55 }
  56 
  57 void AbstractWorkGang::add_workers(bool initializing) {
  58 
  59   os::ThreadType worker_type;
  60   if (are_ConcurrentGC_threads()) {
  61     worker_type = os::cgc_thread;
  62   } else {
  63     worker_type = os::pgc_thread;
  64   }
  65 
  66   _created_workers = WorkerManager::add_workers(this,


< prev index next >