summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2014-03-07 19:41:05 +0000
committer Vladimir Marko <vmarko@google.com> 2014-03-07 19:48:39 +0000
commitbd9e9db27b6a38839f1d55fc4ff365e41ea20243 (patch)
treed647043dc66745d7492758b9e0fc8d660da54c83
parentb166d8407622e842eb0dc9302ede01cdea182149 (diff)
Fix clang errors in ArenaAllocator.
Change-Id: Ib0fa290fd46ff9288f86cda9be2d1c1faf99b964
-rw-r--r--compiler/utils/arena_allocator.cc7
-rw-r--r--compiler/utils/arena_allocator.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/compiler/utils/arena_allocator.cc b/compiler/utils/arena_allocator.cc
index 365b094e95..ca4635d352 100644
--- a/compiler/utils/arena_allocator.cc
+++ b/compiler/utils/arena_allocator.cc
@@ -31,7 +31,8 @@ static constexpr bool kUseMemSet = true && kUseMemMap;
static constexpr size_t kValgrindRedZoneBytes = 8;
constexpr size_t Arena::kDefaultSize;
-static const char* alloc_names[kNumArenaAllocKinds] = {
+template <bool kCount>
+const char* ArenaAllocatorStatsImpl<kCount>::kAllocNames[kNumArenaAllocKinds] = {
"Misc ",
"BasicBlock ",
"LIR ",
@@ -94,14 +95,14 @@ void ArenaAllocatorStatsImpl<kCount>::Dump(std::ostream& os, const Arena* first,
const size_t bytes_allocated = BytesAllocated();
os << " MEM: used: " << bytes_allocated << ", allocated: " << malloc_bytes
<< ", lost: " << lost_bytes << "\n";
- size_t num_allocations = ArenaAllocatorStats::NumAllocations();
+ size_t num_allocations = NumAllocations();
if (num_allocations != 0) {
os << "Number of arenas allocated: " << num_arenas << ", Number of allocations: "
<< num_allocations << ", avg size: " << bytes_allocated / num_allocations << "\n";
}
os << "===== Allocation by kind\n";
for (int i = 0; i < kNumArenaAllocKinds; i++) {
- os << alloc_names[i] << std::setw(10) << alloc_stats_[i] << "\n";
+ os << kAllocNames[i] << std::setw(10) << alloc_stats_[i] << "\n";
}
}
diff --git a/compiler/utils/arena_allocator.h b/compiler/utils/arena_allocator.h
index a6b74f77f5..18a5bce77d 100644
--- a/compiler/utils/arena_allocator.h
+++ b/compiler/utils/arena_allocator.h
@@ -90,6 +90,8 @@ class ArenaAllocatorStatsImpl {
size_t num_allocations_;
// TODO: Use std::array<size_t, kNumArenaAllocKinds> from C++11 when we upgrade the STL.
size_t alloc_stats_[kNumArenaAllocKinds]; // Bytes used by various allocation kinds.
+
+ static const char* kAllocNames[kNumArenaAllocKinds];
};
typedef ArenaAllocatorStatsImpl<kArenaAllocatorCountAllocations> ArenaAllocatorStats;