< prev index next >

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

Print this page
*** 23,10 ***
--- 23,11 ---
   */
  
  #include "precompiled.hpp"
  #include "gc/g1/g1FullGCCompactionPoint.hpp"
  #include "gc/g1/heapRegion.hpp"
+ #include "gc/shared/slidingForwarding.inline.hpp"
  #include "oops/oop.inline.hpp"
  #include "utilities/debug.hpp"
  
  G1FullGCCompactionPoint::G1FullGCCompactionPoint() :
      _current_region(NULL),

*** 91,22 ***
    // Get the next region and re-initialize the values.
    _current_region = next_region();
    initialize_values(true);
  }
  
  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. There is an exception
        // with BiasedLocking, in this case forwardee() will return NULL
--- 92,25 ---
    // Get the next region and re-initialize the values.
    _current_region = next_region();
    initialize_values(true);
  }
  
+ template <bool ALT_FWD>
  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) {
!     SlidingForwarding::forward_to<ALT_FWD>(object, cast_to_oop(_compaction_top));
    } else {
+     assert(!SlidingForwarding::is_forwarded(object), "should not be forwarded");
+     /*
      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. There is an exception
        // with BiasedLocking, in this case forwardee() will return NULL

*** 121,19 ***
--- 125,23 ---
               (UseBiasedLocking && object->has_bias_pattern()), // Will be restored by BiasedLocking
               "should have correct prototype obj: " PTR_FORMAT " mark: " PTR_FORMAT " prototype: " PTR_FORMAT,
               p2i(object), object->mark().value(), markWord::prototype_for_klass(object->klass()).value());
      }
      assert(object->forwardee() == NULL, "should be forwarded to NULL");
+     */
    }
  
    // Update compaction values.
    _compaction_top += size;
    if (_compaction_top > _threshold) {
      _threshold = _current_region->cross_threshold(_compaction_top - size, _compaction_top);
    }
  }
  
+ template void G1FullGCCompactionPoint::forward<true>(oop object, size_t size);
+ template void G1FullGCCompactionPoint::forward<false>(oop object, size_t size);
+ 
  void G1FullGCCompactionPoint::add(HeapRegion* hr) {
    _compaction_regions->append(hr);
  }
  
  HeapRegion* G1FullGCCompactionPoint::remove_last() {
< prev index next >