< 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 "code/nmethod.hpp"
  #include "gc/shared/continuationGCSupport.inline.hpp"
  #include "gc/serial/serialStringDedup.hpp"

@@ -49,11 +50,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());
  
    ContinuationGCSupport::transform_stack_chunk(obj);
  
    if (obj->mark_must_be_preserved(mark)) {
      preserve_mark(obj, mark);

@@ -87,30 +88,33 @@
  inline void MarkAndPushClosure::do_klass(Klass* k)           { MarkSweep::follow_klass(k); }
  inline void MarkAndPushClosure::do_cld(ClassLoaderData* cld) { MarkSweep::follow_cld(cld); }
  inline void MarkAndPushClosure::do_method(Method* m)         { m->record_gc_epoch(); }
  inline void MarkAndPushClosure::do_nmethod(nmethod* nm)      { nm->follow_nmethod(this); }
  
- 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");
  
-     if (obj->is_forwarded()) {
-       oop new_obj = obj->forwardee();
+     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 >