diff options
| author | Wei Wang <wangw@codeaurora.org> | 2014-09-04 14:10:24 -0700 |
|---|---|---|
| committer | Linux Build Service Account <lnxbuild@localhost> | 2014-11-04 08:24:00 -0700 |
| commit | 07b8211edc3ff3e71e268ef220217603216ae5b9 (patch) | |
| tree | dae2c9fc18f19e9616c360b555344035c48e646f | |
| parent | f8e82d44fc2ad23d2b7d672ea561698fb3075050 (diff) | |
| download | art-07b8211edc3ff3e71e268ef220217603216ae5b9.tar.gz art-07b8211edc3ff3e71e268ef220217603216ae5b9.tar.bz2 art-07b8211edc3ff3e71e268ef220217603216ae5b9.zip | |
ART: minor bugfix
1. reset reference counters during initialization
2. check element existence when removing from GrowableArray
Change-Id: I3a48da94346ecd407febb91ffe61a0ca7da9e8f2
| -rw-r--r-- | compiler/dex/mir_graph.cc | 3 | ||||
| -rw-r--r-- | compiler/utils/growable_array.h | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/compiler/dex/mir_graph.cc b/compiler/dex/mir_graph.cc index 885d413929..584cef60d3 100644 --- a/compiler/dex/mir_graph.cc +++ b/compiler/dex/mir_graph.cc @@ -1510,6 +1510,9 @@ void MIRGraph::InitializeMethodUses() { int num_ssa_regs = GetNumSSARegs(); use_counts_.Resize(num_ssa_regs + 32); raw_use_counts_.Resize(num_ssa_regs + 32); + // reset both lists to restart fresh + use_counts_.Reset(); + raw_use_counts_.Reset(); // Initialize list. for (int i = 0; i < num_ssa_regs; i++) { use_counts_.Insert(0); diff --git a/compiler/utils/growable_array.h b/compiler/utils/growable_array.h index d1669a7329..e93ee86605 100644 --- a/compiler/utils/growable_array.h +++ b/compiler/utils/growable_array.h @@ -166,6 +166,10 @@ class GrowableArray { } // We should either have found the element, or it was the last (unscanned) element. DCHECK(found || (element == elem_list_[num_used_ - 1])); + // if element is not in array, don't touch anything + if(!found && element != elem_list_[num_used_ - 1]) + return; + num_used_--; }; void DeleteAt(size_t index) { |
