summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Wang <wangw@codeaurora.org>2014-09-04 14:10:24 -0700
committerLinux Build Service Account <lnxbuild@localhost>2014-11-04 08:24:00 -0700
commit07b8211edc3ff3e71e268ef220217603216ae5b9 (patch)
treedae2c9fc18f19e9616c360b555344035c48e646f
parentf8e82d44fc2ad23d2b7d672ea561698fb3075050 (diff)
downloadart-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.cc3
-rw-r--r--compiler/utils/growable_array.h4
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) {