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/parallel/objectStartArray.hpp"
28 #include "gc/parallel/parallelScavengeHeap.hpp"
29 #include "gc/parallel/parMarkBitMap.inline.hpp"
30 #include "gc/parallel/psMarkSweep.hpp"
31 #include "gc/parallel/psMarkSweepDecorator.hpp"
32 #include "gc/parallel/psParallelCompact.inline.hpp"
33 #include "gc/serial/markSweep.inline.hpp"
34 #include "gc/shared/spaceDecorator.hpp"
35 #include "memory/iterator.inline.hpp"
36 #include "oops/oop.inline.hpp"
37 #include "runtime/prefetch.inline.hpp"
38
39 PSMarkSweepDecorator* PSMarkSweepDecorator::_destination_decorator = NULL;
40
41
42 void PSMarkSweepDecorator::set_destination_decorator_tenured() {
43 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
44 _destination_decorator = heap->old_gen()->object_mark_sweep();
45 }
46
47 void PSMarkSweepDecorator::advance_destination_decorator() {
48 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
49
50 assert(_destination_decorator != NULL, "Sanity");
51
52 PSMarkSweepDecorator* first = heap->old_gen()->object_mark_sweep();
241 /* move on to the next object */
242 q = end;
243 }
244 }
245
246 assert(q == t, "just checking");
247 _end_of_live = end_of_live;
248 if (end_of_live < first_dead) {
249 first_dead = end_of_live;
250 }
251 _first_dead = first_dead;
252
253 // Update compaction top
254 dest->set_compaction_top(compact_top);
255 }
256
257 bool PSMarkSweepDecorator::insert_deadspace(size_t& allowed_deadspace_words,
258 HeapWord* q, size_t deadlength) {
259 if (allowed_deadspace_words >= deadlength) {
260 allowed_deadspace_words -= deadlength;
261 CollectedHeap::fill_with_object(q, deadlength);
262 oop(q)->set_mark_raw(oop(q)->mark_raw()->set_marked());
263 assert((int) deadlength == oop(q)->size(), "bad filler object size");
264 // Recall that we required "q == compaction_top".
265 return true;
266 } else {
267 allowed_deadspace_words = 0;
268 return false;
269 }
270 }
271
272 void PSMarkSweepDecorator::adjust_pointers() {
273 // adjust all the interior pointers to point at the new locations of objects
274 // Used by MarkSweep::mark_sweep_phase3()
275
276 HeapWord* q = space()->bottom();
277 HeapWord* t = _end_of_live; // Established by "prepare_for_compaction".
278
279 assert(_first_dead <= _end_of_live, "Stands to reason, no?");
280
281 if (q < t && _first_dead > q &&
|
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/parallel/objectStartArray.hpp"
28 #include "gc/parallel/parallelScavengeHeap.hpp"
29 #include "gc/parallel/parMarkBitMap.inline.hpp"
30 #include "gc/parallel/psMarkSweep.hpp"
31 #include "gc/parallel/psMarkSweepDecorator.hpp"
32 #include "gc/parallel/psParallelCompact.inline.hpp"
33 #include "gc/shared/fill.hpp"
34 #include "gc/serial/markSweep.inline.hpp"
35 #include "gc/shared/spaceDecorator.hpp"
36 #include "memory/iterator.inline.hpp"
37 #include "oops/oop.inline.hpp"
38 #include "runtime/prefetch.inline.hpp"
39
40 PSMarkSweepDecorator* PSMarkSweepDecorator::_destination_decorator = NULL;
41
42
43 void PSMarkSweepDecorator::set_destination_decorator_tenured() {
44 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
45 _destination_decorator = heap->old_gen()->object_mark_sweep();
46 }
47
48 void PSMarkSweepDecorator::advance_destination_decorator() {
49 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
50
51 assert(_destination_decorator != NULL, "Sanity");
52
53 PSMarkSweepDecorator* first = heap->old_gen()->object_mark_sweep();
242 /* move on to the next object */
243 q = end;
244 }
245 }
246
247 assert(q == t, "just checking");
248 _end_of_live = end_of_live;
249 if (end_of_live < first_dead) {
250 first_dead = end_of_live;
251 }
252 _first_dead = first_dead;
253
254 // Update compaction top
255 dest->set_compaction_top(compact_top);
256 }
257
258 bool PSMarkSweepDecorator::insert_deadspace(size_t& allowed_deadspace_words,
259 HeapWord* q, size_t deadlength) {
260 if (allowed_deadspace_words >= deadlength) {
261 allowed_deadspace_words -= deadlength;
262 Fill::range(q, deadlength);
263 oop(q)->set_mark_raw(oop(q)->mark_raw()->set_marked());
264 assert((int) deadlength == oop(q)->size(), "bad filler object size");
265 // Recall that we required "q == compaction_top".
266 return true;
267 } else {
268 allowed_deadspace_words = 0;
269 return false;
270 }
271 }
272
273 void PSMarkSweepDecorator::adjust_pointers() {
274 // adjust all the interior pointers to point at the new locations of objects
275 // Used by MarkSweep::mark_sweep_phase3()
276
277 HeapWord* q = space()->bottom();
278 HeapWord* t = _end_of_live; // Established by "prepare_for_compaction".
279
280 assert(_first_dead <= _end_of_live, "Stands to reason, no?");
281
282 if (q < t && _first_dead > q &&
|