< prev index next >

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

Print this page




  37   return _virtual.start();
  38 }
  39 
  40 inline size_t ZForwarding::size() const {
  41   return _virtual.size();
  42 }
  43 
  44 inline size_t ZForwarding::object_alignment_shift() const {
  45   return _object_alignment_shift;
  46 }
  47 
  48 inline ZPage* ZForwarding::page() const {
  49   return _page;
  50 }
  51 
  52 inline bool ZForwarding::is_pinned() const {
  53   return Atomic::load(&_pinned);
  54 }
  55 
  56 inline void ZForwarding::set_pinned() {
  57   Atomic::store(true, &_pinned);
  58 }
  59 
  60 inline bool ZForwarding::inc_refcount() {
  61   uint32_t refcount = Atomic::load(&_refcount);
  62 
  63   while (refcount > 0) {
  64     const uint32_t old_refcount = refcount;
  65     const uint32_t new_refcount = old_refcount + 1;
  66     const uint32_t prev_refcount = Atomic::cmpxchg(new_refcount, &_refcount, old_refcount);
  67     if (prev_refcount == old_refcount) {
  68       return true;
  69     }
  70 
  71     refcount = prev_refcount;
  72   }
  73 
  74   return false;
  75 }
  76 
  77 inline bool ZForwarding::dec_refcount() {




  37   return _virtual.start();
  38 }
  39 
  40 inline size_t ZForwarding::size() const {
  41   return _virtual.size();
  42 }
  43 
  44 inline size_t ZForwarding::object_alignment_shift() const {
  45   return _object_alignment_shift;
  46 }
  47 
  48 inline ZPage* ZForwarding::page() const {
  49   return _page;
  50 }
  51 
  52 inline bool ZForwarding::is_pinned() const {
  53   return Atomic::load(&_pinned);
  54 }
  55 
  56 inline void ZForwarding::set_pinned() {
  57   Atomic::store(&_pinned, true);
  58 }
  59 
  60 inline bool ZForwarding::inc_refcount() {
  61   uint32_t refcount = Atomic::load(&_refcount);
  62 
  63   while (refcount > 0) {
  64     const uint32_t old_refcount = refcount;
  65     const uint32_t new_refcount = old_refcount + 1;
  66     const uint32_t prev_refcount = Atomic::cmpxchg(new_refcount, &_refcount, old_refcount);
  67     if (prev_refcount == old_refcount) {
  68       return true;
  69     }
  70 
  71     refcount = prev_refcount;
  72   }
  73 
  74   return false;
  75 }
  76 
  77 inline bool ZForwarding::dec_refcount() {


< prev index next >