< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahMarkCompact.cpp

Print this page




 280   void set_from_region(ShenandoahHeapRegion* from_region) {
 281     _from_region = from_region;
 282   }
 283 
 284   void finish_region() {
 285     assert(_to_region != NULL, "should not happen");
 286     _to_region->set_new_top(_compact_point);
 287   }
 288 
 289   bool is_compact_same_region() {
 290     return _from_region == _to_region;
 291   }
 292 
 293   int empty_regions_pos() {
 294     return _empty_regions_pos;
 295   }
 296 
 297   void do_object(oop p) {
 298     assert(_from_region != NULL, "must set before work");
 299     assert(_heap->complete_marking_context()->is_marked(p), "must be marked");
 300     assert(!_heap->complete_marking_context()->allocated_after_mark_start(p), "must be truly marked");
 301 
 302     size_t obj_size = p->size();
 303     if (_compact_point + obj_size > _to_region->end()) {
 304       finish_region();
 305 
 306       // Object doesn't fit. Pick next empty region and start compacting there.
 307       ShenandoahHeapRegion* new_to_region;
 308       if (_empty_regions_pos < _empty_regions.length()) {
 309         new_to_region = _empty_regions.at(_empty_regions_pos);
 310         _empty_regions_pos++;
 311       } else {
 312         // Out of empty region? Compact within the same region.
 313         new_to_region = _from_region;
 314       }
 315 
 316       assert(new_to_region != _to_region, "must not reuse same to-region");
 317       assert(new_to_region != NULL, "must not be NULL");
 318       _to_region = new_to_region;
 319       _compact_point = _to_region->bottom();
 320     }




 280   void set_from_region(ShenandoahHeapRegion* from_region) {
 281     _from_region = from_region;
 282   }
 283 
 284   void finish_region() {
 285     assert(_to_region != NULL, "should not happen");
 286     _to_region->set_new_top(_compact_point);
 287   }
 288 
 289   bool is_compact_same_region() {
 290     return _from_region == _to_region;
 291   }
 292 
 293   int empty_regions_pos() {
 294     return _empty_regions_pos;
 295   }
 296 
 297   void do_object(oop p) {
 298     assert(_from_region != NULL, "must set before work");
 299     assert(_heap->complete_marking_context()->is_marked(p), "must be marked");
 300     assert(!_heap->complete_marking_context()->allocated_after_mark_start(cast_from_oop<HeapWord*>(p)), "must be truly marked");
 301 
 302     size_t obj_size = p->size();
 303     if (_compact_point + obj_size > _to_region->end()) {
 304       finish_region();
 305 
 306       // Object doesn't fit. Pick next empty region and start compacting there.
 307       ShenandoahHeapRegion* new_to_region;
 308       if (_empty_regions_pos < _empty_regions.length()) {
 309         new_to_region = _empty_regions.at(_empty_regions_pos);
 310         _empty_regions_pos++;
 311       } else {
 312         // Out of empty region? Compact within the same region.
 313         new_to_region = _from_region;
 314       }
 315 
 316       assert(new_to_region != _to_region, "must not reuse same to-region");
 317       assert(new_to_region != NULL, "must not be NULL");
 318       _to_region = new_to_region;
 319       _compact_point = _to_region->bottom();
 320     }


< prev index next >