File tree Expand file tree Collapse file tree 3 files changed +9
-14
lines changed
Expand file tree Collapse file tree 3 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -45,15 +45,13 @@ ZLiveMap::ZLiveMap(size_t size)
4545 _live_bytes(0 ),
4646 _segment_live_bits(0 ),
4747 _segment_claim_bits(0 ),
48- _num_bits( size),
48+ _bitmap_size(bitmap_size( size, NumSegments) ),
4949 _bitmap(0 ),
50- _segment_shift(0 ) {}
50+ _segment_shift(log2i_exact(segment_size()) ) {}
5151
5252void ZLiveMap::initialize_bitmap () {
53- const size_t new_bitmap_size = bitmap_size (_num_bits, NumSegments);
54- if (_bitmap.size () != new_bitmap_size) {
55- _segment_shift = log2i_exact (new_bitmap_size / NumSegments);
56- _bitmap.reinitialize (new_bitmap_size, false /* clear */ );
53+ if (_bitmap.size () != _bitmap_size) {
54+ _bitmap.initialize (_bitmap_size, false /* clear */ );
5755 }
5856}
5957
@@ -77,7 +75,7 @@ void ZLiveMap::reset(ZGenerationId id) {
7775 segment_live_bits ().clear ();
7876 segment_claim_bits ().clear ();
7977
80- // We lazily initialize the bitmap the first time the page is marked, i.e
78+ // We lazily initialize the bitmap the first time the page is marked, i.e.
8179 // a bit is about to be set for the first time.
8280 initialize_bitmap ();
8381
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class ZLiveMap {
4242 volatile size_t _live_bytes;
4343 BitMap::bm_word_t _segment_live_bits;
4444 BitMap::bm_word_t _segment_claim_bits;
45- size_t _num_bits ;
45+ size_t _bitmap_size ;
4646 ZBitMap _bitmap;
4747 int _segment_shift;
4848
Original file line number Diff line number Diff line change @@ -88,20 +88,17 @@ inline BitMap::idx_t ZLiveMap::next_live_segment(BitMap::idx_t segment) const {
8888}
8989
9090inline BitMap::idx_t ZLiveMap::segment_size () const {
91- return _bitmap. size () / NumSegments;
91+ return _bitmap_size / NumSegments;
9292}
9393
9494inline BitMap::idx_t ZLiveMap::index_to_segment (BitMap::idx_t index) const {
9595 return index >> _segment_shift;
9696}
9797
9898inline bool ZLiveMap::get (ZGenerationId id, BitMap::idx_t index) const {
99- if (!is_marked (id)) {
100- return false ;
101- }
102-
10399 const BitMap::idx_t segment = index_to_segment (index);
104- return is_segment_live (segment) && // Segment is marked
100+ return is_marked (id) && // Page is marked
101+ is_segment_live (segment) && // Segment is marked
105102 _bitmap.par_at (index, memory_order_relaxed); // Object is marked
106103}
107104
You can’t perform that action at this time.
0 commit comments