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 add_workers(_active_workers, initializing);
59 }
60
61 void AbstractWorkGang::add_workers(uint active_workers, bool initializing) {
62
63 os::ThreadType worker_type;
64 if (are_ConcurrentGC_threads()) {
65 worker_type = os::cgc_thread;
66 } else {
67 worker_type = os::pgc_thread;
68 }
69
70 _created_workers = WorkerManager::add_workers(this,
71 active_workers,
72 _total_workers,
73 _created_workers,
74 worker_type,
75 initializing);
76 _active_workers = MIN2(_created_workers, _active_workers);
77 }
78
79 AbstractGangWorker* AbstractWorkGang::worker(uint i) const {
80 // Array index bounds checking.
81 AbstractGangWorker* result = NULL;
82 assert(_workers != NULL, "No workers for indexing");
83 assert(i < total_workers(), "Worker index out of bounds");
84 result = _workers[i];
85 assert(result != NULL, "Indexing to null worker");
86 return result;
87 }
88
89 void AbstractWorkGang::print_worker_threads_on(outputStream* st) const {
90 uint workers = created_workers();
91 for (uint i = 0; i < workers; i++) {
92 worker(i)->print_on(st);
93 st->cr();
94 }
95 }
96
|
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 add_workers(_active_workers, initializing);
59 }
60
61 void AbstractWorkGang::add_workers(uint active_workers, bool initializing) {
62
63 os::ThreadType worker_type;
64 if (are_ConcurrentGC_threads()) {
65 worker_type = os::cgc_thread;
66 } else {
67 worker_type = os::pgc_thread;
68 }
69 uint previous_created_workers = _created_workers;
70
71 _created_workers = WorkerManager::add_workers(this,
72 active_workers,
73 _total_workers,
74 _created_workers,
75 worker_type,
76 initializing);
77 _active_workers = MIN2(_created_workers, _active_workers);
78
79 WorkerManager::log_worker_creation(this, previous_created_workers, _active_workers, _created_workers, initializing);
80 }
81
82 AbstractGangWorker* AbstractWorkGang::worker(uint i) const {
83 // Array index bounds checking.
84 AbstractGangWorker* result = NULL;
85 assert(_workers != NULL, "No workers for indexing");
86 assert(i < total_workers(), "Worker index out of bounds");
87 result = _workers[i];
88 assert(result != NULL, "Indexing to null worker");
89 return result;
90 }
91
92 void AbstractWorkGang::print_worker_threads_on(outputStream* st) const {
93 uint workers = created_workers();
94 for (uint i = 0; i < workers; i++) {
95 worker(i)->print_on(st);
96 st->cr();
97 }
98 }
99
|