From d69835d841cb7663faaa2f1996e73e8c0b3f6d76 Mon Sep 17 00:00:00 2001 From: buzbee Date: Mon, 3 Feb 2014 14:40:27 -0800 Subject: Art Compiler: fix compiler temps AOSP CL 78835 "Enable compiler temporaries" built on some earlier work to enable the compiler to add temps in the style of Dalvik's vRegs during MIR optimizations. However, it missed an existing fixed-size array whose size depended on the number of temps allocated. The allocation of this array must be delayed until after the number of compiler temps is known. The result was array overrun, and strange failures. Change-Id: I986a3b557e2323e00ba852584de03a02931b3c78 --- compiler/dex/quick/codegen_util.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'compiler/dex/quick/codegen_util.cc') diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc index 481a70f1da..072c6faa61 100644 --- a/compiler/dex/quick/codegen_util.cc +++ b/compiler/dex/quick/codegen_util.cc @@ -992,6 +992,7 @@ Mir2Lir::Mir2Lir(CompilationUnit* cu, MIRGraph* mir_graph, ArenaAllocator* arena data_offset_(0), total_size_(0), block_label_list_(NULL), + promotion_map_(NULL), current_dalvik_offset_(0), estimated_native_code_size_(0), reg_pool_(NULL), @@ -1003,9 +1004,6 @@ Mir2Lir::Mir2Lir(CompilationUnit* cu, MIRGraph* mir_graph, ArenaAllocator* arena fp_spill_mask_(0), first_lir_insn_(NULL), last_lir_insn_(NULL) { - promotion_map_ = static_cast - (arena_->Alloc((cu_->num_dalvik_registers + mir_graph_->GetNumUsedCompilerTemps()) * - sizeof(promotion_map_[0]), ArenaAllocator::kAllocRegAlloc)); // Reserve pointer id 0 for NULL. size_t null_idx = WrapPointer(NULL); DCHECK_EQ(null_idx, 0U); -- cgit v1.2.3-59-g8ed1b