diff options
author | 2016-10-03 18:01:28 -0700 | |
---|---|---|
committer | 2016-10-04 10:46:16 -0700 | |
commit | 1cc62e4ea24828fdb3f3da0b8603f0b107d09a04 (patch) | |
tree | 718e322f3d05ac095770d4dc2a68b824bf3974a7 /runtime/obj_ptr.h | |
parent | 82d4838d6bb3480cd25327cedc5179fb2d86881c (diff) |
Rename ObjPtr::Decode to ObjPtr::Ptr
Done to prevent ambiguity with ScopedObjectAccess::Decode.
Bug: 31113334
Test: test-art-host
Change-Id: I07a2497cc9cf66386311798933547471987fc316
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))); |