From 9152fed693f5d823ef29c373d658adc67fa92fe7 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Wed, 20 Apr 2016 14:39:47 +0100 Subject: Thumb2: Fix EmitJumpTables() to extend buffer only if needed. Bug: 28256882 Change-Id: I15227535c0fcb73c04b0b05160852c4b1bebee49 --- compiler/utils/assembler.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler/utils/assembler.cc') diff --git a/compiler/utils/assembler.cc b/compiler/utils/assembler.cc index c2aa574f76..e6c3a18d04 100644 --- a/compiler/utils/assembler.cc +++ b/compiler/utils/assembler.cc @@ -47,7 +47,7 @@ namespace art { AssemblerBuffer::AssemblerBuffer(ArenaAllocator* arena) : arena_(arena) { static const size_t kInitialBufferCapacity = 4 * KB; - contents_ = arena_->AllocArray(kInitialBufferCapacity); + contents_ = arena_->AllocArray(kInitialBufferCapacity, kArenaAllocAssembler); cursor_ = contents_; limit_ = ComputeLimit(contents_, kInitialBufferCapacity); fixup_ = nullptr; @@ -94,6 +94,7 @@ void AssemblerBuffer::FinalizeInstructions(const MemoryRegion& instructions) { void AssemblerBuffer::ExtendCapacity(size_t min_capacity) { size_t old_size = Size(); size_t old_capacity = Capacity(); + DCHECK_GT(min_capacity, old_capacity); size_t new_capacity = std::min(old_capacity * 2, old_capacity + 1 * MB); new_capacity = std::max(new_capacity, min_capacity); -- cgit v1.2.3-59-g8ed1b