diff options
| author | Chao-ying Fu <chao-ying.fu@intel.com> | 2014-05-22 17:25:02 -0700 |
|---|---|---|
| committer | buzbee <buzbee@google.com> | 2014-05-22 19:54:04 -0700 |
| commit | 54d36b6bf280c22ae69280feffa9d65d6417b153 (patch) | |
| tree | 0eab7675a11b35c73d5e22e8a28b5689c3a2dd61 /compiler | |
| parent | dfd301f19800a4f168283cf2d0b15b2c09071955 (diff) | |
| download | android_art-54d36b6bf280c22ae69280feffa9d65d6417b153.tar.gz android_art-54d36b6bf280c22ae69280feffa9d65d6417b153.tar.bz2 android_art-54d36b6bf280c22ae69280feffa9d65d6417b153.zip | |
Create two CompilerTemp for a wide compiler temp
We create a new CompilerTemp for the high part of
a wide compiler temp to fix counting compiler temps.
Otherwise, assertion failures may happen inside
GetNumUsedCompilerTemps(), if there are any wide compiler temps.
Previously, we never ask for a wide compiler temp, such that
we don't hit the issue.
Change-Id: I9e79ad15e4192665b9d8a9dae5a5453496e48a79
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/dex/mir_optimization.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc index 749a2356eb..1d4aef2183 100644 --- a/compiler/dex/mir_optimization.cc +++ b/compiler/dex/mir_optimization.cc @@ -268,13 +268,22 @@ CompilerTemp* MIRGraph::GetNewCompilerTemp(CompilerTempType ct_type, bool wide) DCHECK_EQ(ct_type, kCompilerTempVR); // The new non-special compiler temp must receive a unique v_reg with a negative value. - compiler_temp->v_reg = static_cast<int>(kVRegNonSpecialTempBaseReg) - num_non_special_compiler_temps_; + compiler_temp->v_reg = static_cast<int>(kVRegNonSpecialTempBaseReg) - + num_non_special_compiler_temps_; compiler_temp->s_reg_low = AddNewSReg(compiler_temp->v_reg); num_non_special_compiler_temps_++; if (wide) { - // Ensure that the two registers are consecutive. Since the virtual registers used for temps grow in a - // negative fashion, we need the smaller to refer to the low part. Thus, we redefine the v_reg and s_reg_low. + // Create a new CompilerTemp for the high part. + CompilerTemp *compiler_temp_high = + static_cast<CompilerTemp *>(arena_->Alloc(sizeof(CompilerTemp), kArenaAllocRegAlloc)); + compiler_temp_high->v_reg = compiler_temp->v_reg; + compiler_temp_high->s_reg_low = compiler_temp->s_reg_low; + compiler_temps_.Insert(compiler_temp_high); + + // Ensure that the two registers are consecutive. Since the virtual registers used for temps + // grow in a negative fashion, we need the smaller to refer to the low part. Thus, we + // redefine the v_reg and s_reg_low. compiler_temp->v_reg--; int ssa_reg_high = compiler_temp->s_reg_low; compiler_temp->s_reg_low = AddNewSReg(compiler_temp->v_reg); |
