Fix Arena allocation tracking.
Add missing allocation kind name and try to avoid
bit-rot in future by explicitly instantiating
ArenaAllocatorStatsImpl<true> in debug builds.
Bug: 34083438
Test: Rely on TreeHugger.
Change-Id: Ibe78a9f15d04b2ca2f03143fb4f49c01ae18471e
diff --git a/runtime/base/arena_allocator.cc b/runtime/base/arena_allocator.cc
index e763e43..935fd81 100644
--- a/runtime/base/arena_allocator.cc
+++ b/runtime/base/arena_allocator.cc
@@ -78,6 +78,7 @@
"RegAllocator ",
"RegAllocVldt ",
"StackMapStm ",
+ "VectorNode ",
"CodeGen ",
"Assembler ",
"ParallelMove ",
@@ -150,8 +151,15 @@
#if __clang_major__ >= 4
#pragma GCC diagnostic ignored "-Winstantiation-after-specialization"
#endif
-// Explicitly instantiate the used implementation.
-template class ArenaAllocatorStatsImpl<kArenaAllocatorCountAllocations>;
+// We're going to use ArenaAllocatorStatsImpl<kArenaAllocatorCountAllocations> which needs
+// to be explicitly instantiated if kArenaAllocatorCountAllocations is true. Explicit
+// instantiation of the specialization ArenaAllocatorStatsImpl<false> does not do anything
+// but requires the warning "-Winstantiation-after-specialization" to be turned off.
+//
+// To avoid bit-rot of the ArenaAllocatorStatsImpl<true>, 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<kArenaAllocatorCountAllocations || kIsDebugBuild>;
#pragma GCC diagnostic pop
void ArenaAllocatorMemoryTool::DoMakeDefined(void* ptr, size_t size) {