src/hotspot/share/gc/z/zLiveMap.inline.hpp
changeset 59038 b9a42ca342db
parent 54834 39ba09047e19
child 59039 c60978f87d45
equal deleted inserted replaced
59037:3d2575331a41 59038:b9a42ca342db
    28 #include "gc/z/zLiveMap.hpp"
    28 #include "gc/z/zLiveMap.hpp"
    29 #include "gc/z/zMark.hpp"
    29 #include "gc/z/zMark.hpp"
    30 #include "gc/z/zOop.inline.hpp"
    30 #include "gc/z/zOop.inline.hpp"
    31 #include "gc/z/zUtils.inline.hpp"
    31 #include "gc/z/zUtils.inline.hpp"
    32 #include "runtime/atomic.hpp"
    32 #include "runtime/atomic.hpp"
       
    33 #include "runtime/orderAccess.hpp"
    33 #include "utilities/bitMap.inline.hpp"
    34 #include "utilities/bitMap.inline.hpp"
    34 #include "utilities/debug.hpp"
    35 #include "utilities/debug.hpp"
    35 
    36 
    36 inline void ZLiveMap::reset() {
    37 inline void ZLiveMap::reset() {
    37   _seqnum = 0;
    38   _seqnum = 0;
    38 }
    39 }
    39 
    40 
    40 inline bool ZLiveMap::is_marked() const {
    41 inline bool ZLiveMap::is_marked() const {
    41   return _seqnum == ZGlobalSeqNum;
    42   return OrderAccess::load_acquire(&_seqnum) == ZGlobalSeqNum;
    42 }
    43 }
    43 
    44 
    44 inline uint32_t ZLiveMap::live_objects() const {
    45 inline uint32_t ZLiveMap::live_objects() const {
    45   assert(ZGlobalPhase != ZPhaseMark, "Invalid phase");
    46   assert(ZGlobalPhase != ZPhaseMark, "Invalid phase");
    46   return _live_objects;
    47   return _live_objects;
    66 inline BitMapView ZLiveMap::segment_claim_bits() {
    67 inline BitMapView ZLiveMap::segment_claim_bits() {
    67   return BitMapView(&_segment_claim_bits, nsegments);
    68   return BitMapView(&_segment_claim_bits, nsegments);
    68 }
    69 }
    69 
    70 
    70 inline bool ZLiveMap::is_segment_live(BitMap::idx_t segment) const {
    71 inline bool ZLiveMap::is_segment_live(BitMap::idx_t segment) const {
    71   return segment_live_bits().at(segment);
    72   return segment_live_bits().par_at(segment);
    72 }
    73 }
    73 
    74 
    74 inline bool ZLiveMap::set_segment_live_atomic(BitMap::idx_t segment) {
    75 inline bool ZLiveMap::set_segment_live_atomic(BitMap::idx_t segment) {
    75   return segment_live_bits().par_set_bit(segment);
    76   return segment_live_bits().par_set_bit(segment, memory_order_release);
    76 }
    77 }
    77 
    78 
    78 inline bool ZLiveMap::claim_segment(BitMap::idx_t segment) {
    79 inline bool ZLiveMap::claim_segment(BitMap::idx_t segment) {
    79   return segment_claim_bits().par_set_bit(segment);
    80   return segment_claim_bits().par_set_bit(segment, memory_order_acq_rel);
    80 }
    81 }
    81 
    82 
    82 inline BitMap::idx_t ZLiveMap::first_live_segment() const {
    83 inline BitMap::idx_t ZLiveMap::first_live_segment() const {
    83   return segment_live_bits().get_next_one_offset(0, nsegments);
    84   return segment_live_bits().get_next_one_offset(0, nsegments);
    84 }
    85 }