Debugging environment
- The source code: objc4-818.2
- CPU architecture: X86_64
What is the isa
Isa is bit-domain data that stores reference counts, class information, and other information about an object. Take x86_64 architecture source code as an example:
# define ISA_BITFIELD \
uintptr_t nonpointer : 1; \
uintptr_t has_assoc : 1; \
uintptr_t has_cxx_dtor : 1; \
uintptr_t shiftcls : 44; /*MACH_VM_MAX_ADDRESS 0x7fffffe00000*/ \
uintptr_t magic : 6; \
uintptr_t weakly_referenced : 1; \
uintptr_t unused : 1; \
uintptr_t has_sidetable_rc : 1; \
uintptr_t extra_rc : 8
Copy the code
The following figure isa schematic diagram of isa bitfields under the 86_64 architecture
Description of data bits in the ISA bit domain
nonpointer
Whether:Pure ISA pointer
, 0 meansPure isa
Pure isa Pointers mean that only Pointers to classes are stored in the ISA bitfield (i.eshiftcls
); 1 on behalf ofNot a pure ISA
Non-pure ISA except for having Pointers to classesshiftcls
, as well ashas_assoc
,extra_rc
And other information; In the first0
One bit, occupied1
A bit.has_assoc
: Indicates whether the object hasassociations
, 0 indicates that there is no associated object, 1 indicates that there is an associated object. In the first1
One bit, occupied1
A bit.has_cxx_dtor
: whether the object has a C++ destructor; In the first2
One bit, occupied1
A bit.shiftcls
: address to the class to which the object belongs; In the first3-46
One bit, occupied44
A bit.magic
: magic number used to determine whether the object has been initialized,0x3b
The delegate has been initialized; In the first47-52
One bit, occupied6
A bit.weakly_referenced
Whether or not:Being a weak reference
; In the first53
One bit, occupied1
A bit.unused
: placeholder; In the first54
One bit, occupied1
A bit.has_sidetable_rc
: Whether to store reference counts in sidetable, which is 1 when extra_RC runs out of reference counts and needs to use sideTable to store reference counts, or 0 otherwise; In the first55
One bit, occupied1
A bit.has_sidetable_rc
: reference count; In the first56-63.
One bit, occupied8
A bit