diff options
-rw-r--r-- | oatdump/oatdump.cc | 2 | ||||
-rw-r--r-- | runtime/gc/space/region_space.cc | 11 | ||||
-rw-r--r-- | runtime/gc/space/region_space.h | 12 |
3 files changed, 9 insertions, 16 deletions
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index aa4635d6a4..7239a479db 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -1978,7 +1978,7 @@ class ImageDumper { size_t sum_of_expansion = 0; size_t sum_of_expansion_squared = 0; size_t n = method_outlier_size.size(); - if (n == 0) { + if (n <= 1) { return; } for (size_t i = 0; i < n; i++) { diff --git a/runtime/gc/space/region_space.cc b/runtime/gc/space/region_space.cc index 5d710bf49b..2d71294daa 100644 --- a/runtime/gc/space/region_space.cc +++ b/runtime/gc/space/region_space.cc @@ -126,15 +126,20 @@ inline bool RegionSpace::Region::ShouldBeEvacuated() { } else { bool is_live_percent_valid = live_bytes_ != static_cast<size_t>(-1); if (is_live_percent_valid) { - uint live_percent = GetLivePercent(); + DCHECK(IsInToSpace()); + DCHECK(!IsLargeTail()); + DCHECK_NE(live_bytes_, static_cast<size_t>(-1)); + DCHECK_LE(live_bytes_, BytesAllocated()); + const size_t bytes_allocated = RoundUp(BytesAllocated(), kRegionSize); + DCHECK_LE(live_bytes_, bytes_allocated); if (IsAllocated()) { // Side node: live_percent == 0 does not necessarily mean // there's no live objects due to rounding (there may be a // few). - result = live_percent < kEvaculateLivePercentThreshold; + result = live_bytes_ * 100U < kEvaculateLivePercentThreshold * bytes_allocated; } else { DCHECK(IsLarge()); - result = live_percent == 0U; + result = live_bytes_ == 0U; } } else { result = false; diff --git a/runtime/gc/space/region_space.h b/runtime/gc/space/region_space.h index 4e8dfe820d..823aa385d8 100644 --- a/runtime/gc/space/region_space.h +++ b/runtime/gc/space/region_space.h @@ -395,18 +395,6 @@ class RegionSpace FINAL : public ContinuousMemMapAllocSpace { return live_bytes_; } - uint GetLivePercent() const { - DCHECK(IsInToSpace()); - DCHECK(!IsLargeTail()); - DCHECK_NE(live_bytes_, static_cast<size_t>(-1)); - DCHECK_LE(live_bytes_, BytesAllocated()); - size_t bytes_allocated = RoundUp(BytesAllocated(), kRegionSize); - DCHECK_GE(bytes_allocated, 0U); - uint result = (live_bytes_ * 100U) / bytes_allocated; - DCHECK_LE(result, 100U); - return result; - } - size_t BytesAllocated() const { if (IsLarge()) { DCHECK_LT(begin_ + kRegionSize, top_); |