55 SH_PS_NumElements
56 };
57
58 SharedHeap::SharedHeap(CollectorPolicy* policy_) :
59 CollectedHeap(),
60 _collector_policy(policy_),
61 _rem_set(NULL),
62 _strong_roots_scope(NULL),
63 _strong_roots_parity(0),
64 _process_strong_tasks(new SubTasksDone(SH_PS_NumElements)),
65 _workers(NULL)
66 {
67 if (_process_strong_tasks == NULL || !_process_strong_tasks->valid()) {
68 vm_exit_during_initialization("Failed necessary allocation.");
69 }
70 _sh = this; // ch is static, should be set only once.
71 if ((UseParNewGC ||
72 (UseConcMarkSweepGC && (CMSParallelInitialMarkEnabled ||
73 CMSParallelRemarkEnabled)) ||
74 UseG1GC) &&
75 ParallelGCThreads > 0) {
76 _workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads,
77 /* are_GC_task_threads */true,
78 /* are_ConcurrentGC_threads */false);
79 if (_workers == NULL) {
80 vm_exit_during_initialization("Failed necessary allocation.");
81 } else {
82 _workers->initialize_workers();
83 }
84 }
85 }
86
87 int SharedHeap::n_termination() {
88 return _process_strong_tasks->n_threads();
89 }
90
91 void SharedHeap::set_n_termination(int t) {
92 _process_strong_tasks->set_n_threads(t);
93 }
94
95 bool SharedHeap::heap_lock_held_for_gc() {
|
55 SH_PS_NumElements
56 };
57
58 SharedHeap::SharedHeap(CollectorPolicy* policy_) :
59 CollectedHeap(),
60 _collector_policy(policy_),
61 _rem_set(NULL),
62 _strong_roots_scope(NULL),
63 _strong_roots_parity(0),
64 _process_strong_tasks(new SubTasksDone(SH_PS_NumElements)),
65 _workers(NULL)
66 {
67 if (_process_strong_tasks == NULL || !_process_strong_tasks->valid()) {
68 vm_exit_during_initialization("Failed necessary allocation.");
69 }
70 _sh = this; // ch is static, should be set only once.
71 if ((UseParNewGC ||
72 (UseConcMarkSweepGC && (CMSParallelInitialMarkEnabled ||
73 CMSParallelRemarkEnabled)) ||
74 UseG1GC) &&
75 use_parallel_gc_threads()) {
76 _workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads,
77 /* are_GC_task_threads */true,
78 /* are_ConcurrentGC_threads */false);
79 if (_workers == NULL) {
80 vm_exit_during_initialization("Failed necessary allocation.");
81 } else {
82 _workers->initialize_workers();
83 }
84 }
85 }
86
87 int SharedHeap::n_termination() {
88 return _process_strong_tasks->n_threads();
89 }
90
91 void SharedHeap::set_n_termination(int t) {
92 _process_strong_tasks->set_n_threads(t);
93 }
94
95 bool SharedHeap::heap_lock_held_for_gc() {
|