diff options
author | 2024-04-08 09:16:01 +0000 | |
---|---|---|
committer | 2024-04-08 13:15:12 +0000 | |
commit | 68e9af2dd02a63d0b4f0bebabc4d76c91e2d84e0 (patch) | |
tree | e7096115d32e16b335e8baeeae86271d828e9253 /runtime/class_linker.h | |
parent | cfff041514b432f245907d0d1e0c10948759ffc9 (diff) |
ART Faster `LinkCode()` in `ClassLinker`.
Make `LinkCode()` a member of `ClassLinker` and speed it up
by avoiding a linear (but fast) method code lookup using the
`BitVector::NumSetBits()`, avoiding related function call
overhead as well as pulling some invariant checks out of the
calling loops and eliminating redundant checks.
For a test class with 1000 unannotated static methods and
400 @NeverCompile static methods, this change reduces the
time needed by `ClassLinker::LoadClass()` by roughly 25%.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 329196666
Change-Id: Ifeae520113594acae2e5c19ba746f11ede2dfac2
Diffstat (limited to 'runtime/class_linker.h')
-rw-r--r-- | runtime/class_linker.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/class_linker.h b/runtime/class_linker.h index edb866adc7..4b886e9f04 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -925,6 +925,7 @@ class EXPORT ClassLinker { template <PointerSize kPointerSize> class LinkMethodsHelper; class MethodAnnotationsIterator; + class OatClassCodeIterator; class VisiblyInitializedCallback; struct ClassLoaderData { @@ -1048,6 +1049,10 @@ class EXPORT ClassLinker { /*out*/ ArtMethod* dst) REQUIRES_SHARED(Locks::mutator_lock_); + void LinkCode(ArtMethod* method, + uint32_t class_def_method_index, + /*inout*/ OatClassCodeIterator* occi) REQUIRES_SHARED(Locks::mutator_lock_); + void FixupStaticTrampolines(Thread* self, ObjPtr<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_); |