< 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/workerThread.hpp"
  #include "gc/shared/workerUtils.hpp"
  #include "memory/allocation.inline.hpp"
  #include "memory/resourceArea.hpp"
  #include "oops/oop.inline.hpp"

@@ -38,10 +39,12 @@
      elem.set_mark();
    }
    assert_empty();
  }
  
+ // TODO: This method is unused, except in the gunit test. Change the test
+ // to exercise the updated method below instead, and remove this one.
  void PreservedMarks::adjust_during_full_gc() {
    StackIterator<OopAndMarkWord, mtGC> iter(_stack);
    while (!iter.is_empty()) {
      OopAndMarkWord* elem = iter.next_addr();
  

@@ -50,10 +53,22 @@
        elem->set_oop(obj->forwardee());
      }
    }
  }
  
+ void PreservedMarks::adjust_during_full_gc(const SlidingForwarding* const forwarding) {
+   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(forwarding->forwardee(obj));
+     }
+   }
+ }
+ 
  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 >