equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2018, 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. |
110 HeapWord* first_dead = space()->end(); /* The first dead object. */ |
110 HeapWord* first_dead = space()->end(); /* The first dead object. */ |
111 |
111 |
112 const intx interval = PrefetchScanIntervalInBytes; |
112 const intx interval = PrefetchScanIntervalInBytes; |
113 |
113 |
114 while (q < t) { |
114 while (q < t) { |
115 assert(oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() || |
115 assert(oop(q)->mark_raw()->is_marked() || oop(q)->mark_raw()->is_unlocked() || |
116 oop(q)->mark()->has_bias_pattern(), |
116 oop(q)->mark_raw()->has_bias_pattern(), |
117 "these are the only valid states during a mark sweep"); |
117 "these are the only valid states during a mark sweep"); |
118 if (oop(q)->is_gc_marked()) { |
118 if (oop(q)->is_gc_marked()) { |
119 /* prefetch beyond q */ |
119 /* prefetch beyond q */ |
120 Prefetch::write(q, interval); |
120 Prefetch::write(q, interval); |
121 size_t size = oop(q)->size(); |
121 size_t size = oop(q)->size(); |
148 oop(q)->forward_to(oop(compact_top)); |
148 oop(q)->forward_to(oop(compact_top)); |
149 assert(oop(q)->is_gc_marked(), "encoding the pointer should preserve the mark"); |
149 assert(oop(q)->is_gc_marked(), "encoding the pointer should preserve the mark"); |
150 } else { |
150 } else { |
151 // if the object isn't moving we can just set the mark to the default |
151 // if the object isn't moving we can just set the mark to the default |
152 // mark and handle it specially later on. |
152 // mark and handle it specially later on. |
153 oop(q)->init_mark(); |
153 oop(q)->init_mark_raw(); |
154 assert(oop(q)->forwardee() == NULL, "should be forwarded to NULL"); |
154 assert(oop(q)->forwardee() == NULL, "should be forwarded to NULL"); |
155 } |
155 } |
156 |
156 |
157 // Update object start array |
157 // Update object start array |
158 if (start_array) { |
158 if (start_array) { |
208 oop(q)->forward_to(oop(compact_top)); |
208 oop(q)->forward_to(oop(compact_top)); |
209 assert(oop(q)->is_gc_marked(), "encoding the pointer should preserve the mark"); |
209 assert(oop(q)->is_gc_marked(), "encoding the pointer should preserve the mark"); |
210 } else { |
210 } else { |
211 // if the object isn't moving we can just set the mark to the default |
211 // if the object isn't moving we can just set the mark to the default |
212 // mark and handle it specially later on. |
212 // mark and handle it specially later on. |
213 oop(q)->init_mark(); |
213 oop(q)->init_mark_raw(); |
214 assert(oop(q)->forwardee() == NULL, "should be forwarded to NULL"); |
214 assert(oop(q)->forwardee() == NULL, "should be forwarded to NULL"); |
215 } |
215 } |
216 |
216 |
217 // Update object start array |
217 // Update object start array |
218 if (start_array) { |
218 if (start_array) { |
256 bool PSMarkSweepDecorator::insert_deadspace(size_t& allowed_deadspace_words, |
256 bool PSMarkSweepDecorator::insert_deadspace(size_t& allowed_deadspace_words, |
257 HeapWord* q, size_t deadlength) { |
257 HeapWord* q, size_t deadlength) { |
258 if (allowed_deadspace_words >= deadlength) { |
258 if (allowed_deadspace_words >= deadlength) { |
259 allowed_deadspace_words -= deadlength; |
259 allowed_deadspace_words -= deadlength; |
260 CollectedHeap::fill_with_object(q, deadlength); |
260 CollectedHeap::fill_with_object(q, deadlength); |
261 oop(q)->set_mark(oop(q)->mark()->set_marked()); |
261 oop(q)->set_mark_raw(oop(q)->mark_raw()->set_marked()); |
262 assert((int) deadlength == oop(q)->size(), "bad filler object size"); |
262 assert((int) deadlength == oop(q)->size(), "bad filler object size"); |
263 // Recall that we required "q == compaction_top". |
263 // Recall that we required "q == compaction_top". |
264 return true; |
264 return true; |
265 } else { |
265 } else { |
266 allowed_deadspace_words = 0; |
266 allowed_deadspace_words = 0; |
347 |
347 |
348 if (_first_dead == t) { |
348 if (_first_dead == t) { |
349 q = t; |
349 q = t; |
350 } else { |
350 } else { |
351 // $$$ Funky |
351 // $$$ Funky |
352 q = (HeapWord*) oop(_first_dead)->mark()->decode_pointer(); |
352 q = (HeapWord*) oop(_first_dead)->mark_raw()->decode_pointer(); |
353 } |
353 } |
354 } |
354 } |
355 |
355 |
356 const intx scan_interval = PrefetchScanIntervalInBytes; |
356 const intx scan_interval = PrefetchScanIntervalInBytes; |
357 const intx copy_interval = PrefetchCopyIntervalInBytes; |
357 const intx copy_interval = PrefetchCopyIntervalInBytes; |
358 |
358 |
359 while (q < t) { |
359 while (q < t) { |
360 if (!oop(q)->is_gc_marked()) { |
360 if (!oop(q)->is_gc_marked()) { |
361 // mark is pointer to next marked oop |
361 // mark is pointer to next marked oop |
362 debug_only(prev_q = q); |
362 debug_only(prev_q = q); |
363 q = (HeapWord*) oop(q)->mark()->decode_pointer(); |
363 q = (HeapWord*) oop(q)->mark_raw()->decode_pointer(); |
364 assert(q > prev_q, "we should be moving forward through memory"); |
364 assert(q > prev_q, "we should be moving forward through memory"); |
365 } else { |
365 } else { |
366 // prefetch beyond q |
366 // prefetch beyond q |
367 Prefetch::read(q, scan_interval); |
367 Prefetch::read(q, scan_interval); |
368 |
368 |
374 Prefetch::write(compaction_top, copy_interval); |
374 Prefetch::write(compaction_top, copy_interval); |
375 |
375 |
376 // copy object and reinit its mark |
376 // copy object and reinit its mark |
377 assert(q != compaction_top, "everything in this pass should be moving"); |
377 assert(q != compaction_top, "everything in this pass should be moving"); |
378 Copy::aligned_conjoint_words(q, compaction_top, size); |
378 Copy::aligned_conjoint_words(q, compaction_top, size); |
379 oop(compaction_top)->init_mark(); |
379 oop(compaction_top)->init_mark_raw(); |
380 assert(oop(compaction_top)->klass() != NULL, "should have a class"); |
380 assert(oop(compaction_top)->klass() != NULL, "should have a class"); |
381 |
381 |
382 debug_only(prev_q = q); |
382 debug_only(prev_q = q); |
383 q += size; |
383 q += size; |
384 } |
384 } |