summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Brian Carlstrom <bdc@google.com> 2012-05-11 17:18:08 -0700
committer Brian Carlstrom <bdc@google.com> 2012-05-11 17:18:08 -0700
commit68adbe41c7d9295da2bfc521d737ba6dabd36c98 (patch)
tree45f0c74e8ef2a16f8baafd3be9befcb42af1c616
parent6f29d0e6d5444ff84157c922c23c221567dcc6c5 (diff)
Better handle of 0 edge case in duplicate method skipping
Change-Id: Ic701096167e57d8e639a16e4dee8eea2cbb3e0a8
-rw-r--r--src/compiler.cc4
-rw-r--r--src/dex_file.cc4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler.cc b/src/compiler.cc
index cf37d6fc7b..132bf25f7a 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -1414,7 +1414,7 @@ void Compiler::CompileClass(Context* context, size_t class_def_index) {
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 @@ void Compiler::CompileClass(Context* context, size_t class_def_index) {
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 eb48ded9c3..78f0fdc67b 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -824,7 +824,7 @@ void ClassDataItemIterator::ReadClassDataHeader() {
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 @@ void ClassDataItemIterator::ReadClassDataMethod() {
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();
}