Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/g1RemSet.cpp @ 20335:eec72fa4b108
8040722: G1: Clean up usages of heap_region_containing
Reviewed-by: tschatzl, jmasa
author | brutisso |
---|---|
date | Tue, 19 Aug 2014 12:39:06 +0200 |
parents | 02e61cf08ab3 |
children | 1f1d373cd044 |
comparison
equal
deleted
inserted
replaced
20334:ff3169f25621 | 20335:eec72fa4b108 |
---|---|
209 gclog_or_tty->print("Rem set iteration yielded card [" PTR_FORMAT ", " PTR_FORMAT ").\n", | 209 gclog_or_tty->print("Rem set iteration yielded card [" PTR_FORMAT ", " PTR_FORMAT ").\n", |
210 card_start, card_start + CardTableModRefBS::card_size_in_words); | 210 card_start, card_start + CardTableModRefBS::card_size_in_words); |
211 #endif | 211 #endif |
212 | 212 |
213 HeapRegion* card_region = _g1h->heap_region_containing(card_start); | 213 HeapRegion* card_region = _g1h->heap_region_containing(card_start); |
214 assert(card_region != NULL, "Yielding cards not in the heap?"); | |
215 _cards++; | 214 _cards++; |
216 | 215 |
217 if (!card_region->is_on_dirty_cards_region_list()) { | 216 if (!card_region->is_on_dirty_cards_region_list()) { |
218 _g1h->push_dirty_cards_region(card_region); | 217 _g1h->push_dirty_cards_region(card_region); |
219 } | 218 } |
404 bool do_card_ptr(jbyte* card_ptr, uint worker_i) { | 403 bool do_card_ptr(jbyte* card_ptr, uint worker_i) { |
405 // Construct the region representing the card. | 404 // Construct the region representing the card. |
406 HeapWord* start = _ct_bs->addr_for(card_ptr); | 405 HeapWord* start = _ct_bs->addr_for(card_ptr); |
407 // And find the region containing it. | 406 // And find the region containing it. |
408 HeapRegion* r = _g1->heap_region_containing(start); | 407 HeapRegion* r = _g1->heap_region_containing(start); |
409 assert(r != NULL, "unexpected null"); | |
410 | 408 |
411 // Scan oops in the card looking for references into the collection set | 409 // Scan oops in the card looking for references into the collection set |
412 // Don't use addr_for(card_ptr + 1) which can ask for | 410 // Don't use addr_for(card_ptr + 1) which can ask for |
413 // a card beyond the heap. This is not safe without a perm | 411 // a card beyond the heap. This is not safe without a perm |
414 // gen. | 412 // gen. |
566 | 564 |
567 // Construct the region representing the card. | 565 // Construct the region representing the card. |
568 HeapWord* start = _ct_bs->addr_for(card_ptr); | 566 HeapWord* start = _ct_bs->addr_for(card_ptr); |
569 // And find the region containing it. | 567 // And find the region containing it. |
570 HeapRegion* r = _g1->heap_region_containing(start); | 568 HeapRegion* r = _g1->heap_region_containing(start); |
571 if (r == NULL) { | |
572 // Again no need to return that this card contains refs that | |
573 // point into the collection set. | |
574 return false; // Not in the G1 heap (might be in perm, for example.) | |
575 } | |
576 | 569 |
577 // Why do we have to check here whether a card is on a young region, | 570 // Why do we have to check here whether a card is on a young region, |
578 // given that we dirty young regions and, as a result, the | 571 // given that we dirty young regions and, as a result, the |
579 // post-barrier is supposed to filter them out and never to enqueue | 572 // post-barrier is supposed to filter them out and never to enqueue |
580 // them? When we allocate a new region as the "allocation region" we | 573 // them? When we allocate a new region as the "allocation region" we |
623 return false; | 616 return false; |
624 } | 617 } |
625 | 618 |
626 start = _ct_bs->addr_for(card_ptr); | 619 start = _ct_bs->addr_for(card_ptr); |
627 r = _g1->heap_region_containing(start); | 620 r = _g1->heap_region_containing(start); |
628 if (r == NULL) { | |
629 // Not in the G1 heap | |
630 return false; | |
631 } | |
632 | 621 |
633 // Checking whether the region we got back from the cache | 622 // Checking whether the region we got back from the cache |
634 // is young here is inappropriate. The region could have been | 623 // is young here is inappropriate. The region could have been |
635 // freed, reallocated and tagged as young while in the cache. | 624 // freed, reallocated and tagged as young while in the cache. |
636 // Hence we could see its young type change at any time. | 625 // Hence we could see its young type change at any time. |