< prev index next >

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

Print this page




 384     _to_regions(to_regions),
 385     _to_region(to_region),
 386     _from_region(NULL),
 387     _compact_point(to_region->bottom()) {
 388   }
 389 
 390   void set_from_region(ShenandoahHeapRegion* from_region) {
 391     _from_region = from_region;
 392   }
 393 
 394   ShenandoahHeapRegion* to_region() const {
 395     return _to_region;
 396   }
 397   HeapWord* compact_point() const {
 398     return _compact_point;
 399   }
 400   void do_object(oop p) {
 401     assert(_from_region != NULL, "must set before work");
 402     assert(_heap->is_marked_complete(p), "must be marked");
 403     assert(! _heap->allocated_after_complete_mark_start((HeapWord*) p), "must be truly marked");
 404     size_t size = p->size();
 405     size_t obj_size = size + BrooksPointer::word_size();
 406     if (_compact_point + obj_size > _to_region->end()) {
 407       // Object doesn't fit. Pick next to-region and start compacting there.
 408       _to_region->set_new_top(_compact_point);
 409       ShenandoahHeapRegion* new_to_region = _to_regions->current();
 410       _to_regions->next();
 411       if (new_to_region == NULL) {
 412         new_to_region = _from_region;
 413       }
 414       assert(new_to_region != _to_region, "must not reuse same to-region");
 415       assert(new_to_region != NULL, "must not be NULL");
 416       _to_region = new_to_region;
 417       _compact_point = _to_region->bottom();
 418     }
 419     assert(_compact_point + obj_size <= _to_region->end(), "must fit");
 420     assert(oopDesc::unsafe_equals(p, ShenandoahBarrierSet::resolve_oop_static_not_null(p)),
 421            "expect forwarded oop");
 422     BrooksPointer::set_raw(p, _compact_point + BrooksPointer::word_size());
 423     _compact_point += obj_size;
 424   }
 425 };




 384     _to_regions(to_regions),
 385     _to_region(to_region),
 386     _from_region(NULL),
 387     _compact_point(to_region->bottom()) {
 388   }
 389 
 390   void set_from_region(ShenandoahHeapRegion* from_region) {
 391     _from_region = from_region;
 392   }
 393 
 394   ShenandoahHeapRegion* to_region() const {
 395     return _to_region;
 396   }
 397   HeapWord* compact_point() const {
 398     return _compact_point;
 399   }
 400   void do_object(oop p) {
 401     assert(_from_region != NULL, "must set before work");
 402     assert(_heap->is_marked_complete(p), "must be marked");
 403     assert(! _heap->allocated_after_complete_mark_start((HeapWord*) p), "must be truly marked");
 404     size_t obj_size = p->size() + BrooksPointer::word_size();

 405     if (_compact_point + obj_size > _to_region->end()) {
 406       // Object doesn't fit. Pick next to-region and start compacting there.
 407       _to_region->set_new_top(_compact_point);
 408       ShenandoahHeapRegion* new_to_region = _to_regions->current();
 409       _to_regions->next();
 410       if (new_to_region == NULL) {
 411         new_to_region = _from_region;
 412       }
 413       assert(new_to_region != _to_region, "must not reuse same to-region");
 414       assert(new_to_region != NULL, "must not be NULL");
 415       _to_region = new_to_region;
 416       _compact_point = _to_region->bottom();
 417     }
 418     assert(_compact_point + obj_size <= _to_region->end(), "must fit");
 419     assert(oopDesc::unsafe_equals(p, ShenandoahBarrierSet::resolve_oop_static_not_null(p)),
 420            "expect forwarded oop");
 421     BrooksPointer::set_raw(p, _compact_point + BrooksPointer::word_size());
 422     _compact_point += obj_size;
 423   }
 424 };


< prev index next >