1 /* |
1 /* |
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
30 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" |
30 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" |
31 #include "gc_implementation/parallelScavenge/psCompactionManager.hpp" |
31 #include "gc_implementation/parallelScavenge/psCompactionManager.hpp" |
32 #include "gc_implementation/parallelScavenge/psOldGen.hpp" |
32 #include "gc_implementation/parallelScavenge/psOldGen.hpp" |
33 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" |
33 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" |
34 #include "oops/objArrayKlass.inline.hpp" |
34 #include "oops/objArrayKlass.inline.hpp" |
35 #include "oops/oop.hpp" |
|
36 #include "oops/oop.inline.hpp" |
35 #include "oops/oop.inline.hpp" |
37 #include "oops/oop.pcgc.inline.hpp" |
36 #include "oops/oop.pcgc.inline.hpp" |
38 #include "utilities/stack.inline.hpp" |
37 #include "utilities/stack.inline.hpp" |
39 |
38 |
40 PSOldGen* ParCompactionManager::_old_gen = NULL; |
39 PSOldGen* ParCompactionManager::_old_gen = NULL; |
173 assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range"); |
172 assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range"); |
174 assert(_manager_array != NULL, "Sanity"); |
173 assert(_manager_array != NULL, "Sanity"); |
175 return _manager_array[index]; |
174 return _manager_array[index]; |
176 } |
175 } |
177 |
176 |
178 void ParCompactionManager::reset() { |
|
179 for(uint i = 0; i < ParallelGCThreads + 1; i++) { |
|
180 assert(manager_array(i)->revisit_klass_stack()->is_empty(), "sanity"); |
|
181 assert(manager_array(i)->revisit_mdo_stack()->is_empty(), "sanity"); |
|
182 } |
|
183 } |
|
184 |
|
185 void ParCompactionManager::follow_marking_stacks() { |
177 void ParCompactionManager::follow_marking_stacks() { |
186 do { |
178 do { |
187 // Drain the overflow stack first, to allow stealing from the marking stack. |
179 // Drain the overflow stack first, to allow stealing from the marking stack. |
188 oop obj; |
180 oop obj; |
189 while (marking_stack()->pop_overflow(obj)) { |
181 while (marking_stack()->pop_overflow(obj)) { |
194 } |
186 } |
195 |
187 |
196 // Process ObjArrays one at a time to avoid marking stack bloat. |
188 // Process ObjArrays one at a time to avoid marking stack bloat. |
197 ObjArrayTask task; |
189 ObjArrayTask task; |
198 if (_objarray_stack.pop_overflow(task)) { |
190 if (_objarray_stack.pop_overflow(task)) { |
199 objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint(); |
191 objArrayKlass* const k = (objArrayKlass*)task.obj()->klass(); |
200 k->oop_follow_contents(this, task.obj(), task.index()); |
192 k->oop_follow_contents(this, task.obj(), task.index()); |
201 } else if (_objarray_stack.pop_local(task)) { |
193 } else if (_objarray_stack.pop_local(task)) { |
202 objArrayKlass* const k = (objArrayKlass*)task.obj()->blueprint(); |
194 objArrayKlass* const k = (objArrayKlass*)task.obj()->klass(); |
203 k->oop_follow_contents(this, task.obj(), task.index()); |
195 k->oop_follow_contents(this, task.obj(), task.index()); |
204 } |
196 } |
205 } while (!marking_stacks_empty()); |
197 } while (!marking_stacks_empty()); |
206 |
198 |
207 assert(marking_stacks_empty(), "Sanity"); |
199 assert(marking_stacks_empty(), "Sanity"); |