From ba1b94e8ebf35947e1ce127d67ab164a76ec251c Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Thu, 10 Jun 2021 09:52:53 +0100 Subject: Clean up Class::GetDirectInterface(). Fetch array interfaces from the `IfTable`. This removes the only use of the `Thread* self` argument, so we can remove that argument. We also make the function non-static to avoid the explicit `klass` argument. Similarly clean up arguments of `Class::FindClass()` and `Class::FindStaticClass()`. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 (cherry picked from commit b10668cb6a34398eb720f9a6305ff9a51b3ebfd4) Merged-In: Id639b675b4eb331a777cf318eb61bd19e05de4f0 Change-Id: I34d11499aea5a95864bf1cdcb4f210547a07f33c --- runtime/mirror/class.h | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'runtime/mirror/class.h') diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h index aff98cabe2..35ef358158 100644 --- a/runtime/mirror/class.h +++ b/runtime/mirror/class.h @@ -1092,10 +1092,7 @@ class MANAGED Class final : public Object { ArtField* GetStaticField(uint32_t i) REQUIRES_SHARED(Locks::mutator_lock_); // Find a static or instance field using the JLS resolution order - static ArtField* FindField(Thread* self, - ObjPtr klass, - ObjPtr dex_cache, - uint32_t field_idx) + ArtField* FindField(ObjPtr dex_cache, uint32_t field_idx) REQUIRES_SHARED(Locks::mutator_lock_); // Finds the given instance field in this class or a superclass. @@ -1114,18 +1111,12 @@ class MANAGED Class final : public Object { REQUIRES_SHARED(Locks::mutator_lock_); // Finds the given static field in this class or a superclass. - static ArtField* FindStaticField(Thread* self, - ObjPtr klass, - std::string_view name, - std::string_view type) + ArtField* FindStaticField(std::string_view name, std::string_view type) REQUIRES_SHARED(Locks::mutator_lock_); // Finds the given static field in this class or superclass, only searches classes that // have the same dex cache. - static ArtField* FindStaticField(Thread* self, - ObjPtr klass, - ObjPtr dex_cache, - uint32_t dex_field_idx) + ArtField* FindStaticField(ObjPtr dex_cache, uint32_t dex_field_idx) REQUIRES_SHARED(Locks::mutator_lock_); ArtField* FindDeclaredStaticField(std::string_view name, std::string_view type) @@ -1219,11 +1210,10 @@ class MANAGED Class final : public Object { dex::TypeIndex GetDirectInterfaceTypeIdx(uint32_t idx) REQUIRES_SHARED(Locks::mutator_lock_); - // Get the direct interface of the `klass` at index `idx` if resolved, otherwise return null. + // Get the direct interface at index `idx` if resolved, otherwise return null. // If the caller expects the interface to be resolved, for example for a resolved `klass`, // that assumption should be checked by `DCHECK(result != nullptr)`. - static ObjPtr GetDirectInterface(Thread* self, ObjPtr klass, uint32_t idx) - REQUIRES_SHARED(Locks::mutator_lock_); + ObjPtr GetDirectInterface(uint32_t idx) REQUIRES_SHARED(Locks::mutator_lock_); // Resolve and get the direct interface of the `klass` at index `idx`. // Returns null with a pending exception if the resolution fails. -- cgit v1.2.3-59-g8ed1b