< prev index next >

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

Print this page
*** 240,19 ***
--- 240,23 ---
    {
      // The rest of code performs region moves, where region status is undefined
      // until all phases run together.
      ShenandoahHeapLocker lock(heap->lock());
  
+     FullGCForwarding::begin();
+ 
      phase2_calculate_target_addresses(worker_slices);
  
      OrderAccess::fence();
  
      phase3_update_references();
  
      phase4_compact_objects(worker_slices);
  
      phase5_epilog();
+ 
+     FullGCForwarding::end();
    }
    heap->start_idle_span();
  
    // Resize metaspace
    MetaspaceGC::compute_new_size();

*** 349,11 ***
      assert(_from_region != nullptr, "must set before work");
      assert(_heap->global_generation()->is_mark_complete(), "marking must be finished");
      assert(_heap->marking_context()->is_marked(p), "must be marked");
      assert(!_heap->marking_context()->allocated_after_mark_start(p), "must be truly marked");
  
!     size_t obj_size = p->size();
      if (_compact_point + obj_size > _to_region->end()) {
        finish();
  
        // Object doesn't fit. Pick next empty region and start compacting there.
        ShenandoahHeapRegion* new_to_region;
--- 353,13 ---
      assert(_from_region != nullptr, "must set before work");
      assert(_heap->global_generation()->is_mark_complete(), "marking must be finished");
      assert(_heap->marking_context()->is_marked(p), "must be marked");
      assert(!_heap->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());
+     size_t obj_size = _compact_point == cast_from_oop<HeapWord*>(p) ? old_size : new_size;
      if (_compact_point + obj_size > _to_region->end()) {
        finish();
  
        // Object doesn't fit. Pick next empty region and start compacting there.
        ShenandoahHeapRegion* new_to_region;

*** 367,10 ***
--- 373,11 ---
  
        assert(new_to_region != _to_region, "must not reuse same to-region");
        assert(new_to_region != nullptr, "must not be null");
        _to_region = new_to_region;
        _compact_point = _to_region->bottom();
+       obj_size = _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(_compact_point + obj_size <= _to_region->end(), "must fit");
      shenandoah_assert_not_forwarded(nullptr, p);

*** 877,11 ***
        assert(compact_from != compact_to, "Forwarded object should move");
        Copy::aligned_conjoint_words(compact_from, compact_to, size);
        oop new_obj = cast_to_oop(compact_to);
  
        ContinuationGCSupport::relativize_stack_chunk(new_obj);
!       new_obj->init_mark();
      }
    }
  };
  
  class ShenandoahCompactObjectsTask : public WorkerTask {
--- 884,12 ---
        assert(compact_from != compact_to, "Forwarded object should move");
        Copy::aligned_conjoint_words(compact_from, compact_to, size);
        oop new_obj = cast_to_oop(compact_to);
  
        ContinuationGCSupport::relativize_stack_chunk(new_obj);
!       new_obj->reinit_mark();
+       new_obj->initialize_hash_if_necessary(p);
      }
    }
  };
  
  class ShenandoahCompactObjectsTask : public WorkerTask {

*** 1011,11 ***
        log_debug(gc)("Full GC compaction moves humongous object from region %zu to region %zu", old_start, new_start);
        Copy::aligned_conjoint_words(r->bottom(), heap->get_region(new_start)->bottom(), words_size);
        ContinuationGCSupport::relativize_stack_chunk(cast_to_oop<HeapWord*>(r->bottom()));
  
        oop new_obj = cast_to_oop(heap->get_region(new_start)->bottom());
!       new_obj->init_mark();
  
        {
          ShenandoahAffiliation original_affiliation = r->affiliation();
          for (size_t c = old_start; c <= old_end; c++) {
            ShenandoahHeapRegion* r = heap->get_region(c);
--- 1019,11 ---
        log_debug(gc)("Full GC compaction moves humongous object from region %zu to region %zu", old_start, new_start);
        Copy::aligned_conjoint_words(r->bottom(), heap->get_region(new_start)->bottom(), words_size);
        ContinuationGCSupport::relativize_stack_chunk(cast_to_oop<HeapWord*>(r->bottom()));
  
        oop new_obj = cast_to_oop(heap->get_region(new_start)->bottom());
!       new_obj->reinit_mark();
  
        {
          ShenandoahAffiliation original_affiliation = r->affiliation();
          for (size_t c = old_start; c <= old_end; c++) {
            ShenandoahHeapRegion* r = heap->get_region(c);
< prev index next >