842 // the same as bottom or top(_at_rebuild_start). There is no way TAMS has a different |
842 // the same as bottom or top(_at_rebuild_start). There is no way TAMS has a different |
843 // value: this would mean that TAMS points somewhere into the object. |
843 // value: this would mean that TAMS points somewhere into the object. |
844 assert(hr->top() == top_at_mark_start || hr->top() == top_at_rebuild_start, |
844 assert(hr->top() == top_at_mark_start || hr->top() == top_at_rebuild_start, |
845 "More than one object in the humongous region?"); |
845 "More than one object in the humongous region?"); |
846 humongous_obj->oop_iterate(&_update_cl, mr); |
846 humongous_obj->oop_iterate(&_update_cl, mr); |
847 return top_at_mark_start != hr->bottom() ? mr.byte_size() : 0; |
847 return top_at_mark_start != hr->bottom() ? mr.intersection(MemRegion((HeapWord*)humongous_obj, humongous_obj->size())).byte_size() : 0; |
848 } else { |
848 } else { |
849 return 0; |
849 return 0; |
850 } |
850 } |
851 } |
851 } |
852 |
852 |
881 p2i(top_at_rebuild_start_check), p2i(hr->bottom()), region_idx, hr->get_type_str()); |
881 p2i(top_at_rebuild_start_check), p2i(hr->bottom()), region_idx, hr->get_type_str()); |
882 |
882 |
883 size_t total_marked_bytes = 0; |
883 size_t total_marked_bytes = 0; |
884 size_t const chunk_size_in_words = G1RebuildRemSetChunkSize / HeapWordSize; |
884 size_t const chunk_size_in_words = G1RebuildRemSetChunkSize / HeapWordSize; |
885 |
885 |
886 HeapWord* const top_at_mark_start = hr->next_top_at_mark_start(); |
886 HeapWord* const top_at_mark_start = hr->prev_top_at_mark_start(); |
887 |
887 |
888 HeapWord* cur = hr->bottom(); |
888 HeapWord* cur = hr->bottom(); |
889 while (cur < hr->end()) { |
889 while (cur < hr->end()) { |
890 // After every iteration (yield point) we need to check whether the region's |
890 // After every iteration (yield point) we need to check whether the region's |
891 // TARS changed due to e.g. eager reclaim. |
891 // TARS changed due to e.g. eager reclaim. |
898 if (next_chunk.is_empty()) { |
898 if (next_chunk.is_empty()) { |
899 break; |
899 break; |
900 } |
900 } |
901 |
901 |
902 const Ticks start = Ticks::now(); |
902 const Ticks start = Ticks::now(); |
903 size_t marked_bytes = rebuild_rem_set_in_region(_cm->next_mark_bitmap(), |
903 size_t marked_bytes = rebuild_rem_set_in_region(_cm->prev_mark_bitmap(), |
904 top_at_mark_start, |
904 top_at_mark_start, |
905 top_at_rebuild_start, |
905 top_at_rebuild_start, |
906 hr, |
906 hr, |
907 next_chunk); |
907 next_chunk); |
908 Tickspan time = Ticks::now() - start; |
908 Tickspan time = Ticks::now() - start; |
921 p2i(hr->bottom()), |
921 p2i(hr->bottom()), |
922 p2i(top_at_mark_start), |
922 p2i(top_at_mark_start), |
923 p2i(top_at_rebuild_start)); |
923 p2i(top_at_rebuild_start)); |
924 |
924 |
925 if (marked_bytes > 0) { |
925 if (marked_bytes > 0) { |
926 hr->add_to_marked_bytes(marked_bytes); |
|
927 total_marked_bytes += marked_bytes; |
926 total_marked_bytes += marked_bytes; |
928 } |
927 } |
929 cur += chunk_size_in_words; |
928 cur += chunk_size_in_words; |
930 |
929 |
931 _cm->do_yield_check(); |
930 _cm->do_yield_check(); |
935 } |
934 } |
936 // In the final iteration of the loop the region might have been eagerly reclaimed. |
935 // In the final iteration of the loop the region might have been eagerly reclaimed. |
937 // Simply filter out those regions. We can not just use region type because there |
936 // Simply filter out those regions. We can not just use region type because there |
938 // might have already been new allocations into these regions. |
937 // might have already been new allocations into these regions. |
939 DEBUG_ONLY(HeapWord* const top_at_rebuild_start = _cm->top_at_rebuild_start(region_idx);) |
938 DEBUG_ONLY(HeapWord* const top_at_rebuild_start = _cm->top_at_rebuild_start(region_idx);) |
940 assert(!hr->is_old() || |
939 assert(top_at_rebuild_start == NULL || |
941 top_at_rebuild_start == NULL || |
940 total_marked_bytes == hr->marked_bytes(), |
942 total_marked_bytes == _cm->liveness(region_idx) * HeapWordSize, |
941 "Marked bytes " SIZE_FORMAT " for region %u (%s) in [bottom, TAMS) do not match calculated marked bytes " SIZE_FORMAT " " |
943 "Marked bytes " SIZE_FORMAT " for region %u (%s) in [bottom, TAMS) do not match liveness during mark " SIZE_FORMAT " " |
|
944 "(" PTR_FORMAT " " PTR_FORMAT " " PTR_FORMAT ")", |
942 "(" PTR_FORMAT " " PTR_FORMAT " " PTR_FORMAT ")", |
945 total_marked_bytes, hr->hrm_index(), hr->get_type_str(), _cm->liveness(region_idx) * HeapWordSize, |
943 total_marked_bytes, hr->hrm_index(), hr->get_type_str(), hr->marked_bytes(), |
946 p2i(hr->bottom()), p2i(top_at_mark_start), p2i(top_at_rebuild_start)); |
944 p2i(hr->bottom()), p2i(top_at_mark_start), p2i(top_at_rebuild_start)); |
947 // Abort state may have changed after the yield check. |
945 // Abort state may have changed after the yield check. |
948 return _cm->has_aborted(); |
946 return _cm->has_aborted(); |
949 } |
947 } |
950 }; |
948 }; |