Add ClassDataItemIterator::HasNextMethod
Returns true if there are either static of virtual methods remaining,
changed most places to use this where possible.
Slight behavioral change for duplicate method checking, we not
persist the method index across the static method / virtual method
boundary.
Motivation: Generic cleanup to remove copy paste.
Test: test-art-host
Change-Id: I7a1b507e681b2c40452f8a9913b53a96b181e171
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index b20fa90..108fa95 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -274,7 +274,7 @@
ClassDataItemIterator it(dex_file, class_data);
uint32_t class_method_idx = 0;
it.SkipAllFields();
- for (; it.HasNextDirectMethod() || it.HasNextVirtualMethod(); it.Next()) {
+ for (; it.HasNextMethod(); it.Next()) {
WalkOatMethod(oat_class.GetOatMethod(class_method_idx++),
dex_file,
class_def_index,
@@ -893,11 +893,7 @@
ClassDataItemIterator it(*dex_file, class_data);
it.SkipAllFields();
uint32_t class_method_index = 0;
- while (it.HasNextDirectMethod()) {
- AddOffsets(oat_class.GetOatMethod(class_method_index++));
- it.Next();
- }
- while (it.HasNextVirtualMethod()) {
+ while (it.HasNextMethod()) {
AddOffsets(oat_class.GetOatMethod(class_method_index++));
it.Next();
}
@@ -979,11 +975,7 @@
}
ClassDataItemIterator it(dex_file, class_data);
it.SkipAllFields();
- while (it.HasNextDirectMethod()) {
- WalkCodeItem(dex_file, it.GetMethodCodeItem());
- it.Next();
- }
- while (it.HasNextVirtualMethod()) {
+ while (it.HasNextMethod()) {
WalkCodeItem(dex_file, it.GetMethodCodeItem());
it.Next();
}
@@ -1227,20 +1219,7 @@
ClassDataItemIterator it(dex_file, class_data);
it.SkipAllFields();
uint32_t class_method_index = 0;
- while (it.HasNextDirectMethod()) {
- if (!DumpOatMethod(vios, class_def, class_method_index, oat_class, dex_file,
- it.GetMemberIndex(), it.GetMethodCodeItem(),
- it.GetRawMemberAccessFlags(), &addr_found)) {
- success = false;
- }
- if (addr_found) {
- *stop_analysis = true;
- return success;
- }
- class_method_index++;
- it.Next();
- }
- while (it.HasNextVirtualMethod()) {
+ while (it.HasNextMethod()) {
if (!DumpOatMethod(vios, class_def, class_method_index, oat_class, dex_file,
it.GetMemberIndex(), it.GetMethodCodeItem(),
it.GetRawMemberAccessFlags(), &addr_found)) {