From c4f3925490a73da8dc74884a1deb965d4ecaf14e Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Wed, 5 Oct 2016 18:32:08 -0700 Subject: Move remaining jobject related functions to use ObjPtr Also added ObjPtr::DownCast. Bug: 31113334 Test: test-art-host Change-Id: I59c253211dc435579ffdfd49f856861ab13d262c --- runtime/java_vm_ext.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'runtime/java_vm_ext.cc') diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc index 101c146072..c5f95eb6dc 100644 --- a/runtime/java_vm_ext.cc +++ b/runtime/java_vm_ext.cc @@ -640,11 +640,11 @@ void JavaVMExt::BroadcastForNewWeakGlobals() { weak_globals_add_condition_.Broadcast(self); } -mirror::Object* JavaVMExt::DecodeGlobal(IndirectRef ref) { - return globals_.SynchronizedGet(ref).Ptr(); +ObjPtr JavaVMExt::DecodeGlobal(IndirectRef ref) { + return globals_.SynchronizedGet(ref); } -void JavaVMExt::UpdateGlobal(Thread* self, IndirectRef ref, mirror::Object* result) { +void JavaVMExt::UpdateGlobal(Thread* self, IndirectRef ref, ObjPtr result) { WriterMutexLock mu(self, globals_lock_); globals_.Update(ref, result); } @@ -660,7 +660,7 @@ inline bool JavaVMExt::MayAccessWeakGlobalsUnlocked(Thread* self) const { allow_accessing_weak_globals_.LoadSequentiallyConsistent(); } -mirror::Object* JavaVMExt::DecodeWeakGlobal(Thread* self, IndirectRef ref) { +ObjPtr JavaVMExt::DecodeWeakGlobal(Thread* self, IndirectRef ref) { // It is safe to access GetWeakRefAccessEnabled without the lock since CC uses checkpoints to call // SetWeakRefAccessEnabled, and the other collectors only modify allow_accessing_weak_globals_ // when the mutators are paused. @@ -669,23 +669,23 @@ mirror::Object* JavaVMExt::DecodeWeakGlobal(Thread* self, IndirectRef ref) { // if MayAccessWeakGlobals is false. DCHECK_EQ(GetIndirectRefKind(ref), kWeakGlobal); if (LIKELY(MayAccessWeakGlobalsUnlocked(self))) { - return weak_globals_.SynchronizedGet(ref).Ptr(); + return weak_globals_.SynchronizedGet(ref); } MutexLock mu(self, weak_globals_lock_); return DecodeWeakGlobalLocked(self, ref); } -mirror::Object* JavaVMExt::DecodeWeakGlobalLocked(Thread* self, IndirectRef ref) { +ObjPtr JavaVMExt::DecodeWeakGlobalLocked(Thread* self, IndirectRef ref) { if (kDebugLocking) { weak_globals_lock_.AssertHeld(self); } while (UNLIKELY(!MayAccessWeakGlobals(self))) { weak_globals_add_condition_.WaitHoldingLocks(self); } - return weak_globals_.Get(ref).Ptr(); + return weak_globals_.Get(ref); } -mirror::Object* JavaVMExt::DecodeWeakGlobalDuringShutdown(Thread* self, IndirectRef ref) { +ObjPtr JavaVMExt::DecodeWeakGlobalDuringShutdown(Thread* self, IndirectRef ref) { DCHECK_EQ(GetIndirectRefKind(ref), kWeakGlobal); DCHECK(Runtime::Current()->IsShuttingDown(self)); if (self != nullptr) { @@ -695,7 +695,7 @@ mirror::Object* JavaVMExt::DecodeWeakGlobalDuringShutdown(Thread* self, Indirect if (!kUseReadBarrier) { DCHECK(allow_accessing_weak_globals_.LoadSequentiallyConsistent()); } - return weak_globals_.SynchronizedGet(ref).Ptr(); + return weak_globals_.SynchronizedGet(ref); } bool JavaVMExt::IsWeakGlobalCleared(Thread* self, IndirectRef ref) { @@ -711,7 +711,7 @@ bool JavaVMExt::IsWeakGlobalCleared(Thread* self, IndirectRef ref) { return Runtime::Current()->IsClearedJniWeakGlobal(weak_globals_.Get(ref)); } -void JavaVMExt::UpdateWeakGlobal(Thread* self, IndirectRef ref, mirror::Object* result) { +void JavaVMExt::UpdateWeakGlobal(Thread* self, IndirectRef ref, ObjPtr result) { MutexLock mu(self, weak_globals_lock_); weak_globals_.Update(ref, result); } -- cgit v1.2.3-59-g8ed1b