diff options
| author | 2018-02-09 17:47:57 +0000 | |
|---|---|---|
| committer | 2018-02-09 17:50:28 +0000 | |
| commit | f320dc1633c06b15cf39a3304df7cae1be55e443 (patch) | |
| tree | bbb6c3c1bc83c6f002907605ef4c8cc822fca994 | |
| parent | 2ae376f5af8953d3524cd8ed915ebdacf505625c (diff) | |
Pretty print RegionSpace::RegionType and RegionSpace::RegionState values.
Use the operator<< generated by generate-operator-out.py to
print values of enums RegionSpace::RegionType and
RegionSpace::RegionState enum instead of their numerical values.
Test: art/test.py
Change-Id: Icad6d9520291b5f71153eb17f9f1c9644fc1123f
| -rw-r--r-- | runtime/gc/space/region_space-inl.h | 16 | ||||
| -rw-r--r-- | runtime/gc/space/region_space.cc | 4 | ||||
| -rw-r--r-- | runtime/gc/space/region_space.h | 15 |
3 files changed, 18 insertions, 17 deletions
diff --git a/runtime/gc/space/region_space-inl.h b/runtime/gc/space/region_space-inl.h index b4c8092ce1..305f0bca0a 100644 --- a/runtime/gc/space/region_space-inl.h +++ b/runtime/gc/space/region_space-inl.h @@ -349,7 +349,7 @@ inline size_t RegionSpace::Region::BytesAllocated() const { DCHECK_EQ(begin_, Top()); return 0; } else { - DCHECK(IsAllocated()) << static_cast<uint>(state_); + DCHECK(IsAllocated()) << "state=" << state_; DCHECK_LE(begin_, Top()); size_t bytes; if (is_a_tlab_) { @@ -362,6 +362,20 @@ inline size_t RegionSpace::Region::BytesAllocated() const { } } +inline size_t RegionSpace::Region::ObjectsAllocated() const { + if (IsLarge()) { + DCHECK_LT(begin_ + kRegionSize, Top()); + DCHECK_EQ(objects_allocated_.LoadRelaxed(), 0U); + return 1; + } else if (IsLargeTail()) { + DCHECK_EQ(begin_, Top()); + DCHECK_EQ(objects_allocated_.LoadRelaxed(), 0U); + return 0; + } else { + DCHECK(IsAllocated()) << "state=" << state_; + return objects_allocated_; + } +} } // namespace space } // namespace gc diff --git a/runtime/gc/space/region_space.cc b/runtime/gc/space/region_space.cc index ce7576171a..8f9f1a91b0 100644 --- a/runtime/gc/space/region_space.cc +++ b/runtime/gc/space/region_space.cc @@ -537,8 +537,8 @@ void RegionSpace::Region::Dump(std::ostream& os) const { << reinterpret_cast<void*>(begin_) << "-" << reinterpret_cast<void*>(Top()) << "-" << reinterpret_cast<void*>(end_) - << " state=" << static_cast<uint>(state_) - << " type=" << static_cast<uint>(type_) + << " state=" << state_ + << " type=" << type_ << " objects_allocated=" << objects_allocated_ << " alloc_time=" << alloc_time_ << " live_bytes=" << live_bytes_ diff --git a/runtime/gc/space/region_space.h b/runtime/gc/space/region_space.h index 5ca364eb9d..d026ffd803 100644 --- a/runtime/gc/space/region_space.h +++ b/runtime/gc/space/region_space.h @@ -431,20 +431,7 @@ class RegionSpace FINAL : public ContinuousMemMapAllocSpace { size_t BytesAllocated() const; - size_t ObjectsAllocated() const { - if (IsLarge()) { - DCHECK_LT(begin_ + kRegionSize, Top()); - DCHECK_EQ(objects_allocated_.LoadRelaxed(), 0U); - return 1; - } else if (IsLargeTail()) { - DCHECK_EQ(begin_, Top()); - DCHECK_EQ(objects_allocated_.LoadRelaxed(), 0U); - return 0; - } else { - DCHECK(IsAllocated()) << static_cast<uint>(state_); - return objects_allocated_; - } - } + size_t ObjectsAllocated() const; uint8_t* Begin() const { return begin_; |