Better handle of 0 edge case in duplicate method skipping
Change-Id: Ic701096167e57d8e639a16e4dee8eea2cbb3e0a8
diff --git a/src/compiler.cc b/src/compiler.cc
index cf37d6f..132bf25 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -1414,7 +1414,7 @@
it.Next();
}
// Compile direct methods
- uint32_t previous_direct_method_idx = 0;
+ int64_t previous_direct_method_idx = -1;
while (it.HasNextDirectMethod()) {
uint32_t method_idx = it.GetMemberIndex();
if (method_idx == previous_direct_method_idx) {
@@ -1429,7 +1429,7 @@
it.Next();
}
// Compile virtual methods
- uint32_t previous_virtual_method_idx = 0;
+ int64_t previous_virtual_method_idx = -1;
while (it.HasNextVirtualMethod()) {
uint32_t method_idx = it.GetMemberIndex();
if (method_idx == previous_virtual_method_idx) {
diff --git a/src/dex_file.cc b/src/dex_file.cc
index eb48ded..78f0fdc 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -824,7 +824,7 @@
void ClassDataItemIterator::ReadClassDataField() {
field_.field_idx_delta_ = DecodeUnsignedLeb128(&ptr_pos_);
field_.access_flags_ = DecodeUnsignedLeb128(&ptr_pos_);
- if (field_.field_idx_delta_ == 0) {
+ if (last_idx_ != 0 && field_.field_idx_delta_ == 0) {
LOG(WARNING) << "Duplicate field " << PrettyField(GetMemberIndex(), dex_file_)
<< " in " << dex_file_.GetLocation();
}
@@ -834,7 +834,7 @@
method_.method_idx_delta_ = DecodeUnsignedLeb128(&ptr_pos_);
method_.access_flags_ = DecodeUnsignedLeb128(&ptr_pos_);
method_.code_off_ = DecodeUnsignedLeb128(&ptr_pos_);
- if (method_.method_idx_delta_ == 0) {
+ if (last_idx_ != 0 && method_.method_idx_delta_ == 0) {
LOG(WARNING) << "Duplicate method " << PrettyMethod(GetMemberIndex(), dex_file_)
<< " in " << dex_file_.GetLocation();
}