350 size_t live_data = (size_t)OrderAccess::load_acquire(&_live_data);
351 return (live_data == 0) ? 0 : (used() >> LogHeapWordSize);
352 } else {
353 const ShenandoahHeapRegion* start = humongous_start_region();
354 return start->get_live_data_words() == 0 ? 0 : (used() >> LogHeapWordSize);
355 }
356 } else {
357 return (size_t)OrderAccess::load_acquire(&_live_data);
358 }
359 }
360
361 size_t ShenandoahHeapRegion::get_live_data_bytes() const {
362 return get_live_data_words() * HeapWordSize;
363 }
364
365 bool ShenandoahHeapRegion::has_live() const {
366 return get_live_data_words() != 0;
367 }
368
369 size_t ShenandoahHeapRegion::garbage() const {
370 assert(used() >= get_live_data_bytes() || is_humongous(), "Live Data must be a subset of used() live: "SIZE_FORMAT" used: "SIZE_FORMAT,
371 get_live_data_bytes(), used());
372
373 size_t result = used() - get_live_data_bytes();
374 return result;
375 }
376
377 bool ShenandoahHeapRegion::in_collection_set() const {
378 return _heap->region_in_collection_set(_region_number);
379 }
380
381 void ShenandoahHeapRegion::print_on(outputStream* st) const {
382 st->print("|" PTR_FORMAT, p2i(this));
383 st->print("|" SIZE_FORMAT_W(5), this->_region_number);
384
385 switch (_state) {
386 case _empty_uncommitted:
387 st->print("|EU ");
388 break;
389 case _empty_committed:
390 st->print("|EC ");
|
350 size_t live_data = (size_t)OrderAccess::load_acquire(&_live_data);
351 return (live_data == 0) ? 0 : (used() >> LogHeapWordSize);
352 } else {
353 const ShenandoahHeapRegion* start = humongous_start_region();
354 return start->get_live_data_words() == 0 ? 0 : (used() >> LogHeapWordSize);
355 }
356 } else {
357 return (size_t)OrderAccess::load_acquire(&_live_data);
358 }
359 }
360
361 size_t ShenandoahHeapRegion::get_live_data_bytes() const {
362 return get_live_data_words() * HeapWordSize;
363 }
364
365 bool ShenandoahHeapRegion::has_live() const {
366 return get_live_data_words() != 0;
367 }
368
369 size_t ShenandoahHeapRegion::garbage() const {
370 assert(used() >= get_live_data_bytes(), "Live Data must be a subset of used() live: "SIZE_FORMAT" used: "SIZE_FORMAT,
371 get_live_data_bytes(), used());
372
373 size_t result = used() - get_live_data_bytes();
374 return result;
375 }
376
377 bool ShenandoahHeapRegion::in_collection_set() const {
378 return _heap->region_in_collection_set(_region_number);
379 }
380
381 void ShenandoahHeapRegion::print_on(outputStream* st) const {
382 st->print("|" PTR_FORMAT, p2i(this));
383 st->print("|" SIZE_FORMAT_W(5), this->_region_number);
384
385 switch (_state) {
386 case _empty_uncommitted:
387 st->print("|EU ");
388 break;
389 case _empty_committed:
390 st->print("|EC ");
|