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
diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc
index 481a70f..072c6fa 100644
--- a/compiler/dex/quick/codegen_util.cc
+++ b/compiler/dex/quick/codegen_util.cc
@@ -992,6 +992,7 @@
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 @@
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);