From ca6fff898afcb62491458ae8bcd428bfb3043da1 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 3 Oct 2017 14:49:14 +0100 Subject: ART: Use ScopedArenaAllocator for pass-local data. Passes using local ArenaAllocator were hiding their memory usage from the allocation counting, making it difficult to track down where memory was used. Using ScopedArenaAllocator reveals the memory usage. This changes the HGraph constructor which requires a lot of changes in tests. Refactor these tests to limit the amount of work needed the next time we change that constructor. Test: m test-art-host-gtest Test: testrunner.py --host Test: Build with kArenaAllocatorCountAllocations = true. Bug: 64312607 Change-Id: I34939e4086b500d6e827ff3ef2211d1a421ac91a --- compiler/utils/assembler.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'compiler/utils/assembler.h') diff --git a/compiler/utils/assembler.h b/compiler/utils/assembler.h index 314ff8cf7a..dbd35abfcf 100644 --- a/compiler/utils/assembler.h +++ b/compiler/utils/assembler.h @@ -89,11 +89,11 @@ class SlowPath : public DeletableArenaObject { class AssemblerBuffer { public: - explicit AssemblerBuffer(ArenaAllocator* arena); + explicit AssemblerBuffer(ArenaAllocator* allocator); ~AssemblerBuffer(); - ArenaAllocator* GetArena() { - return arena_; + ArenaAllocator* GetAllocator() { + return allocator_; } // Basic support for emitting, loading, and storing. @@ -252,7 +252,7 @@ class AssemblerBuffer { // for a single, fast space check per instruction. static const int kMinimumGap = 32; - ArenaAllocator* arena_; + ArenaAllocator* allocator_; uint8_t* contents_; uint8_t* cursor_; uint8_t* limit_; @@ -392,8 +392,8 @@ class Assembler : public DeletableArenaObject { */ DebugFrameOpCodeWriterForAssembler& cfi() { return cfi_; } - ArenaAllocator* GetArena() { - return buffer_.GetArena(); + ArenaAllocator* GetAllocator() { + return buffer_.GetAllocator(); } AssemblerBuffer* GetBuffer() { @@ -401,7 +401,7 @@ class Assembler : public DeletableArenaObject { } protected: - explicit Assembler(ArenaAllocator* arena) : buffer_(arena), cfi_(this) {} + explicit Assembler(ArenaAllocator* allocator) : buffer_(allocator), cfi_(this) {} AssemblerBuffer buffer_; -- cgit v1.2.3-59-g8ed1b