2865
2866 ParallelCompactData& sd = summary_data();
2867 const SpaceInfo* const space_info = _space_info + id;
2868 ObjectStartArray* const start_array = space_info->start_array();
2869
2870 const MutableSpace* const space = space_info->space();
2871 assert(space_info->dense_prefix() >= space->bottom(), "dense_prefix not set");
2872 HeapWord* const beg_addr = space_info->dense_prefix();
2873 HeapWord* const end_addr = sd.region_align_up(space_info->new_top());
2874
2875 const RegionData* const beg_region = sd.addr_to_region_ptr(beg_addr);
2876 const RegionData* const end_region = sd.addr_to_region_ptr(end_addr);
2877 const RegionData* cur_region;
2878 for (cur_region = beg_region; cur_region < end_region; ++cur_region) {
2879 HeapWord* const addr = cur_region->deferred_obj_addr();
2880 if (addr != NULL) {
2881 if (start_array != NULL) {
2882 start_array->allocate_block(addr);
2883 }
2884 oop(addr)->update_contents(cm);
2885 assert(oop(addr)->is_oop_or_null(), "should be an oop now");
2886 }
2887 }
2888 }
2889
2890 // Skip over count live words starting from beg, and return the address of the
2891 // next live word. Unless marked, the word corresponding to beg is assumed to
2892 // be dead. Callers must either ensure beg does not correspond to the middle of
2893 // an object, or account for those live words in some other way. Callers must
2894 // also ensure that there are enough live words in the range [beg, end) to skip.
2895 HeapWord*
2896 PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_t count)
2897 {
2898 assert(count > 0, "sanity");
2899
2900 ParMarkBitMap* m = mark_bitmap();
2901 idx_t bits_to_skip = m->words_to_bits(count);
2902 idx_t cur_beg = m->addr_to_bit(beg);
2903 const idx_t search_end = BitMap::word_align_up(m->addr_to_bit(end));
2904
2905 do {
3349 _source = addr;
3350 assert(PSParallelCompact::summary_data().calc_new_pointer(source()) ==
3351 destination(), "wrong destination");
3352
3353 if (words > words_remaining()) {
3354 return ParMarkBitMap::would_overflow;
3355 }
3356
3357 // The start_array must be updated even if the object is not moving.
3358 if (_start_array != NULL) {
3359 _start_array->allocate_block(destination());
3360 }
3361
3362 if (destination() != source()) {
3363 DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
3364 Copy::aligned_conjoint_words(source(), destination(), words);
3365 }
3366
3367 oop moved_oop = (oop) destination();
3368 moved_oop->update_contents(compaction_manager());
3369 assert(moved_oop->is_oop_or_null(), "Object should be whole at this point");
3370
3371 update_state(words);
3372 assert(destination() == (HeapWord*)moved_oop + moved_oop->size(), "sanity");
3373 return is_full() ? ParMarkBitMap::full : ParMarkBitMap::incomplete;
3374 }
3375
3376 UpdateOnlyClosure::UpdateOnlyClosure(ParMarkBitMap* mbm,
3377 ParCompactionManager* cm,
3378 PSParallelCompact::SpaceId space_id) :
3379 ParMarkBitMapClosure(mbm, cm),
3380 _space_id(space_id),
3381 _start_array(PSParallelCompact::start_array(space_id))
3382 {
3383 }
3384
3385 // Updates the references in the object to their new values.
3386 ParMarkBitMapClosure::IterationStatus
3387 UpdateOnlyClosure::do_addr(HeapWord* addr, size_t words) {
3388 do_addr(addr);
3389 return ParMarkBitMap::incomplete;
|
2865
2866 ParallelCompactData& sd = summary_data();
2867 const SpaceInfo* const space_info = _space_info + id;
2868 ObjectStartArray* const start_array = space_info->start_array();
2869
2870 const MutableSpace* const space = space_info->space();
2871 assert(space_info->dense_prefix() >= space->bottom(), "dense_prefix not set");
2872 HeapWord* const beg_addr = space_info->dense_prefix();
2873 HeapWord* const end_addr = sd.region_align_up(space_info->new_top());
2874
2875 const RegionData* const beg_region = sd.addr_to_region_ptr(beg_addr);
2876 const RegionData* const end_region = sd.addr_to_region_ptr(end_addr);
2877 const RegionData* cur_region;
2878 for (cur_region = beg_region; cur_region < end_region; ++cur_region) {
2879 HeapWord* const addr = cur_region->deferred_obj_addr();
2880 if (addr != NULL) {
2881 if (start_array != NULL) {
2882 start_array->allocate_block(addr);
2883 }
2884 oop(addr)->update_contents(cm);
2885 assert(oop(addr)->is_oop_or_null(), err_msg("should be an oop now: " PTR_FORMAT, p2i(oop(addr))));
2886 }
2887 }
2888 }
2889
2890 // Skip over count live words starting from beg, and return the address of the
2891 // next live word. Unless marked, the word corresponding to beg is assumed to
2892 // be dead. Callers must either ensure beg does not correspond to the middle of
2893 // an object, or account for those live words in some other way. Callers must
2894 // also ensure that there are enough live words in the range [beg, end) to skip.
2895 HeapWord*
2896 PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_t count)
2897 {
2898 assert(count > 0, "sanity");
2899
2900 ParMarkBitMap* m = mark_bitmap();
2901 idx_t bits_to_skip = m->words_to_bits(count);
2902 idx_t cur_beg = m->addr_to_bit(beg);
2903 const idx_t search_end = BitMap::word_align_up(m->addr_to_bit(end));
2904
2905 do {
3349 _source = addr;
3350 assert(PSParallelCompact::summary_data().calc_new_pointer(source()) ==
3351 destination(), "wrong destination");
3352
3353 if (words > words_remaining()) {
3354 return ParMarkBitMap::would_overflow;
3355 }
3356
3357 // The start_array must be updated even if the object is not moving.
3358 if (_start_array != NULL) {
3359 _start_array->allocate_block(destination());
3360 }
3361
3362 if (destination() != source()) {
3363 DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
3364 Copy::aligned_conjoint_words(source(), destination(), words);
3365 }
3366
3367 oop moved_oop = (oop) destination();
3368 moved_oop->update_contents(compaction_manager());
3369 assert(moved_oop->is_oop_or_null(), err_msg("Object should be whole at this point: " PTR_FORMAT, p2i(moved_oop)));
3370
3371 update_state(words);
3372 assert(destination() == (HeapWord*)moved_oop + moved_oop->size(), "sanity");
3373 return is_full() ? ParMarkBitMap::full : ParMarkBitMap::incomplete;
3374 }
3375
3376 UpdateOnlyClosure::UpdateOnlyClosure(ParMarkBitMap* mbm,
3377 ParCompactionManager* cm,
3378 PSParallelCompact::SpaceId space_id) :
3379 ParMarkBitMapClosure(mbm, cm),
3380 _space_id(space_id),
3381 _start_array(PSParallelCompact::start_array(space_id))
3382 {
3383 }
3384
3385 // Updates the references in the object to their new values.
3386 ParMarkBitMapClosure::IterationStatus
3387 UpdateOnlyClosure::do_addr(HeapWord* addr, size_t words) {
3388 do_addr(addr);
3389 return ParMarkBitMap::incomplete;
|