126 if (region_size < HeapRegionBounds::min_size()) {
127 region_size = HeapRegionBounds::min_size();
128 } else if (region_size > HeapRegionBounds::max_size()) {
129 region_size = HeapRegionBounds::max_size();
130 }
131
132 // And recalculate the log.
133 region_size_log = log2_long((jlong) region_size);
134
135 // Now, set up the globals.
136 guarantee(LogOfHRGrainBytes == 0, "we should only set it once");
137 LogOfHRGrainBytes = region_size_log;
138
139 guarantee(LogOfHRGrainWords == 0, "we should only set it once");
140 LogOfHRGrainWords = LogOfHRGrainBytes - LogHeapWordSize;
141
142 guarantee(GrainBytes == 0, "we should only set it once");
143 // The cast to int is safe, given that we've bounded region_size by
144 // MIN_REGION_SIZE and MAX_REGION_SIZE.
145 GrainBytes = region_size;
146
147 guarantee(GrainWords == 0, "we should only set it once");
148 GrainWords = GrainBytes >> LogHeapWordSize;
149 guarantee((size_t) 1 << LogOfHRGrainWords == GrainWords, "sanity");
150
151 guarantee(CardsPerRegion == 0, "we should only set it once");
152 CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift;
153 }
154
155 void HeapRegion::reset_after_compaction() {
156 G1ContiguousSpace::reset_after_compaction();
157 // After a compaction the mark bitmap is invalid, so we must
158 // treat all objects as being inside the unmarked area.
159 zero_marked_bytes();
160 init_top_at_mark_start();
161 }
162
163 void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) {
164 assert(_humongous_start_region == NULL,
165 "we should have already filtered out humongous regions");
|
126 if (region_size < HeapRegionBounds::min_size()) {
127 region_size = HeapRegionBounds::min_size();
128 } else if (region_size > HeapRegionBounds::max_size()) {
129 region_size = HeapRegionBounds::max_size();
130 }
131
132 // And recalculate the log.
133 region_size_log = log2_long((jlong) region_size);
134
135 // Now, set up the globals.
136 guarantee(LogOfHRGrainBytes == 0, "we should only set it once");
137 LogOfHRGrainBytes = region_size_log;
138
139 guarantee(LogOfHRGrainWords == 0, "we should only set it once");
140 LogOfHRGrainWords = LogOfHRGrainBytes - LogHeapWordSize;
141
142 guarantee(GrainBytes == 0, "we should only set it once");
143 // The cast to int is safe, given that we've bounded region_size by
144 // MIN_REGION_SIZE and MAX_REGION_SIZE.
145 GrainBytes = region_size;
146 log_info(gc, heap)("Heap region size: " SIZE_FORMAT "M", GrainBytes / M);
147
148 guarantee(GrainWords == 0, "we should only set it once");
149 GrainWords = GrainBytes >> LogHeapWordSize;
150 guarantee((size_t) 1 << LogOfHRGrainWords == GrainWords, "sanity");
151
152 guarantee(CardsPerRegion == 0, "we should only set it once");
153 CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift;
154 }
155
156 void HeapRegion::reset_after_compaction() {
157 G1ContiguousSpace::reset_after_compaction();
158 // After a compaction the mark bitmap is invalid, so we must
159 // treat all objects as being inside the unmarked area.
160 zero_marked_bytes();
161 init_top_at_mark_start();
162 }
163
164 void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) {
165 assert(_humongous_start_region == NULL,
166 "we should have already filtered out humongous regions");
|