StackReference

Android5.1.1数据结构解析之ObjectReference、StackReference

守給你的承諾、 提交于 2019-12-07 10:02:49
Android5.1.1数据结构解析之ObjectReference、StackReference @(Android研究)[Android|ObjectReference|StackReference] [TOC] ObjectReference 这个数据结构是一个模板类,它有两个模板参数kPoisonReferences和MirrorType,MirrorType表示所引用的类型,关于kPoisonReferences在下面会介绍到。它的源码在文件"art/runtime/mirror/object_reference.h"中,下面是它的源码和对这个类的解析: // Value type representing a reference to a mirror::Object of type MirrorType. template<bool kPoisonReferences, class MirrorType> class MANAGED ObjectReference { public: MirrorType* AsMirrorPtr() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return UnCompress(); } void Assign(MirrorType* other) SHARED_LOCKS