< prev index next >

src/hotspot/share/gc/shared/space.inline.hpp

Print this page
*** 28,10 ***
--- 28,11 ---
  #include "gc/shared/space.hpp"
  
  #include "gc/shared/blockOffsetTable.inline.hpp"
  #include "gc/shared/collectedHeap.hpp"
  #include "gc/shared/generation.hpp"
+ #include "gc/shared/genCollectedHeap.hpp"
  #include "gc/shared/spaceDecorator.hpp"
  #include "oops/oopsHierarchy.hpp"
  #include "oops/oop.inline.hpp"
  #include "runtime/prefetch.inline.hpp"
  #include "runtime/safepoint.hpp"

*** 161,16 ***
    const intx interval = PrefetchScanIntervalInBytes;
  
    HeapWord* cur_obj = space->bottom();
    HeapWord* scan_limit = space->scan_limit();
  
    while (cur_obj < scan_limit) {
      if (space->scanned_block_is_obj(cur_obj) && cast_to_oop(cur_obj)->is_gc_marked()) {
        // prefetch beyond cur_obj
        Prefetch::write(cur_obj, interval);
        size_t size = space->scanned_block_size(cur_obj);
!       compact_top = cp->space->forward(cast_to_oop(cur_obj), size, cp, compact_top);
        cur_obj += size;
        end_of_live = cur_obj;
      } else {
        // run over all the contiguous dead objects
        HeapWord* end = cur_obj;
--- 162,17 ---
    const intx interval = PrefetchScanIntervalInBytes;
  
    HeapWord* cur_obj = space->bottom();
    HeapWord* scan_limit = space->scan_limit();
  
+   SlidingForwarding* const forwarding = GenCollectedHeap::heap()->forwarding();
    while (cur_obj < scan_limit) {
      if (space->scanned_block_is_obj(cur_obj) && cast_to_oop(cur_obj)->is_gc_marked()) {
        // prefetch beyond cur_obj
        Prefetch::write(cur_obj, interval);
        size_t size = space->scanned_block_size(cur_obj);
!       compact_top = cp->space->forward(cast_to_oop(cur_obj), size, cp, compact_top, forwarding);
        cur_obj += size;
        end_of_live = cur_obj;
      } else {
        // run over all the contiguous dead objects
        HeapWord* end = cur_obj;

*** 182,11 ***
  
        // see if we might want to pretend this object is alive so that
        // we don't have to compact quite as often.
        if (cur_obj == compact_top && dead_spacer.insert_deadspace(cur_obj, end)) {
          oop obj = cast_to_oop(cur_obj);
!         compact_top = cp->space->forward(obj, obj->size(), cp, compact_top);
          end_of_live = end;
        } else {
          // otherwise, it really is a free region.
  
          // cur_obj is a pointer to a dead object. Use this dead memory to store a pointer to the next live object.
--- 184,11 ---
  
        // see if we might want to pretend this object is alive so that
        // we don't have to compact quite as often.
        if (cur_obj == compact_top && dead_spacer.insert_deadspace(cur_obj, end)) {
          oop obj = cast_to_oop(cur_obj);
!         compact_top = cp->space->forward(obj, obj->size(), cp, compact_top, forwarding);
          end_of_live = end;
        } else {
          // otherwise, it really is a free region.
  
          // cur_obj is a pointer to a dead object. Use this dead memory to store a pointer to the next live object.

*** 221,10 ***
--- 223,11 ---
    // Used by MarkSweep::mark_sweep_phase3()
  
    HeapWord* cur_obj = space->bottom();
    HeapWord* const end_of_live = space->_end_of_live;  // Established by "scan_and_forward".
    HeapWord* const first_dead = space->_first_dead;    // Established by "scan_and_forward".
+   const SlidingForwarding* const forwarding = GenCollectedHeap::heap()->forwarding();
  
    assert(first_dead <= end_of_live, "Stands to reason, no?");
  
    const intx interval = PrefetchScanIntervalInBytes;
  

*** 232,11 ***
    while (cur_obj < end_of_live) {
      Prefetch::write(cur_obj, interval);
      if (cur_obj < first_dead || cast_to_oop(cur_obj)->is_gc_marked()) {
        // cur_obj is alive
        // point all the oops to the new location
!       size_t size = MarkSweep::adjust_pointers(cast_to_oop(cur_obj));
        size = space->adjust_obj_size(size);
        debug_only(prev_obj = cur_obj);
        cur_obj += size;
      } else {
        debug_only(prev_obj = cur_obj);
--- 235,11 ---
    while (cur_obj < end_of_live) {
      Prefetch::write(cur_obj, interval);
      if (cur_obj < first_dead || cast_to_oop(cur_obj)->is_gc_marked()) {
        // cur_obj is alive
        // point all the oops to the new location
!       size_t size = MarkSweep::adjust_pointers(forwarding, cast_to_oop(cur_obj));
        size = space->adjust_obj_size(size);
        debug_only(prev_obj = cur_obj);
        cur_obj += size;
      } else {
        debug_only(prev_obj = cur_obj);

*** 314,10 ***
--- 317,12 ---
      // All object before _first_dead can be skipped. They should not be moved.
      // A pointer to the first live object is stored at the memory location for _first_dead.
      cur_obj = *(HeapWord**)(space->_first_dead);
    }
  
+   const SlidingForwarding* const forwarding = GenCollectedHeap::heap()->forwarding();
+ 
    debug_only(HeapWord* prev_obj = NULL);
    while (cur_obj < end_of_live) {
      if (!cast_to_oop(cur_obj)->is_gc_marked()) {
        debug_only(prev_obj = cur_obj);
        // The first word of the dead object contains a pointer to the next live object or end of space.

*** 327,11 ***
        // prefetch beyond q
        Prefetch::read(cur_obj, scan_interval);
  
        // size and destination
        size_t size = space->obj_size(cur_obj);
!       HeapWord* compaction_top = cast_from_oop<HeapWord*>(cast_to_oop(cur_obj)->forwardee());
  
        // prefetch beyond compaction_top
        Prefetch::write(compaction_top, copy_interval);
  
        // copy object and reinit its mark
--- 332,11 ---
        // prefetch beyond q
        Prefetch::read(cur_obj, scan_interval);
  
        // size and destination
        size_t size = space->obj_size(cur_obj);
!       HeapWord* compaction_top = cast_from_oop<HeapWord*>(forwarding->forwardee(cast_to_oop(cur_obj)));
  
        // prefetch beyond compaction_top
        Prefetch::write(compaction_top, copy_interval);
  
        // copy object and reinit its mark
< prev index next >