< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahForwarding.inline.hpp

Print this page
@@ -28,10 +28,11 @@
  #include "gc/shenandoah/shenandoahForwarding.hpp"
  
  #include "gc/shenandoah/shenandoahAsserts.hpp"
  #include "oops/markWord.hpp"
  #include "runtime/javaThread.hpp"
+ #include "runtime/synchronizer.hpp"
  
  inline oop ShenandoahForwarding::get_forwardee_raw(oop obj) {
    shenandoah_assert_in_heap(NULL, obj);
    return get_forwardee_raw_unchecked(obj);
  }

@@ -74,20 +75,23 @@
  inline bool ShenandoahForwarding::is_forwarded(oop obj) {
    return obj->mark().is_marked();
  }
  
  inline oop ShenandoahForwarding::try_update_forwardee(oop obj, oop update) {
-   markWord old_mark = obj->mark();
+ 
+   markWord old_mark = obj->mark_acquire();
+ 
    if (old_mark.is_marked()) {
      return cast_to_oop(old_mark.clear_lock_bits().to_pointer());
    }
  
    markWord new_mark = markWord::encode_pointer_as_mark(update);
    markWord prev_mark = obj->cas_set_mark(new_mark, old_mark, memory_order_conservative);
    if (prev_mark == old_mark) {
      return update;
    } else {
+     assert(prev_mark.is_marked(), "must be forwarded");
      return cast_to_oop(prev_mark.clear_lock_bits().to_pointer());
    }
  }
  
  #endif // SHARE_GC_SHENANDOAH_SHENANDOAHFORWARDING_INLINE_HPP
< prev index next >