9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
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 "gc_implementation/parallelScavenge/cardTableExtension.hpp"
27 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
28 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
29 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
30 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
31 #include "gc_implementation/parallelScavenge/psTasks.hpp"
32 #include "gc_implementation/parallelScavenge/psYoungGen.hpp"
33 #include "oops/oop.inline.hpp"
34 #include "oops/oop.psgc.inline.hpp"
35 #include "runtime/prefetch.inline.hpp"
36
37 // Checks an individual oop for missing precise marks. Mark
38 // may be either dirty or newgen.
39 class CheckForUnmarkedOops : public OopClosure {
40 private:
41 PSYoungGen* _young_gen;
42 CardTableExtension* _card_table;
43 HeapWord* _unmarked_addr;
44 jbyte* _unmarked_card;
45
46 protected:
47 template <class T> void do_oop_work(T* p) {
48 oop obj = oopDesc::load_decode_heap_oop(p);
49 if (_young_gen->is_in_reserved(obj) &&
50 !_card_table->addr_is_marked_imprecise(p)) {
51 // Don't overwrite the first missing card mark
52 if (_unmarked_addr == NULL) {
53 _unmarked_addr = (HeapWord*)p;
54 _unmarked_card = _card_table->byte_for(p);
274 to = sp_top;
275 }
276
277 // we know which cards to scan, now clear them
278 if (first_unclean_card <= worker_start_card+1)
279 first_unclean_card = worker_start_card+1;
280 if (following_clean_card >= worker_end_card-1)
281 following_clean_card = worker_end_card-1;
282
283 while (first_unclean_card < following_clean_card) {
284 *first_unclean_card++ = clean_card;
285 }
286
287 const int interval = PrefetchScanIntervalInBytes;
288 // scan all objects in the range
289 if (interval != 0) {
290 while (p < to) {
291 Prefetch::write(p, interval);
292 oop m = oop(p);
293 assert(m->is_oop_or_null(), err_msg("Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m)));
294 m->push_contents(pm);
295 p += m->size();
296 }
297 pm->drain_stacks_cond_depth();
298 } else {
299 while (p < to) {
300 oop m = oop(p);
301 assert(m->is_oop_or_null(), err_msg("Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m)));
302 m->push_contents(pm);
303 p += m->size();
304 }
305 pm->drain_stacks_cond_depth();
306 }
307 last_scanned = p;
308 }
309 // "current_card" is still the "following_clean_card" or
310 // the current_card is >= the worker_end_card so the
311 // loop will not execute again.
312 assert((current_card == following_clean_card) ||
313 (current_card >= worker_end_card),
314 "current_card should only be incremented if it still equals "
315 "following_clean_card");
316 // Increment current_card so that it is not processed again.
317 // It may now be dirty because a old-to-young pointer was
318 // found on it an updated. If it is now dirty, it cannot be
319 // be safely cleaned in the next iteration.
320 current_card++;
321 }
322 }
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
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 "gc_implementation/parallelScavenge/cardTableExtension.hpp"
27 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
28 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
29 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
30 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
31 #include "gc_implementation/parallelScavenge/psTasks.hpp"
32 #include "gc_implementation/parallelScavenge/psYoungGen.hpp"
33 #include "oops/oop.inline.hpp"
34 #include "runtime/prefetch.inline.hpp"
35
36 // Checks an individual oop for missing precise marks. Mark
37 // may be either dirty or newgen.
38 class CheckForUnmarkedOops : public OopClosure {
39 private:
40 PSYoungGen* _young_gen;
41 CardTableExtension* _card_table;
42 HeapWord* _unmarked_addr;
43 jbyte* _unmarked_card;
44
45 protected:
46 template <class T> void do_oop_work(T* p) {
47 oop obj = oopDesc::load_decode_heap_oop(p);
48 if (_young_gen->is_in_reserved(obj) &&
49 !_card_table->addr_is_marked_imprecise(p)) {
50 // Don't overwrite the first missing card mark
51 if (_unmarked_addr == NULL) {
52 _unmarked_addr = (HeapWord*)p;
53 _unmarked_card = _card_table->byte_for(p);
273 to = sp_top;
274 }
275
276 // we know which cards to scan, now clear them
277 if (first_unclean_card <= worker_start_card+1)
278 first_unclean_card = worker_start_card+1;
279 if (following_clean_card >= worker_end_card-1)
280 following_clean_card = worker_end_card-1;
281
282 while (first_unclean_card < following_clean_card) {
283 *first_unclean_card++ = clean_card;
284 }
285
286 const int interval = PrefetchScanIntervalInBytes;
287 // scan all objects in the range
288 if (interval != 0) {
289 while (p < to) {
290 Prefetch::write(p, interval);
291 oop m = oop(p);
292 assert(m->is_oop_or_null(), err_msg("Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m)));
293 pm->push_contents(m);
294 p += m->size();
295 }
296 pm->drain_stacks_cond_depth();
297 } else {
298 while (p < to) {
299 oop m = oop(p);
300 assert(m->is_oop_or_null(), err_msg("Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m)));
301 pm->push_contents(m);
302 p += m->size();
303 }
304 pm->drain_stacks_cond_depth();
305 }
306 last_scanned = p;
307 }
308 // "current_card" is still the "following_clean_card" or
309 // the current_card is >= the worker_end_card so the
310 // loop will not execute again.
311 assert((current_card == following_clean_card) ||
312 (current_card >= worker_end_card),
313 "current_card should only be incremented if it still equals "
314 "following_clean_card");
315 // Increment current_card so that it is not processed again.
316 // It may now be dirty because a old-to-young pointer was
317 // found on it an updated. If it is now dirty, it cannot be
318 // be safely cleaned in the next iteration.
319 current_card++;
320 }
321 }
|