summaryrefslogtreecommitdiff
path: root/compiler/dex/quick/codegen_util.cc
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2014-02-03 14:40:27 -0800
committer buzbee <buzbee@google.com> 2014-02-03 15:43:27 -0800
commitd69835d841cb7663faaa2f1996e73e8c0b3f6d76 (patch)
tree84798daf417cca189c9ebd8a04ae0e6ceb4dee8b /compiler/dex/quick/codegen_util.cc
parent1f00671edaaa34578319d0fdaf605600ed539d41 (diff)
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
Diffstat (limited to 'compiler/dex/quick/codegen_util.cc')
-rw-r--r--compiler/dex/quick/codegen_util.cc4
1 files changed, 1 insertions, 3 deletions
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<PromotionMap*>
- (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);