hotspot/src/share/vm/utilities/workgroup.cpp
changeset 13195 be27e1b6a4b9
parent 11396 917d8673b5ef
child 13963 e5b53c306fb5
equal deleted inserted replaced
13099:64752e56d721 13195:be27e1b6a4b9
    75   if (TraceWorkGang) {
    75   if (TraceWorkGang) {
    76     tty->print_cr("Constructing work gang %s with %d threads",
    76     tty->print_cr("Constructing work gang %s with %d threads",
    77                   name(),
    77                   name(),
    78                   total_workers());
    78                   total_workers());
    79   }
    79   }
    80   _gang_workers = NEW_C_HEAP_ARRAY(GangWorker*, total_workers());
    80   _gang_workers = NEW_C_HEAP_ARRAY(GangWorker*, total_workers(), mtInternal);
    81   if (gang_workers() == NULL) {
    81   if (gang_workers() == NULL) {
    82     vm_exit_out_of_memory(0, "Cannot create GangWorker array.");
    82     vm_exit_out_of_memory(0, "Cannot create GangWorker array.");
    83     return false;
    83     return false;
    84   }
    84   }
    85   os::ThreadType worker_type;
    85   os::ThreadType worker_type;
   239   loop();
   239   loop();
   240 }
   240 }
   241 
   241 
   242 void GangWorker::initialize() {
   242 void GangWorker::initialize() {
   243   this->initialize_thread_local_storage();
   243   this->initialize_thread_local_storage();
       
   244   this->record_stack_base_and_size();
   244   assert(_gang != NULL, "No gang to run in");
   245   assert(_gang != NULL, "No gang to run in");
   245   os::set_priority(this, NearMaxPriority);
   246   os::set_priority(this, NearMaxPriority);
   246   if (TraceWorkGang) {
   247   if (TraceWorkGang) {
   247     tty->print_cr("Running gang worker for gang %s id %d",
   248     tty->print_cr("Running gang worker for gang %s id %d",
   248                   gang()->name(), id());
   249                   gang()->name(), id());
   419 
   420 
   420 // SubTasksDone functions.
   421 // SubTasksDone functions.
   421 
   422 
   422 SubTasksDone::SubTasksDone(uint n) :
   423 SubTasksDone::SubTasksDone(uint n) :
   423   _n_tasks(n), _n_threads(1), _tasks(NULL) {
   424   _n_tasks(n), _n_threads(1), _tasks(NULL) {
   424   _tasks = NEW_C_HEAP_ARRAY(uint, n);
   425   _tasks = NEW_C_HEAP_ARRAY(uint, n, mtInternal);
   425   guarantee(_tasks != NULL, "alloc failure");
   426   guarantee(_tasks != NULL, "alloc failure");
   426   clear();
   427   clear();
   427 }
   428 }
   428 
   429 
   429 bool SubTasksDone::valid() {
   430 bool SubTasksDone::valid() {
   474   if (observed+1 == (jint)_n_threads) clear();
   475   if (observed+1 == (jint)_n_threads) clear();
   475 }
   476 }
   476 
   477 
   477 
   478 
   478 SubTasksDone::~SubTasksDone() {
   479 SubTasksDone::~SubTasksDone() {
   479   if (_tasks != NULL) FREE_C_HEAP_ARRAY(jint, _tasks);
   480   if (_tasks != NULL) FREE_C_HEAP_ARRAY(jint, _tasks, mtInternal);
   480 }
   481 }
   481 
   482 
   482 // *** SequentialSubTasksDone
   483 // *** SequentialSubTasksDone
   483 
   484 
   484 void SequentialSubTasksDone::clear() {
   485 void SequentialSubTasksDone::clear() {