Rename ObjPtr::Decode to ObjPtr::Ptr
Done to prevent ambiguity with ScopedObjectAccess::Decode.
Bug: 31113334
Test: test-art-host
Change-Id: I07a2497cc9cf66386311798933547471987fc316
diff --git a/runtime/obj_ptr.h b/runtime/obj_ptr.h
index 7c0c9df..beb4d33 100644
--- a/runtime/obj_ptr.h
+++ b/runtime/obj_ptr.h
@@ -49,11 +49,11 @@
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 @@
}
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 @@
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 @@
}
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)));