< prev index next >

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

Print this page

 33 #include "gc/z/zUtils.inline.hpp"
 34 #include "utilities/bitMap.inline.hpp"
 35 #include "utilities/debug.hpp"
 36 
 37 inline void ZLiveMap::reset() {
 38   _seqnum.store_relaxed(0u);
 39 }
 40 
 41 inline bool ZLiveMap::is_marked(ZGenerationId id) const {
 42   return _seqnum.load_acquire() == ZGeneration::generation(id)->seqnum();
 43 }
 44 
 45 inline uint32_t ZLiveMap::live_objects() const {
 46   return _live_objects.load_relaxed();
 47 }
 48 
 49 inline size_t ZLiveMap::live_bytes() const {
 50   return _live_bytes.load_relaxed();
 51 }
 52 




 53 inline const BitMapView ZLiveMap::segment_live_bits() const {
 54   return BitMapView(const_cast<BitMap::bm_word_t*>(&_segment_live_bits), NumSegments);
 55 }
 56 
 57 inline const BitMapView ZLiveMap::segment_claim_bits() const {
 58   return BitMapView(const_cast<BitMap::bm_word_t*>(&_segment_claim_bits), NumSegments);
 59 }
 60 
 61 inline BitMapView ZLiveMap::segment_live_bits() {
 62   return BitMapView(&_segment_live_bits, NumSegments);
 63 }
 64 
 65 inline BitMapView ZLiveMap::segment_claim_bits() {
 66   return BitMapView(&_segment_claim_bits, NumSegments);
 67 }
 68 
 69 inline bool ZLiveMap::is_segment_live(BitMap::idx_t segment) const {
 70   return segment_live_bits().par_at(segment);
 71 }
 72 

102     // First object to be marked during this
103     // cycle, reset marking information.
104     reset(id);
105   }
106 
107   const BitMap::idx_t segment = index_to_segment(index);
108   if (!is_segment_live(segment)) {
109     // First object to be marked in this segment during
110     // this cycle, reset segment bitmap.
111     reset_segment(segment);
112   }
113 
114   return _bitmap.par_set_bit_pair(index, finalizable, inc_live);
115 }
116 
117 inline void ZLiveMap::inc_live(uint32_t objects, size_t bytes) {
118   _live_objects.add_then_fetch(objects);
119   _live_bytes.add_then_fetch(bytes);
120 }
121 




122 inline BitMap::idx_t ZLiveMap::segment_start(BitMap::idx_t segment) const {
123   return segment * _segment_size;
124 }
125 
126 inline BitMap::idx_t ZLiveMap::segment_end(BitMap::idx_t segment) const {
127   return segment_start(segment) + _segment_size;
128 }
129 
130 inline size_t ZLiveMap::do_object(ObjectClosure* cl, zaddress addr) const {
131   // Get the size of the object before calling the closure, which
132   // might overwrite the object in case we are relocating in-place.
133   const size_t size = ZUtils::object_size(addr);
134 
135   // Apply closure
136   cl->do_object(to_oop(addr));
137 
138   return size;
139 }
140 
141 template <typename Function>

 33 #include "gc/z/zUtils.inline.hpp"
 34 #include "utilities/bitMap.inline.hpp"
 35 #include "utilities/debug.hpp"
 36 
 37 inline void ZLiveMap::reset() {
 38   _seqnum.store_relaxed(0u);
 39 }
 40 
 41 inline bool ZLiveMap::is_marked(ZGenerationId id) const {
 42   return _seqnum.load_acquire() == ZGeneration::generation(id)->seqnum();
 43 }
 44 
 45 inline uint32_t ZLiveMap::live_objects() const {
 46   return _live_objects.load_relaxed();
 47 }
 48 
 49 inline size_t ZLiveMap::live_bytes() const {
 50   return _live_bytes.load_relaxed();
 51 }
 52 
 53 inline uint32_t ZLiveMap::will_expand_objects() const {
 54   return _will_expand_objects.load_relaxed();
 55 }
 56 
 57 inline const BitMapView ZLiveMap::segment_live_bits() const {
 58   return BitMapView(const_cast<BitMap::bm_word_t*>(&_segment_live_bits), NumSegments);
 59 }
 60 
 61 inline const BitMapView ZLiveMap::segment_claim_bits() const {
 62   return BitMapView(const_cast<BitMap::bm_word_t*>(&_segment_claim_bits), NumSegments);
 63 }
 64 
 65 inline BitMapView ZLiveMap::segment_live_bits() {
 66   return BitMapView(&_segment_live_bits, NumSegments);
 67 }
 68 
 69 inline BitMapView ZLiveMap::segment_claim_bits() {
 70   return BitMapView(&_segment_claim_bits, NumSegments);
 71 }
 72 
 73 inline bool ZLiveMap::is_segment_live(BitMap::idx_t segment) const {
 74   return segment_live_bits().par_at(segment);
 75 }
 76 

106     // First object to be marked during this
107     // cycle, reset marking information.
108     reset(id);
109   }
110 
111   const BitMap::idx_t segment = index_to_segment(index);
112   if (!is_segment_live(segment)) {
113     // First object to be marked in this segment during
114     // this cycle, reset segment bitmap.
115     reset_segment(segment);
116   }
117 
118   return _bitmap.par_set_bit_pair(index, finalizable, inc_live);
119 }
120 
121 inline void ZLiveMap::inc_live(uint32_t objects, size_t bytes) {
122   _live_objects.add_then_fetch(objects);
123   _live_bytes.add_then_fetch(bytes);
124 }
125 
126 inline void ZLiveMap::inc_will_expand(uint32_t objects) {
127   _will_expand_objects.add_then_fetch(objects);
128 }
129 
130 inline BitMap::idx_t ZLiveMap::segment_start(BitMap::idx_t segment) const {
131   return segment * _segment_size;
132 }
133 
134 inline BitMap::idx_t ZLiveMap::segment_end(BitMap::idx_t segment) const {
135   return segment_start(segment) + _segment_size;
136 }
137 
138 inline size_t ZLiveMap::do_object(ObjectClosure* cl, zaddress addr) const {
139   // Get the size of the object before calling the closure, which
140   // might overwrite the object in case we are relocating in-place.
141   const size_t size = ZUtils::object_size(addr);
142 
143   // Apply closure
144   cl->do_object(to_oop(addr));
145 
146   return size;
147 }
148 
149 template <typename Function>
< prev index next >