11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/systemDictionary.hpp"
27 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
28 #include "gc_implementation/parallelScavenge/objectStartArray.hpp"
29 #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp"
30 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
31 #include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
32 #include "gc_implementation/parallelScavenge/psOldGen.hpp"
33 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
34 #include "oops/objArrayKlass.inline.hpp"
35 #include "oops/oop.inline.hpp"
36 #include "oops/oop.pcgc.inline.hpp"
37 #include "runtime/atomic.inline.hpp"
38 #include "utilities/stack.inline.hpp"
39
40 PSOldGen* ParCompactionManager::_old_gen = NULL;
41 ParCompactionManager** ParCompactionManager::_manager_array = NULL;
42
43 RegionTaskQueue** ParCompactionManager::_region_list = NULL;
44
45 OopTaskQueueSet* ParCompactionManager::_stack_array = NULL;
46 ParCompactionManager::ObjArrayTaskQueueSet*
47 ParCompactionManager::_objarray_queues = NULL;
48 ObjectStartArray* ParCompactionManager::_start_array = NULL;
49 ParMarkBitMap* ParCompactionManager::_mark_bitmap = NULL;
50 RegionTaskQueueSet* ParCompactionManager::_region_array = NULL;
51
52 uint* ParCompactionManager::_recycled_stack_index = NULL;
53 int ParCompactionManager::_recycled_top = -1;
54 int ParCompactionManager::_recycled_bottom = -1;
55
56 ParCompactionManager::ParCompactionManager() :
163 size_t region_index) {
164 region_list(list_index)->push(region_index);
165 }
166
167 void ParCompactionManager::verify_region_list_empty(uint list_index) {
168 assert(region_list(list_index)->is_empty(), "Not empty");
169 }
170
171 ParCompactionManager*
172 ParCompactionManager::gc_thread_compaction_manager(int index) {
173 assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range");
174 assert(_manager_array != NULL, "Sanity");
175 return _manager_array[index];
176 }
177
178 void ParCompactionManager::follow_marking_stacks() {
179 do {
180 // Drain the overflow stack first, to allow stealing from the marking stack.
181 oop obj;
182 while (marking_stack()->pop_overflow(obj)) {
183 obj->follow_contents(this);
184 }
185 while (marking_stack()->pop_local(obj)) {
186 obj->follow_contents(this);
187 }
188
189 // Process ObjArrays one at a time to avoid marking stack bloat.
190 ObjArrayTask task;
191 if (_objarray_stack.pop_overflow(task) || _objarray_stack.pop_local(task)) {
192 ObjArrayKlass* k = (ObjArrayKlass*)task.obj()->klass();
193 k->oop_follow_contents(this, task.obj(), task.index());
194 }
195 } while (!marking_stacks_empty());
196
197 assert(marking_stacks_empty(), "Sanity");
198 }
199
200 void ParCompactionManager::drain_region_stacks() {
201 do {
202 // Drain overflow stack first so other threads can steal.
203 size_t region_index;
204 while (region_stack()->pop_overflow(region_index)) {
205 PSParallelCompact::fill_and_update_region(this, region_index);
206 }
207
208 while (region_stack()->pop_local(region_index)) {
209 PSParallelCompact::fill_and_update_region(this, region_index);
210 }
211 } while (!region_stack()->is_empty());
212 }
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/systemDictionary.hpp"
27 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
28 #include "gc_implementation/parallelScavenge/objectStartArray.hpp"
29 #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp"
30 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
31 #include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp"
32 #include "gc_implementation/parallelScavenge/psOldGen.hpp"
33 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
34 #include "oops/objArrayKlass.inline.hpp"
35 #include "oops/oop.inline.hpp"
36 #include "runtime/atomic.inline.hpp"
37 #include "utilities/stack.inline.hpp"
38
39 PSOldGen* ParCompactionManager::_old_gen = NULL;
40 ParCompactionManager** ParCompactionManager::_manager_array = NULL;
41
42 RegionTaskQueue** ParCompactionManager::_region_list = NULL;
43
44 OopTaskQueueSet* ParCompactionManager::_stack_array = NULL;
45 ParCompactionManager::ObjArrayTaskQueueSet*
46 ParCompactionManager::_objarray_queues = NULL;
47 ObjectStartArray* ParCompactionManager::_start_array = NULL;
48 ParMarkBitMap* ParCompactionManager::_mark_bitmap = NULL;
49 RegionTaskQueueSet* ParCompactionManager::_region_array = NULL;
50
51 uint* ParCompactionManager::_recycled_stack_index = NULL;
52 int ParCompactionManager::_recycled_top = -1;
53 int ParCompactionManager::_recycled_bottom = -1;
54
55 ParCompactionManager::ParCompactionManager() :
162 size_t region_index) {
163 region_list(list_index)->push(region_index);
164 }
165
166 void ParCompactionManager::verify_region_list_empty(uint list_index) {
167 assert(region_list(list_index)->is_empty(), "Not empty");
168 }
169
170 ParCompactionManager*
171 ParCompactionManager::gc_thread_compaction_manager(int index) {
172 assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range");
173 assert(_manager_array != NULL, "Sanity");
174 return _manager_array[index];
175 }
176
177 void ParCompactionManager::follow_marking_stacks() {
178 do {
179 // Drain the overflow stack first, to allow stealing from the marking stack.
180 oop obj;
181 while (marking_stack()->pop_overflow(obj)) {
182 follow_contents(obj);
183 }
184 while (marking_stack()->pop_local(obj)) {
185 follow_contents(obj);
186 }
187
188 // Process ObjArrays one at a time to avoid marking stack bloat.
189 ObjArrayTask task;
190 if (_objarray_stack.pop_overflow(task) || _objarray_stack.pop_local(task)) {
191 follow_contents((objArrayOop)task.obj(), task.index());
192 }
193 } while (!marking_stacks_empty());
194
195 assert(marking_stacks_empty(), "Sanity");
196 }
197
198 void ParCompactionManager::drain_region_stacks() {
199 do {
200 // Drain overflow stack first so other threads can steal.
201 size_t region_index;
202 while (region_stack()->pop_overflow(region_index)) {
203 PSParallelCompact::fill_and_update_region(this, region_index);
204 }
205
206 while (region_stack()->pop_local(region_index)) {
207 PSParallelCompact::fill_and_update_region(this, region_index);
208 }
209 } while (!region_stack()->is_empty());
210 }
|