< prev index next >

src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp

Print this page
*** 102,20 ***
    _collector(collector),
    _bitmap(collector->mark_bitmap()),
    _cp(cp) { }
  
  
! G1FullGCPrepareTask::G1PrepareCompactLiveClosure::G1PrepareCompactLiveClosure(G1FullGCCompactionPoint* cp) :
      _cp(cp) { }
  
! size_t G1FullGCPrepareTask::G1PrepareCompactLiveClosure::apply(oop object) {
    size_t size = object->size();
!   _cp->forward(object, size);
    return size;
  }
  
  void G1FullGCPrepareTask::G1CalculatePointersClosure::prepare_for_compaction(HeapRegion* hr) {
    if (!_collector->is_free(hr->hrm_index())) {
!     G1PrepareCompactLiveClosure prepare_compact(_cp);
!     hr->apply_to_marked_objects(_bitmap, &prepare_compact);
    }
  }
--- 102,27 ---
    _collector(collector),
    _bitmap(collector->mark_bitmap()),
    _cp(cp) { }
  
  
! template <bool ALT_FWD>
+ G1FullGCPrepareTask::G1PrepareCompactLiveClosure<ALT_FWD>::G1PrepareCompactLiveClosure(G1FullGCCompactionPoint* cp) :
      _cp(cp) { }
  
! template <bool ALT_FWD>
+ size_t G1FullGCPrepareTask::G1PrepareCompactLiveClosure<ALT_FWD>::apply(oop object) {
    size_t size = object->size();
!   _cp->forward<ALT_FWD>(object, size);
    return size;
  }
  
  void G1FullGCPrepareTask::G1CalculatePointersClosure::prepare_for_compaction(HeapRegion* hr) {
    if (!_collector->is_free(hr->hrm_index())) {
!     if (UseAltGCForwarding) {
!       G1PrepareCompactLiveClosure<true> prepare_compact(_cp);
+       hr->apply_to_marked_objects(_bitmap, &prepare_compact);
+     } else {
+       G1PrepareCompactLiveClosure<false> prepare_compact(_cp);
+       hr->apply_to_marked_objects(_bitmap, &prepare_compact);
+     }
    }
  }
< prev index next >