< prev index next >

src/hotspot/share/gc/shared/preservedMarks.cpp

Print this page
*** 22,10 ***
--- 22,11 ---
   *
   */
  
  #include "precompiled.hpp"
  #include "gc/shared/preservedMarks.inline.hpp"
+ #include "gc/shared/slidingForwarding.inline.hpp"
  #include "gc/shared/workgroup.hpp"
  #include "memory/allocation.inline.hpp"
  #include "memory/resourceArea.hpp"
  #include "oops/oop.inline.hpp"
  #include "runtime/atomic.hpp"

*** 37,22 ***
      elem.set_mark();
    }
    assert_empty();
  }
  
! void PreservedMarks::adjust_during_full_gc() {
    StackIterator<OopAndMarkWord, mtGC> iter(_stack);
    while (!iter.is_empty()) {
      OopAndMarkWord* elem = iter.next_addr();
  
      oop obj = elem->get_oop();
!     if (obj->is_forwarded()) {
!       elem->set_oop(obj->forwardee());
      }
    }
  }
  
  void PreservedMarks::restore_and_increment(volatile size_t* const total_size_addr) {
    const size_t stack_size = size();
    restore();
    // Only do the atomic add if the size is > 0.
    if (stack_size > 0) {
--- 38,31 ---
      elem.set_mark();
    }
    assert_empty();
  }
  
! template <bool ALT_FWD>
+ void PreservedMarks::adjust_during_full_gc_impl() {
    StackIterator<OopAndMarkWord, mtGC> iter(_stack);
    while (!iter.is_empty()) {
      OopAndMarkWord* elem = iter.next_addr();
  
      oop obj = elem->get_oop();
!     if (SlidingForwarding::is_forwarded(obj)) {
!       elem->set_oop(SlidingForwarding::forwardee<ALT_FWD>(obj));
      }
    }
  }
  
+ void PreservedMarks::adjust_during_full_gc() {
+   if (UseAltGCForwarding) {
+     adjust_during_full_gc_impl<true>();
+   } else {
+     adjust_during_full_gc_impl<false>();
+   }
+ }
+ 
  void PreservedMarks::restore_and_increment(volatile size_t* const total_size_addr) {
    const size_t stack_size = size();
    restore();
    // Only do the atomic add if the size is > 0.
    if (stack_size > 0) {
< prev index next >