< prev index next >

src/hotspot/share/gc/z/zOopClosures.inline.hpp

Print this page




  79 inline void ZPhantomKeepAliveOopClosure::do_oop(oop* p) {
  80   ZBarrier::keep_alive_barrier_on_phantom_oop_field(p);
  81 }
  82 
  83 inline void ZPhantomKeepAliveOopClosure::do_oop(narrowOop* p) {
  84   ShouldNotReachHere();
  85 }
  86 
  87 inline void ZPhantomCleanOopClosure::do_oop(oop* p) {
  88   // Read the oop once, to make sure the liveness check
  89   // and the later clearing uses the same value.
  90   const oop obj = *(volatile oop*)p;
  91   if (ZBarrier::is_alive_barrier_on_phantom_oop(obj)) {
  92     ZBarrier::keep_alive_barrier_on_phantom_oop_field(p);
  93   } else {
  94     // The destination could have been modified/reused, in which case
  95     // we don't want to clear it. However, no one could write the same
  96     // oop here again (the object would be strongly live and we would
  97     // not consider clearing such oops), so therefore we don't have an
  98     // ABA problem here.
  99     Atomic::cmpxchg(oop(NULL), p, obj);
 100   }
 101 }
 102 
 103 inline void ZPhantomCleanOopClosure::do_oop(narrowOop* p) {
 104   ShouldNotReachHere();
 105 }
 106 
 107 #endif // SHARE_GC_Z_ZOOPCLOSURES_INLINE_HPP


  79 inline void ZPhantomKeepAliveOopClosure::do_oop(oop* p) {
  80   ZBarrier::keep_alive_barrier_on_phantom_oop_field(p);
  81 }
  82 
  83 inline void ZPhantomKeepAliveOopClosure::do_oop(narrowOop* p) {
  84   ShouldNotReachHere();
  85 }
  86 
  87 inline void ZPhantomCleanOopClosure::do_oop(oop* p) {
  88   // Read the oop once, to make sure the liveness check
  89   // and the later clearing uses the same value.
  90   const oop obj = *(volatile oop*)p;
  91   if (ZBarrier::is_alive_barrier_on_phantom_oop(obj)) {
  92     ZBarrier::keep_alive_barrier_on_phantom_oop_field(p);
  93   } else {
  94     // The destination could have been modified/reused, in which case
  95     // we don't want to clear it. However, no one could write the same
  96     // oop here again (the object would be strongly live and we would
  97     // not consider clearing such oops), so therefore we don't have an
  98     // ABA problem here.
  99     Atomic::cmpxchg(p, obj, oop(NULL));
 100   }
 101 }
 102 
 103 inline void ZPhantomCleanOopClosure::do_oop(narrowOop* p) {
 104   ShouldNotReachHere();
 105 }
 106 
 107 #endif // SHARE_GC_Z_ZOOPCLOSURES_INLINE_HPP
< prev index next >