diff options
author | 2022-11-21 16:50:32 +0100 | |
---|---|---|
committer | 2022-12-08 13:28:57 +0000 | |
commit | 849d09a81907f16d8ccc6019b8baf86a304b730c (patch) | |
tree | 9f85c789e9ac154a3363bcd7a5c0230e8b5fee3d /runtime/jni/java_vm_ext.cc | |
parent | 01b7cad2a160e9d192eb7ddd5303255ab4c15278 (diff) |
Split local reference table out of `IndirectReferenceTable`.
In preparation for rewriting the representation of local JNI
references, split their implementation out of the shared
`IndirectReferenceTable` which shall be used only for global
and weak global references going forward. Make the new
`LocalReferenceTable` always resizable (remove the enum
`ResizableCapacity`) and rename the memory mappings for LRT
to "local ref table".
Remove `IndirectReferenceTable` code that was needed only
for local references, make these tables non-resizable.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 172332525
Change-Id: I87f02c93694577d1b577c4114fa86c2cd23b4c97
Diffstat (limited to 'runtime/jni/java_vm_ext.cc')
-rw-r--r-- | runtime/jni/java_vm_ext.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/runtime/jni/java_vm_ext.cc b/runtime/jni/java_vm_ext.cc index f1d4c3b305..9c695ca513 100644 --- a/runtime/jni/java_vm_ext.cc +++ b/runtime/jni/java_vm_ext.cc @@ -504,10 +504,10 @@ JavaVMExt::JavaVMExt(Runtime* runtime, const RuntimeArgumentMap& runtime_options tracing_enabled_(runtime_options.Exists(RuntimeArgumentMap::JniTrace) || VLOG_IS_ON(third_party_jni)), trace_(runtime_options.GetOrDefault(RuntimeArgumentMap::JniTrace)), - globals_(kGlobal, IndirectReferenceTable::ResizableCapacity::kNo), + globals_(kGlobal), libraries_(new Libraries), unchecked_functions_(&gJniInvokeInterface), - weak_globals_(kWeakGlobal, IndirectReferenceTable::ResizableCapacity::kNo), + weak_globals_(kWeakGlobal), allow_accessing_weak_globals_(true), weak_globals_add_condition_("weak globals add condition", (CHECK(Locks::jni_weak_globals_lock_ != nullptr), @@ -695,7 +695,7 @@ jobject JavaVMExt::AddGlobalRef(Thread* self, ObjPtr<mirror::Object> obj) { std::string error_msg; { WriterMutexLock mu(self, *Locks::jni_globals_lock_); - ref = globals_.Add(kIRTFirstSegment, obj, &error_msg); + ref = globals_.Add(obj, &error_msg); MaybeTraceGlobals(); } if (UNLIKELY(ref == nullptr)) { @@ -731,7 +731,7 @@ jweak JavaVMExt::AddWeakGlobalRef(Thread* self, ObjPtr<mirror::Object> obj) { WaitForWeakGlobalsAccess(self); } std::string error_msg; - IndirectRef ref = weak_globals_.Add(kIRTFirstSegment, obj, &error_msg); + IndirectRef ref = weak_globals_.Add(obj, &error_msg); MaybeTraceWeakGlobals(); if (UNLIKELY(ref == nullptr)) { LOG(FATAL) << error_msg; @@ -746,7 +746,7 @@ void JavaVMExt::DeleteGlobalRef(Thread* self, jobject obj) { } { WriterMutexLock mu(self, *Locks::jni_globals_lock_); - if (!globals_.Remove(kIRTFirstSegment, obj)) { + if (!globals_.Remove(obj)) { LOG(WARNING) << "JNI WARNING: DeleteGlobalRef(" << obj << ") " << "failed to find entry"; } @@ -760,7 +760,7 @@ void JavaVMExt::DeleteWeakGlobalRef(Thread* self, jweak obj) { return; } MutexLock mu(self, *Locks::jni_weak_globals_lock_); - if (!weak_globals_.Remove(kIRTFirstSegment, obj)) { + if (!weak_globals_.Remove(obj)) { LOG(WARNING) << "JNI WARNING: DeleteWeakGlobalRef(" << obj << ") " << "failed to find entry"; } |