美文网首页iOS底层探索
类加载时flags标识

类加载时flags标识

作者: loongod | 来源:发表于2020-10-18 15:47 被阅读0次

一、class_ro_tflags 标识

// Values for class_ro_t->flags
// These are emitted by the compiler and are part of the ABI.
// Note: See CGObjCNonFragileABIMac::BuildClassRoTInitializer in clang
// class is a metaclass
#define RO_META               (1<<0)
// class is a root class
#define RO_ROOT               (1<<1)
// class has .cxx_construct/destruct implementations
#define RO_HAS_CXX_STRUCTORS  (1<<2)
// class has +load implementation
// #define RO_HAS_LOAD_METHOD    (1<<3)
// class has visibility=hidden set
#define RO_HIDDEN             (1<<4)
// class has attribute(objc_exception): OBJC_EHTYPE_$_ThisClass is non-weak
#define RO_EXCEPTION          (1<<5)
// class has ro field for Swift metadata initializer callback
#define RO_HAS_SWIFT_INITIALIZER (1<<6)
// class compiled with ARC
#define RO_IS_ARC             (1<<7)
// class has .cxx_destruct but no .cxx_construct (with RO_HAS_CXX_STRUCTORS)
#define RO_HAS_CXX_DTOR_ONLY  (1<<8)
// class is not ARC but has ARC-style weak ivar layout
#define RO_HAS_WEAK_WITHOUT_ARC (1<<9)
// class does not allow associated objects on instances
#define RO_FORBIDS_ASSOCIATED_OBJECTS (1<<10)

// class is in an unloadable bundle - must never be set by compiler
#define RO_FROM_BUNDLE        (1<<29)
// class is unrealized future class - must never be set by compiler
#define RO_FUTURE             (1<<30)
// class is realized - must never be set by compiler
#define RO_REALIZED           (1<<31)

二、class_rw_tflags 标识

// Values for class_rw_t->flags
// These are not emitted by the compiler and are never used in class_ro_t.
// Their presence should be considered in future ABI versions.
// class_t->data is class_rw_t, not class_ro_t
#define RW_REALIZED           (1<<31)
// class is unresolved future class
#define RW_FUTURE             (1<<30)
// class is initialized
#define RW_INITIALIZED        (1<<29)
// class is initializing
#define RW_INITIALIZING       (1<<28)
// class_rw_t->ro is heap copy of class_ro_t
#define RW_COPIED_RO          (1<<27)
// class allocated but not yet registered
#define RW_CONSTRUCTING       (1<<26)
// class allocated and registered
#define RW_CONSTRUCTED        (1<<25)
// available for use; was RW_FINALIZE_ON_MAIN_THREAD
// #define RW_24 (1<<24)
// class +load has been called
#define RW_LOADED             (1<<23)
#if !SUPPORT_NONPOINTER_ISA
// class instances may have associative references
#define RW_INSTANCES_HAVE_ASSOCIATED_OBJECTS (1<<22)
#endif
// class has instance-specific GC layout
#define RW_HAS_INSTANCE_SPECIFIC_LAYOUT (1 << 21)
// class does not allow associated objects on its instances
#define RW_FORBIDS_ASSOCIATED_OBJECTS       (1<<20)
// class has started realizing but not yet completed it
#define RW_REALIZING          (1<<19)

// class is a metaclass (copied from ro)
#define RW_META               RO_META // (1<<0)

相关文章

  • 类加载时flags标识

    一、class_ro_t 的 flags 标识 二、class_rw_t 的 flags 标识

  • JVM加载类过程

    1 类加载总过程 类加载子系统负责从文件系统或者网络加载Class文件,Class文件在文件开头有特定的文件标识i...

  • spring-源码04-bean的装载流程

    流程回顾 spring加载bean的主分支流程大概分为下面这3步1.加载配置类2.扫描配置类标识的包,并且将其转换...

  • 双亲委派

    JVM在加载类时默认采用的是双亲委派机制。 某个特定的类加载器在接到加载类的请求时,首先将加载任务委托给父类加载器...

  • 在高并发环境中一种更加安全懒加载对象方式

    类加载器加载Something类时,LazyHolder是静态类,因此,类加载器不会加载该类。当第一次调用getI...

  • 类加载器

    1.1 类加载 类加载的描述 当程序要使用某个类时,如果该类还未被加载到内存中,则系统会通过类的加载,类的连接,类...

  • JVM(三)-类加载器概括与类加载过程

    内存结构详细图: 类加载器子系统负责从文件系统中加载.class文件。class文件中有特定的开头标识(链接Lin...

  • java

    双亲委托模式 某个特定的类加载器在接到加载类的请求时,首先将加载任务委托给父类加载器,依次递归。 如果父类加载器可...

  • 类加载器&反射

    1.类加载器 1.1类加载【理解】 类加载的描述当程序要使用某个类时,如果该类还未被加载到内存中,则系统会通过类的...

  • 双亲委派模型

    当一个类收到请求时,当前默认的类加载器不会自己先加载这个类,它会委托给自己的父类加载器去加载,父类加载器再委托给父...

网友评论

    本文标题:类加载时flags标识

    本文链接:https://www.haomeiwen.com/subject/grjcmktx.html