95
96 // Update active workers to the lower of the limits.
97 uint worker_count = MIN2(heap_waste_worker_limit, adaptive_worker_limit);
98 log_debug(gc, task)("Requesting %u active workers for full compaction (waste limited workers: %u, adaptive workers: %u)",
99 worker_count, heap_waste_worker_limit, adaptive_worker_limit);
100 worker_count = heap->workers()->update_active_workers(worker_count);
101 log_info(gc, task)("Using %u workers of %u for full compaction", worker_count, max_worker_count);
102
103 return worker_count;
104 }
105
106 G1FullCollector::G1FullCollector(G1CollectedHeap* heap, GCMemoryManager* memory_manager, bool explicit_gc, bool clear_soft_refs) :
107 _heap(heap),
108 _scope(memory_manager, explicit_gc, clear_soft_refs),
109 _num_workers(calc_active_workers()),
110 _oop_queue_set(_num_workers),
111 _array_queue_set(_num_workers),
112 _preserved_marks_set(true),
113 _serial_compaction_point(),
114 _is_alive(heap->concurrent_mark()->next_mark_bitmap()),
115 _is_alive_mutator(heap->ref_processor_stw(), &_is_alive) {
116 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
117
118 _preserved_marks_set.init(_num_workers);
119 _markers = NEW_C_HEAP_ARRAY(G1FullGCMarker*, _num_workers, mtGC);
120 _compaction_points = NEW_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _num_workers, mtGC);
121 for (uint i = 0; i < _num_workers; i++) {
122 _markers[i] = new G1FullGCMarker(i, _preserved_marks_set.get(i), mark_bitmap());
123 _compaction_points[i] = new G1FullGCCompactionPoint();
124 _oop_queue_set.register_queue(i, marker(i)->oop_stack());
125 _array_queue_set.register_queue(i, marker(i)->objarray_stack());
126 }
127 }
128
129 G1FullCollector::~G1FullCollector() {
130 for (uint i = 0; i < _num_workers; i++) {
131 delete _markers[i];
132 delete _compaction_points[i];
133 }
134 FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers);
135 FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points);
|
95
96 // Update active workers to the lower of the limits.
97 uint worker_count = MIN2(heap_waste_worker_limit, adaptive_worker_limit);
98 log_debug(gc, task)("Requesting %u active workers for full compaction (waste limited workers: %u, adaptive workers: %u)",
99 worker_count, heap_waste_worker_limit, adaptive_worker_limit);
100 worker_count = heap->workers()->update_active_workers(worker_count);
101 log_info(gc, task)("Using %u workers of %u for full compaction", worker_count, max_worker_count);
102
103 return worker_count;
104 }
105
106 G1FullCollector::G1FullCollector(G1CollectedHeap* heap, GCMemoryManager* memory_manager, bool explicit_gc, bool clear_soft_refs) :
107 _heap(heap),
108 _scope(memory_manager, explicit_gc, clear_soft_refs),
109 _num_workers(calc_active_workers()),
110 _oop_queue_set(_num_workers),
111 _array_queue_set(_num_workers),
112 _preserved_marks_set(true),
113 _serial_compaction_point(),
114 _is_alive(heap->concurrent_mark()->next_mark_bitmap()),
115 _is_alive_mutator(heap->ref_processor_stw(), &_is_alive),
116 _always_subject_to_discovery(),
117 _is_subject_mutator(heap->ref_processor_stw(), &_always_subject_to_discovery) {
118 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
119
120 _preserved_marks_set.init(_num_workers);
121 _markers = NEW_C_HEAP_ARRAY(G1FullGCMarker*, _num_workers, mtGC);
122 _compaction_points = NEW_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _num_workers, mtGC);
123 for (uint i = 0; i < _num_workers; i++) {
124 _markers[i] = new G1FullGCMarker(i, _preserved_marks_set.get(i), mark_bitmap());
125 _compaction_points[i] = new G1FullGCCompactionPoint();
126 _oop_queue_set.register_queue(i, marker(i)->oop_stack());
127 _array_queue_set.register_queue(i, marker(i)->objarray_stack());
128 }
129 }
130
131 G1FullCollector::~G1FullCollector() {
132 for (uint i = 0; i < _num_workers; i++) {
133 delete _markers[i];
134 delete _compaction_points[i];
135 }
136 FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers);
137 FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points);
|