154 size_t addr_to_offset(const HeapWord* addr) const {
155 return pointer_delta(addr, _covered.start()) >> _shifter;
156 }
157 public:
158 static size_t compute_size(size_t heap_size);
159 // Returns the amount of bytes on the heap between two marks in the bitmap.
160 static size_t mark_distance();
161 // Returns how many bytes (or bits) of the heap a single byte (or bit) of the
162 // mark bitmap corresponds to. This is the same as the mark distance above.
163 static size_t heap_map_factor() {
164 return mark_distance();
165 }
166
167 G1CMBitMap() : _covered(), _bm(), _shifter(LogMinObjAlignment), _listener() { _listener.set_bitmap(this); }
168
169 // Initializes the underlying BitMap to cover the given area.
170 void initialize(MemRegion heap, G1RegionToSpaceMapper* storage);
171
172 // read marks
173 bool is_marked(HeapWord* addr) const {
174 assert(_covered.contains(addr), "Address " PTR_FORMAT " is outside underlying space from " PTR_FORMAT " to " PTR_FORMAT, p2i(addr), p2i(_covered.start()), p2i(_covered.end()));
175 return _bm.at(addr_to_offset(addr));
176 }
177
178 // Apply the closure to the addresses that correspond to marked bits in the bitmap.
179 inline bool iterate(G1CMBitMapClosure* cl, MemRegion mr);
180
181 // Return the address corresponding to the next marked bit at or after
182 // "addr", and before "limit", if "limit" is non-NULL. If there is no
183 // such bit, returns "limit" if that is non-NULL, or else "endWord()".
184 inline HeapWord* get_next_marked_addr(const HeapWord* addr,
185 const HeapWord* limit) const;
186
187 // The argument addr should be the start address of a valid object
188 inline HeapWord* addr_after_obj(HeapWord* addr);
189
190 void print_on_error(outputStream* st, const char* prefix) const;
191
192 // Write marks.
193 inline void mark(HeapWord* addr);
194 inline void clear(HeapWord* addr);
|
154 size_t addr_to_offset(const HeapWord* addr) const {
155 return pointer_delta(addr, _covered.start()) >> _shifter;
156 }
157 public:
158 static size_t compute_size(size_t heap_size);
159 // Returns the amount of bytes on the heap between two marks in the bitmap.
160 static size_t mark_distance();
161 // Returns how many bytes (or bits) of the heap a single byte (or bit) of the
162 // mark bitmap corresponds to. This is the same as the mark distance above.
163 static size_t heap_map_factor() {
164 return mark_distance();
165 }
166
167 G1CMBitMap() : _covered(), _bm(), _shifter(LogMinObjAlignment), _listener() { _listener.set_bitmap(this); }
168
169 // Initializes the underlying BitMap to cover the given area.
170 void initialize(MemRegion heap, G1RegionToSpaceMapper* storage);
171
172 // read marks
173 bool is_marked(HeapWord* addr) const {
174 assert(_covered.contains(addr),
175 "Address " PTR_FORMAT " is outside underlying space from " PTR_FORMAT " to " PTR_FORMAT,
176 p2i(addr), p2i(_covered.start()), p2i(_covered.end()));
177 return _bm.at(addr_to_offset(addr));
178 }
179
180 // Apply the closure to the addresses that correspond to marked bits in the bitmap.
181 inline bool iterate(G1CMBitMapClosure* cl, MemRegion mr);
182
183 // Return the address corresponding to the next marked bit at or after
184 // "addr", and before "limit", if "limit" is non-NULL. If there is no
185 // such bit, returns "limit" if that is non-NULL, or else "endWord()".
186 inline HeapWord* get_next_marked_addr(const HeapWord* addr,
187 const HeapWord* limit) const;
188
189 // The argument addr should be the start address of a valid object
190 inline HeapWord* addr_after_obj(HeapWord* addr);
191
192 void print_on_error(outputStream* st, const char* prefix) const;
193
194 // Write marks.
195 inline void mark(HeapWord* addr);
196 inline void clear(HeapWord* addr);
|