From e03662b71bbb4d262af0840bf90ce4fc84750b43 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Thu, 13 Oct 2016 17:12:56 -0700 Subject: ART: Change IndirectReferenceTable Change cookie structure to allow for more entries. Use a local hole-count caching scheme. The design is driven by two considerations. For one, the change is small and mostly local. The other point is to still allow inlining of functions involved with JNI transitions. This change is in preparation for a resizable backing table for "unlimite" local references. micro_native tests show changes are in the noise. Bug: 32125344 Test: m test-art-host Change-Id: I08ff5d6eaed75d13ec88f469fb0d18328a0eeb70 --- runtime/java_vm_ext.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'runtime/java_vm_ext.cc') diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc index f1f9de8ef8..dc6311af58 100644 --- a/runtime/java_vm_ext.cc +++ b/runtime/java_vm_ext.cc @@ -551,7 +551,7 @@ jobject JavaVMExt::AddGlobalRef(Thread* self, ObjPtr obj) { return nullptr; } WriterMutexLock mu(self, *Locks::jni_globals_lock_); - IndirectRef ref = globals_.Add(IRT_FIRST_SEGMENT, obj); + IndirectRef ref = globals_.Add(kIRTFirstSegment, obj); return reinterpret_cast(ref); } @@ -563,7 +563,7 @@ jweak JavaVMExt::AddWeakGlobalRef(Thread* self, ObjPtr obj) { while (UNLIKELY(!MayAccessWeakGlobals(self))) { weak_globals_add_condition_.WaitHoldingLocks(self); } - IndirectRef ref = weak_globals_.Add(IRT_FIRST_SEGMENT, obj); + IndirectRef ref = weak_globals_.Add(kIRTFirstSegment, obj); return reinterpret_cast(ref); } @@ -572,7 +572,7 @@ void JavaVMExt::DeleteGlobalRef(Thread* self, jobject obj) { return; } WriterMutexLock mu(self, *Locks::jni_globals_lock_); - if (!globals_.Remove(IRT_FIRST_SEGMENT, obj)) { + if (!globals_.Remove(kIRTFirstSegment, obj)) { LOG(WARNING) << "JNI WARNING: DeleteGlobalRef(" << obj << ") " << "failed to find entry"; } @@ -583,7 +583,7 @@ void JavaVMExt::DeleteWeakGlobalRef(Thread* self, jweak obj) { return; } MutexLock mu(self, *Locks::jni_weak_globals_lock_); - if (!weak_globals_.Remove(IRT_FIRST_SEGMENT, obj)) { + if (!weak_globals_.Remove(kIRTFirstSegment, obj)) { LOG(WARNING) << "JNI WARNING: DeleteWeakGlobalRef(" << obj << ") " << "failed to find entry"; } -- cgit v1.2.3-59-g8ed1b