< prev index next >

src/share/vm/gc/parallel/psParallelCompact.cpp

Print this page




2580 
2581   ParallelCompactData& sd = summary_data();
2582   const SpaceInfo* const space_info = _space_info + id;
2583   ObjectStartArray* const start_array = space_info->start_array();
2584 
2585   const MutableSpace* const space = space_info->space();
2586   assert(space_info->dense_prefix() >= space->bottom(), "dense_prefix not set");
2587   HeapWord* const beg_addr = space_info->dense_prefix();
2588   HeapWord* const end_addr = sd.region_align_up(space_info->new_top());
2589 
2590   const RegionData* const beg_region = sd.addr_to_region_ptr(beg_addr);
2591   const RegionData* const end_region = sd.addr_to_region_ptr(end_addr);
2592   const RegionData* cur_region;
2593   for (cur_region = beg_region; cur_region < end_region; ++cur_region) {
2594     HeapWord* const addr = cur_region->deferred_obj_addr();
2595     if (addr != NULL) {
2596       if (start_array != NULL) {
2597         start_array->allocate_block(addr);
2598       }
2599       cm->update_contents(oop(addr));
2600       assert(oop(addr)->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr)));
2601     }
2602   }
2603 }
2604 
2605 // Skip over count live words starting from beg, and return the address of the
2606 // next live word.  Unless marked, the word corresponding to beg is assumed to
2607 // be dead.  Callers must either ensure beg does not correspond to the middle of
2608 // an object, or account for those live words in some other way.  Callers must
2609 // also ensure that there are enough live words in the range [beg, end) to skip.
2610 HeapWord*
2611 PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_t count)
2612 {
2613   assert(count > 0, "sanity");
2614 
2615   ParMarkBitMap* m = mark_bitmap();
2616   idx_t bits_to_skip = m->words_to_bits(count);
2617   idx_t cur_beg = m->addr_to_bit(beg);
2618   const idx_t search_end = BitMap::word_align_up(m->addr_to_bit(end));
2619 
2620   do {


3127   _source = addr;
3128   assert(PSParallelCompact::summary_data().calc_new_pointer(source(), compaction_manager()) ==
3129          destination(), "wrong destination");
3130 
3131   if (words > words_remaining()) {
3132     return ParMarkBitMap::would_overflow;
3133   }
3134 
3135   // The start_array must be updated even if the object is not moving.
3136   if (_start_array != NULL) {
3137     _start_array->allocate_block(destination());
3138   }
3139 
3140   if (destination() != source()) {
3141     DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
3142     Copy::aligned_conjoint_words(source(), destination(), words);
3143   }
3144 
3145   oop moved_oop = (oop) destination();
3146   compaction_manager()->update_contents(moved_oop);
3147   assert(moved_oop->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(moved_oop));
3148 
3149   update_state(words);
3150   assert(destination() == (HeapWord*)moved_oop + moved_oop->size(), "sanity");
3151   return is_full() ? ParMarkBitMap::full : ParMarkBitMap::incomplete;
3152 }
3153 
3154 UpdateOnlyClosure::UpdateOnlyClosure(ParMarkBitMap* mbm,
3155                                      ParCompactionManager* cm,
3156                                      PSParallelCompact::SpaceId space_id) :
3157   ParMarkBitMapClosure(mbm, cm),
3158   _space_id(space_id),
3159   _start_array(PSParallelCompact::start_array(space_id))
3160 {
3161 }
3162 
3163 // Updates the references in the object to their new values.
3164 ParMarkBitMapClosure::IterationStatus
3165 UpdateOnlyClosure::do_addr(HeapWord* addr, size_t words) {
3166   do_addr(addr);
3167   return ParMarkBitMap::incomplete;


2580 
2581   ParallelCompactData& sd = summary_data();
2582   const SpaceInfo* const space_info = _space_info + id;
2583   ObjectStartArray* const start_array = space_info->start_array();
2584 
2585   const MutableSpace* const space = space_info->space();
2586   assert(space_info->dense_prefix() >= space->bottom(), "dense_prefix not set");
2587   HeapWord* const beg_addr = space_info->dense_prefix();
2588   HeapWord* const end_addr = sd.region_align_up(space_info->new_top());
2589 
2590   const RegionData* const beg_region = sd.addr_to_region_ptr(beg_addr);
2591   const RegionData* const end_region = sd.addr_to_region_ptr(end_addr);
2592   const RegionData* cur_region;
2593   for (cur_region = beg_region; cur_region < end_region; ++cur_region) {
2594     HeapWord* const addr = cur_region->deferred_obj_addr();
2595     if (addr != NULL) {
2596       if (start_array != NULL) {
2597         start_array->allocate_block(addr);
2598       }
2599       cm->update_contents(oop(addr));
2600       assert(oopDesc::is_oop_or_null(oop(addr)), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr)));
2601     }
2602   }
2603 }
2604 
2605 // Skip over count live words starting from beg, and return the address of the
2606 // next live word.  Unless marked, the word corresponding to beg is assumed to
2607 // be dead.  Callers must either ensure beg does not correspond to the middle of
2608 // an object, or account for those live words in some other way.  Callers must
2609 // also ensure that there are enough live words in the range [beg, end) to skip.
2610 HeapWord*
2611 PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_t count)
2612 {
2613   assert(count > 0, "sanity");
2614 
2615   ParMarkBitMap* m = mark_bitmap();
2616   idx_t bits_to_skip = m->words_to_bits(count);
2617   idx_t cur_beg = m->addr_to_bit(beg);
2618   const idx_t search_end = BitMap::word_align_up(m->addr_to_bit(end));
2619 
2620   do {


3127   _source = addr;
3128   assert(PSParallelCompact::summary_data().calc_new_pointer(source(), compaction_manager()) ==
3129          destination(), "wrong destination");
3130 
3131   if (words > words_remaining()) {
3132     return ParMarkBitMap::would_overflow;
3133   }
3134 
3135   // The start_array must be updated even if the object is not moving.
3136   if (_start_array != NULL) {
3137     _start_array->allocate_block(destination());
3138   }
3139 
3140   if (destination() != source()) {
3141     DEBUG_ONLY(PSParallelCompact::check_new_location(source(), destination());)
3142     Copy::aligned_conjoint_words(source(), destination(), words);
3143   }
3144 
3145   oop moved_oop = (oop) destination();
3146   compaction_manager()->update_contents(moved_oop);
3147   assert(oopDesc::is_oop_or_null(moved_oop), "Expected an oop or NULL at " PTR_FORMAT, p2i(moved_oop));
3148 
3149   update_state(words);
3150   assert(destination() == (HeapWord*)moved_oop + moved_oop->size(), "sanity");
3151   return is_full() ? ParMarkBitMap::full : ParMarkBitMap::incomplete;
3152 }
3153 
3154 UpdateOnlyClosure::UpdateOnlyClosure(ParMarkBitMap* mbm,
3155                                      ParCompactionManager* cm,
3156                                      PSParallelCompact::SpaceId space_id) :
3157   ParMarkBitMapClosure(mbm, cm),
3158   _space_id(space_id),
3159   _start_array(PSParallelCompact::start_array(space_id))
3160 {
3161 }
3162 
3163 // Updates the references in the object to their new values.
3164 ParMarkBitMapClosure::IterationStatus
3165 UpdateOnlyClosure::do_addr(HeapWord* addr, size_t words) {
3166   do_addr(addr);
3167   return ParMarkBitMap::incomplete;
< prev index next >