< prev index next >

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

Print this page
@@ -26,10 +26,11 @@
  #define SHARE_GC_SERIAL_MARKSWEEP_INLINE_HPP
  
  #include "gc/serial/markSweep.hpp"
  
  #include "classfile/classLoaderData.inline.hpp"
+ #include "gc/shared/slidingForwarding.inline.hpp"
  #include "memory/universe.hpp"
  #include "oops/markWord.inline.hpp"
  #include "oops/access.inline.hpp"
  #include "oops/compressedOops.inline.hpp"
  #include "oops/oop.inline.hpp"

@@ -38,11 +39,11 @@
  
  inline void MarkSweep::mark_object(oop obj) {
    // 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->prototype_mark().set_marked());
  
    if (obj->mark_must_be_preserved(mark)) {
      preserve_mark(obj, mark);
    }
  }

@@ -72,37 +73,38 @@
  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 <bool ALT_FWD, class T>
+ inline void MarkSweep::adjust_pointer(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?
-            (UseBiasedLocking && obj->mark().has_bias_pattern()),
-            // not gc marked?
-            "should be forwarded");
- 
-     if (new_obj != NULL) {
+     if (SlidingForwarding::is_forwarded(obj)) {
+       oop new_obj = SlidingForwarding::forwardee<ALT_FWD>(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 <bool ALT_FWD>
  template <typename T>
- void AdjustPointerClosure::do_oop_work(T* p)           { MarkSweep::adjust_pointer(p); }
- inline void AdjustPointerClosure::do_oop(oop* p)       { do_oop_work(p); }
- inline void AdjustPointerClosure::do_oop(narrowOop* p) { do_oop_work(p); }
+ void AdjustPointerClosure<ALT_FWD>::do_oop_work(T* p)           { MarkSweep::adjust_pointer<ALT_FWD>(p); }
+ 
+ template <bool ALT_FWD>
+ inline void AdjustPointerClosure<ALT_FWD>::do_oop(oop* p)       { do_oop_work(p); }
  
+ template <bool ALT_FWD>
+ inline void AdjustPointerClosure<ALT_FWD>::do_oop(narrowOop* p) { do_oop_work(p); }
  
+ template <bool ALT_FWD>
  inline int MarkSweep::adjust_pointers(oop obj) {
-   return obj->oop_iterate_size(&MarkSweep::adjust_pointer_closure);
+   AdjustPointerClosure<ALT_FWD> adjust_pointer_closure;
+   return obj->oop_iterate_size(&adjust_pointer_closure);
  }
  
  #endif // SHARE_GC_SERIAL_MARKSWEEP_INLINE_HPP
< prev index next >