diff options
author | 2016-11-25 15:56:12 +0000 | |
---|---|---|
committer | 2016-12-05 13:12:17 +0000 | |
commit | 51c17faee9ff0b93914ae2d308cfa24f0bc71d0a (patch) | |
tree | 84db285eec16e04dd5c14ce3138521dfcfcf1e4b /compiler/driver/compiler_driver.cc | |
parent | 3d32bf0b1e9469ffcb7fd7793d56d0193e1d5d5c (diff) |
Create empty VerifiedMethod after vdex verification.
The compiler and quicken require the existence of a
VerifiedMethod for compiling a method.
This fixes the regression of not doing any compilation when
passed --input-vdex.
Test: 629-vdex-speed
Change-Id: Ie65578eadd09099df1c1a403d96c15e5da78a901
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r-- | compiler/driver/compiler_driver.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 6b62110b91..a2bab80b85 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -2005,6 +2005,35 @@ void CompilerDriver::SetVerified(jobject class_loader, } } +static void PopulateVerifiedMethods(const DexFile& dex_file, + uint32_t class_def_index, + VerificationResults* verification_results) { + const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index); + const uint8_t* class_data = dex_file.GetClassData(class_def); + if (class_data == nullptr) { + return; + } + ClassDataItemIterator it(dex_file, class_data); + // Skip fields + while (it.HasNextStaticField()) { + it.Next(); + } + while (it.HasNextInstanceField()) { + it.Next(); + } + + while (it.HasNextDirectMethod()) { + verification_results->CreateVerifiedMethodFor(MethodReference(&dex_file, it.GetMemberIndex())); + it.Next(); + } + + while (it.HasNextVirtualMethod()) { + verification_results->CreateVerifiedMethodFor(MethodReference(&dex_file, it.GetMemberIndex())); + it.Next(); + } + DCHECK(!it.HasNext()); +} + void CompilerDriver::Verify(jobject jclass_loader, const std::vector<const DexFile*>& dex_files, TimingLogger* timings) { @@ -2041,6 +2070,13 @@ void CompilerDriver::Verify(jobject jclass_loader, } else if (set.find(class_def.class_idx_) == set.end()) { ObjectLock<mirror::Class> lock(soa.Self(), cls); mirror::Class::SetStatus(cls, mirror::Class::kStatusVerified, soa.Self()); + // Create `VerifiedMethod`s for each methods, the compiler expects one for + // quickening or compiling. + // Note that this means: + // - We're only going to compile methods that did verify. + // - Quickening will not do checkcast ellision. + // TODO(ngeoffray): Reconsider this once we refactor compiler filters. + PopulateVerifiedMethods(*dex_file, i, verification_results_); } } } |