From e17cf243978ca7f5356e746ee460f0fcf04e04a6 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 19 Jun 2017 11:05:51 -0700 Subject: Add field/method skipping helper functions to DexFile Specifically added SkipStaticFields, SkipInstanceFields, SkipAllFields, SkipStaticMethods, and SkipVirtualMethods. Also applied the helpers to the code base. Test: test-art-host Change-Id: Idda77f9a6e2564c2e588d2bbe11cc320063fdb32 --- compiler/driver/compiler_driver.cc | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'compiler/driver/compiler_driver.cc') diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index ea53ef0670..622448fc59 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -808,13 +808,7 @@ static void ResolveConstStrings(CompilerDriver* driver, } ClassDataItemIterator it(*dex_file, class_data); - // Skip fields - while (it.HasNextStaticField()) { - it.Next(); - } - while (it.HasNextInstanceField()) { - it.Next(); - } + it.SkipAllFields(); bool compilation_enabled = driver->IsClassToCompile( dex_file->StringByTypeIdx(class_def.class_idx_)); @@ -1661,9 +1655,7 @@ bool CompilerDriver::RequiresConstructorBarrier(const DexFile& dex_file, return false; } ClassDataItemIterator it(dex_file, class_data); - while (it.HasNextStaticField()) { - it.Next(); - } + it.SkipStaticFields(); // We require a constructor barrier if there are final instance fields. while (it.HasNextInstanceField()) { if (it.MemberIsFinal()) { @@ -1873,13 +1865,7 @@ static void PopulateVerifiedMethods(const DexFile& dex_file, return; } ClassDataItemIterator it(dex_file, class_data); - // Skip fields - while (it.HasNextStaticField()) { - it.Next(); - } - while (it.HasNextInstanceField()) { - it.Next(); - } + it.SkipAllFields(); while (it.HasNextDirectMethod()) { verification_results->CreateVerifiedMethodFor(MethodReference(&dex_file, it.GetMemberIndex())); @@ -2778,13 +2764,7 @@ class CompileClassVisitor : public CompilationVisitor { GetDexToDexCompilationLevel(soa.Self(), *driver, jclass_loader, dex_file, class_def); ClassDataItemIterator it(dex_file, class_data); - // Skip fields - while (it.HasNextStaticField()) { - it.Next(); - } - while (it.HasNextInstanceField()) { - it.Next(); - } + it.SkipAllFields(); bool compilation_enabled = driver->IsClassToCompile( dex_file.StringByTypeIdx(class_def.class_idx_)); -- cgit v1.2.3-59-g8ed1b