284
285 public:
286 ShenandoahHeapRegion(HeapWord* start, size_t index, bool committed);
287
288 // Absolute minimums and maximums we should not ever break.
289 static const size_t MIN_NUM_REGIONS = 10;
290 static const size_t MIN_REGION_SIZE = 256*K;
291 static const size_t MAX_REGION_SIZE = 32*M;
292
293 // Return adjusted max heap size
294 static size_t setup_sizes(size_t max_heap_size);
295
296 double empty_time() {
297 return _empty_time;
298 }
299
300 inline static size_t required_regions(size_t bytes) {
301 return (bytes + ShenandoahHeapRegion::region_size_bytes() - 1) >> ShenandoahHeapRegion::region_size_bytes_shift();
302 }
303
304 inline static bool requires_humongous(size_t words) {
305 return words > ShenandoahHeapRegion::RegionSizeWords;
306 }
307
308 inline static size_t region_count() {
309 return ShenandoahHeapRegion::RegionCount;
310 }
311
312 inline static size_t region_size_bytes() {
313 return ShenandoahHeapRegion::RegionSizeBytes;
314 }
315
316 inline static size_t region_size_words() {
317 return ShenandoahHeapRegion::RegionSizeWords;
318 }
319
320 inline static size_t region_size_bytes_shift() {
321 return ShenandoahHeapRegion::RegionSizeBytesShift;
322 }
323
324 inline static size_t region_size_words_shift() {
|
284
285 public:
286 ShenandoahHeapRegion(HeapWord* start, size_t index, bool committed);
287
288 // Absolute minimums and maximums we should not ever break.
289 static const size_t MIN_NUM_REGIONS = 10;
290 static const size_t MIN_REGION_SIZE = 256*K;
291 static const size_t MAX_REGION_SIZE = 32*M;
292
293 // Return adjusted max heap size
294 static size_t setup_sizes(size_t max_heap_size);
295
296 double empty_time() {
297 return _empty_time;
298 }
299
300 inline static size_t required_regions(size_t bytes) {
301 return (bytes + ShenandoahHeapRegion::region_size_bytes() - 1) >> ShenandoahHeapRegion::region_size_bytes_shift();
302 }
303
304 // Whether an allocation of the given word size must occupy a contiguous run of
305 // humongous regions rather than fitting in a single region.
306 //
307 // may_expand_for_hash must be set only when 'words' is the *base* size of a
308 // freshly allocated, not-yet-hashed object that could later grow by one word
309 // when an identity hash-code is injected as it is copied during GC (see
310 // oopDesc::copy_size). In that case we account for that potential growth when
311 // deciding whether the object needs the humongous path, so an object whose
312 // expanded form would overflow a region is routed to humongous from the start.
313 // It must be false for every size that is already final:
314 // - the live size of an existing object (obj->size()), which already includes
315 // the hash word once the object has been expanded by a prior GC copy;
316 // - an evacuation/promotion copy size (copy_size()), which is already expanded;
317 // - a raw LAB buffer (TLAB/GCLAB/PLAB), which never grows.
318 inline static bool requires_humongous(size_t words, bool may_expand_for_hash) {
319 if (UseCompactObjectHeaders && may_expand_for_hash) {
320 words = oopDesc::hash_expanded_size(words);
321 }
322 return words > ShenandoahHeapRegion::RegionSizeWords;
323 }
324
325 inline static size_t region_count() {
326 return ShenandoahHeapRegion::RegionCount;
327 }
328
329 inline static size_t region_size_bytes() {
330 return ShenandoahHeapRegion::RegionSizeBytes;
331 }
332
333 inline static size_t region_size_words() {
334 return ShenandoahHeapRegion::RegionSizeWords;
335 }
336
337 inline static size_t region_size_bytes_shift() {
338 return ShenandoahHeapRegion::RegionSizeBytesShift;
339 }
340
341 inline static size_t region_size_words_shift() {
|