diff options
Diffstat (limited to 'runtime/mirror/object_reference.h')
-rw-r--r-- | runtime/mirror/object_reference.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/mirror/object_reference.h b/runtime/mirror/object_reference.h index f4a358018e..573cb308bd 100644 --- a/runtime/mirror/object_reference.h +++ b/runtime/mirror/object_reference.h @@ -19,6 +19,7 @@ #include "base/mutex.h" // For Locks::mutator_lock_. #include "globals.h" +#include "obj_ptr.h" namespace art { namespace mirror { @@ -86,11 +87,18 @@ class MANAGED HeapReference : public ObjectReference<kPoisonHeapReferences, Mirr REQUIRES_SHARED(Locks::mutator_lock_) { return HeapReference<MirrorType>(mirror_ptr); } + + static HeapReference<MirrorType> FromObjPtr(ObjPtr<MirrorType> ptr) + REQUIRES_SHARED(Locks::mutator_lock_); + private: explicit HeapReference(MirrorType* mirror_ptr) REQUIRES_SHARED(Locks::mutator_lock_) : ObjectReference<kPoisonHeapReferences, MirrorType>(mirror_ptr) {} }; +static_assert(sizeof(mirror::HeapReference<mirror::Object>) == kHeapReferenceSize, + "heap reference size does not match"); + // Standard compressed reference used in the runtime. Used for StackReference and GC roots. template<class MirrorType> class MANAGED CompressedReference : public mirror::ObjectReference<false, MirrorType> { |