< prev index next >

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

Print this page




  57 
  58   markWord mark = obj->mark_raw();
  59   if (mark.is_marked()) {
  60     HeapWord* fwdptr = (HeapWord*) mark.clear_lock_bits().to_pointer();
  61     assert(fwdptr != NULL, "Forwarding pointer is never null here");
  62     return cast_to_oop(fwdptr);
  63   } else {
  64     return obj;
  65   }
  66 }
  67 
  68 inline oop ShenandoahForwarding::get_forwardee(oop obj) {
  69   shenandoah_assert_correct(NULL, obj);
  70   return oop(get_forwardee_raw_unchecked(obj));
  71 }
  72 
  73 inline bool ShenandoahForwarding::is_forwarded(oop obj) {
  74   return obj->mark_raw().is_marked();
  75 }
  76 
  77 inline oop ShenandoahForwarding::try_update_forwardee(oop obj, oop update) {
  78   markWord old_mark = obj->mark_raw();
  79   if (old_mark.is_marked()) {
  80     return oop(old_mark.clear_lock_bits().to_pointer());
  81   }
  82 
  83   markWord new_mark = markWord::encode_pointer_as_mark(update);
  84   markWord prev_mark = obj->cas_set_mark_raw(new_mark, old_mark);
  85   if (prev_mark == old_mark) {
  86     return update;
  87   } else {
  88     return oop(prev_mark.clear_lock_bits().to_pointer());
  89   }
  90 }
  91 
  92 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHFORWARDING_INLINE_HPP


  57 
  58   markWord mark = obj->mark_raw();
  59   if (mark.is_marked()) {
  60     HeapWord* fwdptr = (HeapWord*) mark.clear_lock_bits().to_pointer();
  61     assert(fwdptr != NULL, "Forwarding pointer is never null here");
  62     return cast_to_oop(fwdptr);
  63   } else {
  64     return obj;
  65   }
  66 }
  67 
  68 inline oop ShenandoahForwarding::get_forwardee(oop obj) {
  69   shenandoah_assert_correct(NULL, obj);
  70   return oop(get_forwardee_raw_unchecked(obj));
  71 }
  72 
  73 inline bool ShenandoahForwarding::is_forwarded(oop obj) {
  74   return obj->mark_raw().is_marked();
  75 }
  76 
  77 inline void ShenandoahForwarding::update_forwardee(oop obj, oop update) {
  78   markWord old_mark = obj->mark_raw();




  79   markWord new_mark = markWord::encode_pointer_as_mark(update);
  80   obj->set_mark_raw(new_mark);





  81 }
  82 
  83 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHFORWARDING_INLINE_HPP
< prev index next >