< prev index next >

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

Print this page
*** 93,18 ***
  }
  
  void G1FullGCCompactionPoint::forward(oop object, size_t size) {
    assert(_current_region != NULL, "Must have been initialized");
  
    // Ensure the object fit in the current region.
!   while (!object_will_fit(size)) {
      switch_region();
    }
  
!   // Store a forwarding pointer if the object should be moved.
!   if (cast_from_oop<HeapWord*>(object) != _compaction_top) {
      object->forward_to(cast_to_oop(_compaction_top));
    } else {
      if (object->forwardee() != NULL) {
        // Object should not move but mark-word is used so it looks like the
        // object is forwarded. Need to clear the mark and it's no problem
        // since it will be restored by preserved marks.
--- 93,21 ---
  }
  
  void G1FullGCCompactionPoint::forward(oop object, size_t size) {
    assert(_current_region != NULL, "Must have been initialized");
  
+   size_t csize = object->compact_size((int)size); // TODO LOOM TRICKY; CONSIDER
+ 
    // Ensure the object fit in the current region.
!   while (!object_will_fit(csize)) {
      switch_region();
    }
  
!   // Store a forwarding pointer if the object should be moved or compacted in place.
!   if (cast_from_oop<HeapWord*>(object) != _compaction_top || csize < size) {
      object->forward_to(cast_to_oop(_compaction_top));
+     size = csize;
    } else {
      if (object->forwardee() != NULL) {
        // Object should not move but mark-word is used so it looks like the
        // object is forwarded. Need to clear the mark and it's no problem
        // since it will be restored by preserved marks.
< prev index next >