diff options
author | Vladimir Marko <vmarko@google.com> | 2021-03-05 16:16:04 +0000 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2021-03-08 09:22:05 +0000 |
commit | 765a167cb152931dede6aad1fa398700d4702113 (patch) | |
tree | 02177f7edf91468797b56c2cde4ecd65825ebf9f /libdexfile | |
parent | 68e8a7c0a96d941bf08956dd0d8d83c282d0af9f (diff) |
Faster DexFileVerifier::CheckInterClassDefItem().
Use cached data instead of calling DexFile::FindClassDef().
This was a missed opportnity in
https://android-review.googlesource.com/1291003
where we recorded the data during the "intra" phase.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 153966283
Bug: 181943478
Change-Id: Ibe8b18811bcd2914c61013816404ed237b7e7fb0
Diffstat (limited to 'libdexfile')
-rw-r--r-- | libdexfile/dex/dex_file_verifier.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/libdexfile/dex/dex_file_verifier.cc b/libdexfile/dex/dex_file_verifier.cc index 72f28bc695..f72528f551 100644 --- a/libdexfile/dex/dex_file_verifier.cc +++ b/libdexfile/dex/dex_file_verifier.cc @@ -2758,16 +2758,16 @@ bool DexFileVerifier::CheckInterClassDefItem() { // Check that a class is defined after its super class (if the // latter is defined in the same Dex file). - const dex::ClassDef* superclass_def = dex_file_->FindClassDef(item->superclass_idx_); - if (superclass_def != nullptr) { + uint16_t superclass_idx = item->superclass_idx_.index_; + if (defined_classes_[superclass_idx]) { // The superclass is defined in this Dex file. - if (superclass_def > item) { + if (&dex_file_->GetClassDef(defined_class_indexes_[superclass_idx]) > item) { // ClassDef item for super class appearing after the class' ClassDef item. ErrorStringPrintf("Invalid class definition ordering:" " class with type idx: '%d' defined before" " superclass with type idx: '%d'", item->class_idx_.index_, - item->superclass_idx_.index_); + superclass_idx); return false; } } @@ -2796,17 +2796,16 @@ bool DexFileVerifier::CheckInterClassDefItem() { // Check that a class is defined after the interfaces it implements // (if they are defined in the same Dex file). - const dex::ClassDef* interface_def = - dex_file_->FindClassDef(interfaces->GetTypeItem(i).type_idx_); - if (interface_def != nullptr) { + uint16_t interface_idx = interfaces->GetTypeItem(i).type_idx_.index_; + if (defined_classes_[interface_idx]) { // The interface is defined in this Dex file. - if (interface_def > item) { + if (&dex_file_->GetClassDef(defined_class_indexes_[interface_idx]) > item) { // ClassDef item for interface appearing after the class' ClassDef item. ErrorStringPrintf("Invalid class definition ordering:" " class with type idx: '%d' defined before" " implemented interface with type idx: '%d'", item->class_idx_.index_, - interfaces->GetTypeItem(i).type_idx_.index_); + interface_idx); return false; } } |