From d38ba0a3abd7f6140f0851d826449afec5689d57 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Thu, 13 Apr 2017 13:43:43 +0100 Subject: [PATCH] Fix Arena allocation tracking. Add missing allocation kind name and try to avoid bit-rot in future by explicitly instantiating ArenaAllocatorStatsImpl in debug builds. Bug: 34083438 Test: Rely on TreeHugger. Change-Id: Ibe78a9f15d04b2ca2f03143fb4f49c01ae18471e --- runtime/base/arena_allocator.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/runtime/base/arena_allocator.cc b/runtime/base/arena_allocator.cc index e763e439b..935fd8111 100644 --- a/runtime/base/arena_allocator.cc +++ b/runtime/base/arena_allocator.cc @@ -78,6 +78,7 @@ const char* const ArenaAllocatorStatsImpl::kAllocNames[] = { "RegAllocator ", "RegAllocVldt ", "StackMapStm ", + "VectorNode ", "CodeGen ", "Assembler ", "ParallelMove ", @@ -150,8 +151,15 @@ void ArenaAllocatorStatsImpl::Dump(std::ostream& os, const Arena* first, #if __clang_major__ >= 4 #pragma GCC diagnostic ignored "-Winstantiation-after-specialization" #endif -// Explicitly instantiate the used implementation. -template class ArenaAllocatorStatsImpl; +// We're going to use ArenaAllocatorStatsImpl which needs +// to be explicitly instantiated if kArenaAllocatorCountAllocations is true. Explicit +// instantiation of the specialization ArenaAllocatorStatsImpl does not do anything +// but requires the warning "-Winstantiation-after-specialization" to be turned off. +// +// To avoid bit-rot of the ArenaAllocatorStatsImpl, instantiate it also in debug builds +// (but keep the unnecessary code out of release builds) as we do not usually compile with +// kArenaAllocatorCountAllocations set to true. +template class ArenaAllocatorStatsImpl; #pragma GCC diagnostic pop void ArenaAllocatorMemoryTool::DoMakeDefined(void* ptr, size_t size) { -- 2.11.0