97 int CMBitMapRO::heapWordDiffToOffsetDiff(size_t diff) const {
98 assert((diff & ((1 << _shifter) - 1)) == 0, "argument check");
99 return (int) (diff >> _shifter);
100 }
101
102 #ifndef PRODUCT
103 bool CMBitMapRO::covers(MemRegion heap_rs) const {
104 // assert(_bm.map() == _virtual_space.low(), "map inconsistency");
105 assert(((size_t)_bm.size() * ((size_t)1 << _shifter)) == _bmWordSize,
106 "size inconsistency");
107 return _bmStartWord == (HeapWord*)(heap_rs.start()) &&
108 _bmWordSize == heap_rs.word_size();
109 }
110 #endif
111
112 void CMBitMapRO::print_on_error(outputStream* st, const char* prefix) const {
113 _bm.print_on_error(st, prefix);
114 }
115
116 size_t CMBitMap::compute_size(size_t heap_size) {
117 return heap_size / mark_distance();
118 }
119
120 size_t CMBitMap::mark_distance() {
121 return MinObjAlignmentInBytes * BitsPerByte;
122 }
123
124 void CMBitMap::initialize(MemRegion heap, G1RegionToSpaceMapper* storage) {
125 _bmStartWord = heap.start();
126 _bmWordSize = heap.word_size();
127
128 _bm.set_map((BitMap::bm_word_t*) storage->reserved().start());
129 _bm.set_size(_bmWordSize >> _shifter);
130
131 storage->set_mapping_changed_listener(&_listener);
132 }
133
134 void CMBitMapMappingChangedListener::on_commit(uint start_region, size_t num_regions, bool zero_filled) {
135 if (zero_filled) {
136 return;
137 }
|
97 int CMBitMapRO::heapWordDiffToOffsetDiff(size_t diff) const {
98 assert((diff & ((1 << _shifter) - 1)) == 0, "argument check");
99 return (int) (diff >> _shifter);
100 }
101
102 #ifndef PRODUCT
103 bool CMBitMapRO::covers(MemRegion heap_rs) const {
104 // assert(_bm.map() == _virtual_space.low(), "map inconsistency");
105 assert(((size_t)_bm.size() * ((size_t)1 << _shifter)) == _bmWordSize,
106 "size inconsistency");
107 return _bmStartWord == (HeapWord*)(heap_rs.start()) &&
108 _bmWordSize == heap_rs.word_size();
109 }
110 #endif
111
112 void CMBitMapRO::print_on_error(outputStream* st, const char* prefix) const {
113 _bm.print_on_error(st, prefix);
114 }
115
116 size_t CMBitMap::compute_size(size_t heap_size) {
117 return ReservedSpace::allocation_align_size_up(heap_size / mark_distance());
118 }
119
120 size_t CMBitMap::mark_distance() {
121 return MinObjAlignmentInBytes * BitsPerByte;
122 }
123
124 void CMBitMap::initialize(MemRegion heap, G1RegionToSpaceMapper* storage) {
125 _bmStartWord = heap.start();
126 _bmWordSize = heap.word_size();
127
128 _bm.set_map((BitMap::bm_word_t*) storage->reserved().start());
129 _bm.set_size(_bmWordSize >> _shifter);
130
131 storage->set_mapping_changed_listener(&_listener);
132 }
133
134 void CMBitMapMappingChangedListener::on_commit(uint start_region, size_t num_regions, bool zero_filled) {
135 if (zero_filled) {
136 return;
137 }
|