Revert^2 "Support using opaque JNI ids"
We weren't handing the fact that encoding jmethodIDs could cause OOM
exceptions in some places in reflection.cc. This could lead to
attempting to use a null jmethodID as if it were a real id. This issue
is fixed by the parent CL.
This reverts commit b476a29a2c.
This reverts commit 3b2905366c.
This Unreverts commit d5d645ffec.
This Unreverts commit 21d5994583.
Reason for revert: Fixed issue causing 004 debuggable flakes
Test: ./test.py --host --jit --debuggable
Bug: 134162467
Change-Id: Iece08ab299cd8a20f8382be7be6c3796858e70eb
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index 09d5532..144350f 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -1229,6 +1229,23 @@
void FixupNativePointers(Class* dest, PointerSize pointer_size, const Visitor& visitor)
REQUIRES_SHARED(Locks::mutator_lock_);
+ // Get or create the various jni id arrays in a lock-less thread safe manner.
+ ObjPtr<PointerArray> GetOrCreateMethodIds() REQUIRES_SHARED(Locks::mutator_lock_);
+ ObjPtr<PointerArray> GetMethodIds() REQUIRES_SHARED(Locks::mutator_lock_);
+ ObjPtr<PointerArray> GetOrCreateStaticFieldIds() REQUIRES_SHARED(Locks::mutator_lock_);
+ ObjPtr<PointerArray> GetStaticFieldIds() REQUIRES_SHARED(Locks::mutator_lock_);
+ ObjPtr<PointerArray> GetOrCreateInstanceFieldIds() REQUIRES_SHARED(Locks::mutator_lock_);
+ ObjPtr<PointerArray> GetInstanceFieldIds() REQUIRES_SHARED(Locks::mutator_lock_);
+
+ // Calculate the index in the ifields_, methods_ or sfields_ arrays a method is located at. This
+ // is to be used with the above Get{,OrCreate}...Ids functions.
+ size_t GetStaticFieldIdOffset(ArtField* field)
+ REQUIRES_SHARED(Locks::mutator_lock_);
+ size_t GetInstanceFieldIdOffset(ArtField* field)
+ REQUIRES_SHARED(Locks::mutator_lock_);
+ size_t GetMethodIdOffset(ArtMethod* method, PointerSize pointer_size)
+ REQUIRES_SHARED(Locks::mutator_lock_);
+
private:
template <typename T, VerifyObjectFlags kVerifyFlags, typename Visitor>
void FixupNativePointer(