< prev index next >

src/hotspot/share/gc/serial/markSweep.inline.hpp

Print this page
@@ -25,10 +25,11 @@
  #ifndef SHARE_GC_SERIAL_MARKSWEEP_INLINE_HPP
  #define SHARE_GC_SERIAL_MARKSWEEP_INLINE_HPP
  
  #include "gc/serial/markSweep.hpp"
  
+ #include "gc/shared/slidingForwarding.inline.hpp"
  #include "classfile/classLoaderData.inline.hpp"
  #include "classfile/javaClasses.inline.hpp"
  #include "gc/serial/serialStringDedup.hpp"
  #include "memory/universe.hpp"
  #include "oops/markWord.hpp"

@@ -46,11 +47,11 @@
    }
  
    // some marks may contain information we need to preserve so we store them away
    // and overwrite the mark.  We'll restore it at the end of markSweep.
    markWord mark = obj->mark();
-   obj->set_mark(markWord::prototype().set_marked());
+   obj->set_mark(obj->klass()->prototype_header().set_marked());
  
    if (obj->mark_must_be_preserved(mark)) {
      preserve_mark(obj, mark);
    }
  }

@@ -80,35 +81,33 @@
  inline void MarkAndPushClosure::do_oop(oop* p)               { do_oop_work(p); }
  inline void MarkAndPushClosure::do_oop(narrowOop* p)         { do_oop_work(p); }
  inline void MarkAndPushClosure::do_klass(Klass* k)           { MarkSweep::follow_klass(k); }
  inline void MarkAndPushClosure::do_cld(ClassLoaderData* cld) { MarkSweep::follow_cld(cld); }
  
- template <class T> inline void MarkSweep::adjust_pointer(T* p) {
+ template <class T> inline void MarkSweep::adjust_pointer(const SlidingForwarding* const forwarding, T* p) {
    T heap_oop = RawAccess<>::oop_load(p);
    if (!CompressedOops::is_null(heap_oop)) {
      oop obj = CompressedOops::decode_not_null(heap_oop);
      assert(Universe::heap()->is_in(obj), "should be in heap");
  
-     oop new_obj = cast_to_oop(obj->mark().decode_pointer());
- 
-     assert(new_obj != NULL ||                      // is forwarding ptr?
-            obj->mark() == markWord::prototype(), // not gc marked?
-            "should be forwarded");
- 
-     if (new_obj != NULL) {
+     markWord header = obj->mark();
+     if (header.is_marked()) {
+       oop new_obj = forwarding->forwardee(obj);
+       assert(new_obj != NULL, "must be forwarded");
        assert(is_object_aligned(new_obj), "oop must be aligned");
        RawAccess<IS_NOT_NULL>::oop_store(p, new_obj);
      }
    }
  }
  
  template <typename T>
- void AdjustPointerClosure::do_oop_work(T* p)           { MarkSweep::adjust_pointer(p); }
+ void AdjustPointerClosure::do_oop_work(T* p)           { MarkSweep::adjust_pointer(_forwarding, p); }
  inline void AdjustPointerClosure::do_oop(oop* p)       { do_oop_work(p); }
  inline void AdjustPointerClosure::do_oop(narrowOop* p) { do_oop_work(p); }
  
  
- inline size_t MarkSweep::adjust_pointers(oop obj) {
-   return obj->oop_iterate_size(&MarkSweep::adjust_pointer_closure);
+ inline size_t MarkSweep::adjust_pointers(const SlidingForwarding* const forwarding, oop obj) {
+   AdjustPointerClosure cl(forwarding);
+   return obj->oop_iterate_size(&cl);
  }
  
  #endif // SHARE_GC_SERIAL_MARKSWEEP_INLINE_HPP
< prev index next >