2834
2835 ParallelCompactData& sd = summary_data();
2836 const SpaceInfo* const space_info = _space_info + id;
2837 ObjectStartArray* const start_array = space_info->start_array();
2838
2839 const MutableSpace* const space = space_info->space();
2840 assert(space_info->dense_prefix() >= space->bottom(), "dense_prefix not set");
2841 HeapWord* const beg_addr = space_info->dense_prefix();
2842 HeapWord* const end_addr = sd.region_align_up(space_info->new_top());
2843
2844 const RegionData* const beg_region = sd.addr_to_region_ptr(beg_addr);
2845 const RegionData* const end_region = sd.addr_to_region_ptr(end_addr);
2846 const RegionData* cur_region;
2847 for (cur_region = beg_region; cur_region < end_region; ++cur_region) {
2848 HeapWord* const addr = cur_region->deferred_obj_addr();
2849 if (addr != NULL) {
2850 if (start_array != NULL) {
2851 start_array->allocate_block(addr);
2852 }
2853 cm->update_contents(oop(addr));
2854 assert(oop(addr)->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr))));
2855 }
2856 }
2857 }
2858
2859 // Skip over count live words starting from beg, and return the address of the
2860 // next live word. Unless marked, the word corresponding to beg is assumed to
2861 // be dead. Callers must either ensure beg does not correspond to the middle of
2862 // an object, or account for those live words in some other way. Callers must
2863 // also ensure that there are enough live words in the range [beg, end) to skip.
2864 HeapWord*
2865 PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_t count)
2866 {
2867 assert(count > 0, "sanity");
2868
2869 ParMarkBitMap* m = mark_bitmap();
2870 idx_t bits_to_skip = m->words_to_bits(count);
2871 idx_t cur_beg = m->addr_to_bit(beg);
2872 const idx_t search_end = BitMap::word_align_up(m->addr_to_bit(end));
2873
2874 do {
3383 _source = addr;
3384 assert(PSParallelCompact::summary_data().calc_new_pointer(source()) ==
3385 destination(), "wrong destination");
3386
3387 if (words > words_remaining()) {
3388 return ParMarkBitMap::would_overflow;
3389 }
3390
3391 // The start_array must be updated even if the object is not moving.
3392 if (_start_array != NULL) {
3393 _start_array->allocate_block(destination());
3394 }
3395
3396 if (destination() != source()) {
3397 DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
3398 Copy::aligned_conjoint_words(source(), destination(), words);
3399 }
3400
3401 oop moved_oop = (oop) destination();
3402 compaction_manager()->update_contents(moved_oop);
3403 assert(moved_oop->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(moved_oop)));
3404
3405 update_state(words);
3406 assert(destination() == (HeapWord*)moved_oop + moved_oop->size(), "sanity");
3407 return is_full() ? ParMarkBitMap::full : ParMarkBitMap::incomplete;
3408 }
3409
3410 UpdateOnlyClosure::UpdateOnlyClosure(ParMarkBitMap* mbm,
3411 ParCompactionManager* cm,
3412 PSParallelCompact::SpaceId space_id) :
3413 ParMarkBitMapClosure(mbm, cm),
3414 _space_id(space_id),
3415 _start_array(PSParallelCompact::start_array(space_id))
3416 {
3417 }
3418
3419 // Updates the references in the object to their new values.
3420 ParMarkBitMapClosure::IterationStatus
3421 UpdateOnlyClosure::do_addr(HeapWord* addr, size_t words) {
3422 do_addr(addr);
3423 return ParMarkBitMap::incomplete;
|
2834
2835 ParallelCompactData& sd = summary_data();
2836 const SpaceInfo* const space_info = _space_info + id;
2837 ObjectStartArray* const start_array = space_info->start_array();
2838
2839 const MutableSpace* const space = space_info->space();
2840 assert(space_info->dense_prefix() >= space->bottom(), "dense_prefix not set");
2841 HeapWord* const beg_addr = space_info->dense_prefix();
2842 HeapWord* const end_addr = sd.region_align_up(space_info->new_top());
2843
2844 const RegionData* const beg_region = sd.addr_to_region_ptr(beg_addr);
2845 const RegionData* const end_region = sd.addr_to_region_ptr(end_addr);
2846 const RegionData* cur_region;
2847 for (cur_region = beg_region; cur_region < end_region; ++cur_region) {
2848 HeapWord* const addr = cur_region->deferred_obj_addr();
2849 if (addr != NULL) {
2850 if (start_array != NULL) {
2851 start_array->allocate_block(addr);
2852 }
2853 cm->update_contents(oop(addr));
2854 assert(oop(addr)->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr)));
2855 }
2856 }
2857 }
2858
2859 // Skip over count live words starting from beg, and return the address of the
2860 // next live word. Unless marked, the word corresponding to beg is assumed to
2861 // be dead. Callers must either ensure beg does not correspond to the middle of
2862 // an object, or account for those live words in some other way. Callers must
2863 // also ensure that there are enough live words in the range [beg, end) to skip.
2864 HeapWord*
2865 PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_t count)
2866 {
2867 assert(count > 0, "sanity");
2868
2869 ParMarkBitMap* m = mark_bitmap();
2870 idx_t bits_to_skip = m->words_to_bits(count);
2871 idx_t cur_beg = m->addr_to_bit(beg);
2872 const idx_t search_end = BitMap::word_align_up(m->addr_to_bit(end));
2873
2874 do {
3383 _source = addr;
3384 assert(PSParallelCompact::summary_data().calc_new_pointer(source()) ==
3385 destination(), "wrong destination");
3386
3387 if (words > words_remaining()) {
3388 return ParMarkBitMap::would_overflow;
3389 }
3390
3391 // The start_array must be updated even if the object is not moving.
3392 if (_start_array != NULL) {
3393 _start_array->allocate_block(destination());
3394 }
3395
3396 if (destination() != source()) {
3397 DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
3398 Copy::aligned_conjoint_words(source(), destination(), words);
3399 }
3400
3401 oop moved_oop = (oop) destination();
3402 compaction_manager()->update_contents(moved_oop);
3403 assert(moved_oop->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(moved_oop));
3404
3405 update_state(words);
3406 assert(destination() == (HeapWord*)moved_oop + moved_oop->size(), "sanity");
3407 return is_full() ? ParMarkBitMap::full : ParMarkBitMap::incomplete;
3408 }
3409
3410 UpdateOnlyClosure::UpdateOnlyClosure(ParMarkBitMap* mbm,
3411 ParCompactionManager* cm,
3412 PSParallelCompact::SpaceId space_id) :
3413 ParMarkBitMapClosure(mbm, cm),
3414 _space_id(space_id),
3415 _start_array(PSParallelCompact::start_array(space_id))
3416 {
3417 }
3418
3419 // Updates the references in the object to their new values.
3420 ParMarkBitMapClosure::IterationStatus
3421 UpdateOnlyClosure::do_addr(HeapWord* addr, size_t words) {
3422 do_addr(addr);
3423 return ParMarkBitMap::incomplete;
|