diff options
author | 2024-10-11 14:54:33 +0000 | |
---|---|---|
committer | 2024-10-25 06:58:24 +0000 | |
commit | 38e9b0c97323368a5b3edd1cb24ab9a5fb38e06d (patch) | |
tree | 0c2bbd6aab7bc4f6974e317add6a185697efc596 /dex2oat | |
parent | dba42ff46c0cea4c2334d696a05bfb366ab4aac7 (diff) |
verifier: Cache types by type index.
Speed up `RegType` lookup in `RegTypeCache` by adding a
cache based on `dex::TypeIndex` for types referenced by the
current dex file. This slows down the construction of the
`RegTypeCache` but the benefits of faster lookup outweigh
the slower construction now that we're constructing the
`RegTypeCache` only once per class and not once per method.
Remove the `MethodParamListDescriptorIterator` as it was
providing only descriptors from the resolved method's dex
file and we can get the same descriptors from the current
dex file based on the invoke's `dex::ProtoIndex`. This also
allows using the new `TypeIndex`-based cache for this work.
Clean up the `RegTypeCache` interface by inlining functions
`FindClass()` and `InsertClass()` to the only remaining user
`FromClass()` and update tests to use `FromClass()` instead.
Move the descriptor retrieval from callers to `FromClass()`.
Avoid some unnecessary string copy with `AddString()` in
`RegTypeCache::FromClass()`. Add a TODO comment to avoid the
string copy in `RegTypeCache::From()`.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 181943478
Change-Id: Iea429a33983104165c2ad2cf108d2b7d88f8b9e7
Diffstat (limited to 'dex2oat')
-rw-r--r-- | dex2oat/verifier_deps_test.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/dex2oat/verifier_deps_test.cc b/dex2oat/verifier_deps_test.cc index 46e40902de..686f18803c 100644 --- a/dex2oat/verifier_deps_test.cc +++ b/dex2oat/verifier_deps_test.cc @@ -162,14 +162,14 @@ class VerifierDepsTest : public CommonCompilerDriverTest { method.GetInvokeType(class_def->access_flags_)); CHECK(resolved_method != nullptr); if (method_name == resolved_method->GetName()) { - RegTypeCache reg_types(soa.Self(), class_linker_, Runtime::Current()->GetArenaPool()); + ArenaPool* arena_pool = Runtime::Current()->GetArenaPool(); + RegTypeCache reg_types( + soa.Self(), class_linker_, arena_pool, class_loader_handle, primary_dex_file_); std::unique_ptr<MethodVerifier> verifier( MethodVerifier::CreateVerifier(soa.Self(), ®_types, callbacks_->GetVerifierDeps(), - primary_dex_file_, dex_cache_handle, - class_loader_handle, *class_def, method.GetCodeItem(), method.GetIndex(), |