< prev index next >

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

Print this page
*** 273,18 ***
    assert((_from_region->bottom() <= cast_from_oop<HeapWord*>(p)) && (cast_from_oop<HeapWord*>(p) < _from_region->top()),
           "Object must reside in _from_region");
    assert(_heap->complete_marking_context()->is_marked(p), "must be marked");
    assert(!_heap->complete_marking_context()->allocated_after_mark_start(p), "must be truly marked");
  
!   size_t obj_size = p->size();
    uint from_region_age = _from_region->age();
    uint object_age = p->age();
  
    bool promote_object = false;
    if ((_from_affiliation == ShenandoahAffiliation::YOUNG_GENERATION) &&
        (from_region_age + object_age >= _tenuring_threshold)) {
!     if ((_old_to_region != nullptr) && (_old_compact_point + obj_size > _old_to_region->end())) {
        finish_old_region();
        _old_to_region = nullptr;
      }
      if (_old_to_region == nullptr) {
        if (_empty_regions_pos < _empty_regions.length()) {
--- 273,19 ---
    assert((_from_region->bottom() <= cast_from_oop<HeapWord*>(p)) && (cast_from_oop<HeapWord*>(p) < _from_region->top()),
           "Object must reside in _from_region");
    assert(_heap->complete_marking_context()->is_marked(p), "must be marked");
    assert(!_heap->complete_marking_context()->allocated_after_mark_start(p), "must be truly marked");
  
!   size_t old_size = p->size();
+   size_t new_size = p->copy_size(old_size, p->mark());
    uint from_region_age = _from_region->age();
    uint object_age = p->age();
  
    bool promote_object = false;
    if ((_from_affiliation == ShenandoahAffiliation::YOUNG_GENERATION) &&
        (from_region_age + object_age >= _tenuring_threshold)) {
!     if ((_old_to_region != nullptr) && (_old_compact_point + new_size > _old_to_region->end())) {
        finish_old_region();
        _old_to_region = nullptr;
      }
      if (_old_to_region == nullptr) {
        if (_empty_regions_pos < _empty_regions.length()) {

*** 302,10 ***
--- 303,11 ---
      }
    }
  
    if (promote_object || (_from_affiliation == ShenandoahAffiliation::OLD_GENERATION)) {
      assert(_old_to_region != nullptr, "_old_to_region should not be nullptr when evacuating to OLD region");
+     size_t obj_size = _old_compact_point == cast_from_oop<HeapWord*>(p) ? old_size : new_size;
      if (_old_compact_point + obj_size > _old_to_region->end()) {
        ShenandoahHeapRegion* new_to_region;
  
        log_debug(gc)("Worker %u finishing old region " SIZE_FORMAT ", compact_point: " PTR_FORMAT ", obj_size: " SIZE_FORMAT
        ", &compact_point[obj_size]: " PTR_FORMAT ", region end: " PTR_FORMAT,  _worker_id, _old_to_region->index(),

*** 326,10 ***
--- 328,11 ---
  
        assert(new_to_region != _old_to_region, "must not reuse same OLD to-region");
        assert(new_to_region != nullptr, "must not be nullptr");
        _old_to_region = new_to_region;
        _old_compact_point = _old_to_region->bottom();
+       obj_size = _old_compact_point == cast_from_oop<HeapWord*>(p) ? old_size : new_size;
      }
  
      // Object fits into current region, record new location, if object does not move:
      assert(_old_compact_point + obj_size <= _old_to_region->end(), "must fit");
      shenandoah_assert_not_forwarded(nullptr, p);

*** 349,10 ***
--- 352,11 ---
        ShenandoahHeap::increase_object_age(p, from_region_age + 1);
      } else {
        ShenandoahHeap::increase_object_age(p, from_region_age);
      }
  
+     size_t obj_size = _young_compact_point == cast_from_oop<HeapWord*>(p) ? old_size : new_size;
      if (_young_compact_point + obj_size > _young_to_region->end()) {
        ShenandoahHeapRegion* new_to_region;
  
        log_debug(gc)("Worker %u finishing young region " SIZE_FORMAT ", compact_point: " PTR_FORMAT ", obj_size: " SIZE_FORMAT
        ", &compact_point[obj_size]: " PTR_FORMAT ", region end: " PTR_FORMAT,  _worker_id, _young_to_region->index(),

*** 372,10 ***
--- 376,11 ---
        }
  
        assert(new_to_region != _young_to_region, "must not reuse same OLD to-region");
        assert(new_to_region != nullptr, "must not be nullptr");
        _young_to_region = new_to_region;
+       obj_size = _young_compact_point == cast_from_oop<HeapWord*>(p) ? old_size : new_size;
        _young_compact_point = _young_to_region->bottom();
      }
  
      // Object fits into current region, record new location, if object does not move:
      assert(_young_compact_point + obj_size <= _young_to_region->end(), "must fit");
< prev index next >