diff options
Diffstat (limited to 'runtime/obj_ptr.h')
-rw-r--r-- | runtime/obj_ptr.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/runtime/obj_ptr.h b/runtime/obj_ptr.h index 7c0c9df7d2..beb4d33a11 100644 --- a/runtime/obj_ptr.h +++ b/runtime/obj_ptr.h @@ -49,11 +49,11 @@ class ObjPtr { template <typename Type> ALWAYS_INLINE ObjPtr(const ObjPtr<Type>& other) REQUIRES_SHARED(Locks::mutator_lock_) - : reference_(Encode(static_cast<MirrorType*>(other.Decode()))) {} + : reference_(Encode(static_cast<MirrorType*>(other.Ptr()))) {} template <typename Type> ALWAYS_INLINE ObjPtr& operator=(const ObjPtr& other) { - reference_ = Encode(static_cast<MirrorType*>(other.Decode())); + reference_ = Encode(static_cast<MirrorType*>(other.Ptr())); return *this; } @@ -67,17 +67,17 @@ class ObjPtr { } ALWAYS_INLINE MirrorType* operator->() const REQUIRES_SHARED(Locks::mutator_lock_) { - return Decode(); + return Ptr(); } ALWAYS_INLINE bool IsNull() const { return reference_ == 0; } - // Decode makes sure that the object pointer is valid. - ALWAYS_INLINE MirrorType* Decode() const REQUIRES_SHARED(Locks::mutator_lock_) { + // Ptr makes sure that the object pointer is valid. + ALWAYS_INLINE MirrorType* Ptr() const REQUIRES_SHARED(Locks::mutator_lock_) { AssertValid(); - return DecodeUnchecked(); + return PtrUnchecked(); } ALWAYS_INLINE bool IsValid() const REQUIRES_SHARED(Locks::mutator_lock_); @@ -85,13 +85,13 @@ class ObjPtr { ALWAYS_INLINE void AssertValid() const REQUIRES_SHARED(Locks::mutator_lock_); ALWAYS_INLINE bool operator==(const ObjPtr& ptr) const REQUIRES_SHARED(Locks::mutator_lock_) { - return Decode() == ptr.Decode(); + return Ptr() == ptr.Ptr(); } template <typename PointerType> ALWAYS_INLINE bool operator==(const PointerType* ptr) const REQUIRES_SHARED(Locks::mutator_lock_) { - return Decode() == ptr; + return Ptr() == ptr; } ALWAYS_INLINE bool operator==(std::nullptr_t) const { @@ -99,21 +99,21 @@ class ObjPtr { } ALWAYS_INLINE bool operator!=(const ObjPtr& ptr) const REQUIRES_SHARED(Locks::mutator_lock_) { - return Decode() != ptr.Decode(); + return Ptr() != ptr.Ptr(); } template <typename PointerType> ALWAYS_INLINE bool operator!=(const PointerType* ptr) const REQUIRES_SHARED(Locks::mutator_lock_) { - return Decode() != ptr; + return Ptr() != ptr; } ALWAYS_INLINE bool operator!=(std::nullptr_t) const { return !IsNull(); } - // Decode unchecked does not check that object pointer is valid. Do not use if you can avoid it. - ALWAYS_INLINE MirrorType* DecodeUnchecked() const { + // Ptr unchecked does not check that object pointer is valid. Do not use if you can avoid it. + ALWAYS_INLINE MirrorType* PtrUnchecked() const { if (kPoison) { return reinterpret_cast<MirrorType*>( static_cast<uintptr_t>(static_cast<uint32_t>(reference_ << kObjectAlignmentShift))); |