“This is the first day of my participation in the First Challenge 2022. For details: First Challenge 2022.”

BUFF BUFF, explore more

1, __LP64__

  • First, LP64 is a data model, not a Mac architecture

  • In LP64, long Integers and Pointers are 64 bits

  • As shown in the table: In addition to LP64, there are LLP64, ILP64, SILP64, ILP32 and other data models

data models
Data model short int long long long pointer
LLP64 16 32 32 64 64
LP64 16 32 64 64 64
ILP64 16 64 64 64 64
SILP64 64 64 64 64 64
ILP32 16 32 32 64 32

Note that the ILP32 data model is also used on 64-bit processors. This data model reduces the size of the code and the size of the data structure that contains Pointers, so the result is a much smaller address space. ILP32 is a good choice for some embedded systems. Has been used since the Apple Watch Series 4. So, will see such judgment in Objc source: (__ARM_ARCH_7K__ > = 2 | | (__arm64__ &&! __LP64__))

2、 __ARM_ARCH_7K__

// https://github.com/llvm/llvm-project/

// Unfortunately, __ARM_ARCH_7K__ is now more of an ABI descriptor. The CPU
// happens to be Cortex-A7 though, so it should still get __ARM_ARCH_7A__.
if (getTriple().isWatchABI())
    Builder.defineMacro("__ARM_ARCH_7K__"."2");
Copy the code
  • isWatchABI

At the same time, there is an Apple processor parameters page, you can also view the Apple device CPU parameters, check.

3, SUPPORT_INDEXED_ISA

After logging __ARM_ARCH_7K__, the record is followed by SUPPORT_INDEXED_ISA, which is often seen when exploring the source code associated with OC’s underlying classes.

// field as an index into a class table.
// Note, keep this in sync with any .s files which also define it.
// Be sure to edit objc-abi.h as well.
#if__ARM_ARCH_7K__ >= 2 || (__arm64__ && ! __LP64__)
#   define SUPPORT_INDEXED_ISA 1
#else
#   define SUPPORT_INDEXED_ISA 0
#endif
Copy the code
  • Check whether the device is a Watch device
  • According to the if condition, atiOSIn:
    • # define SUPPORT_INDEXED_ISA 0The Watch

One note: as noted in the opening paragraph, LP64 represents a data model, while ARM64 is the CPU architecture.

4, SUPPORT_PACKED_ISA

// Define SUPPORT_PACKED_ISA=1 on platforms that store the class in the isa 
// field as a maskable pointer with other data around it.
#if(! __LP64__ || TARGET_OS_WIN32 || \ (TARGET_OS_SIMULATOR && ! TARGET_OS_MACCATALYST && ! __arm64__))
#   define SUPPORT_PACKED_ISA 0
#else
#   define SUPPORT_PACKED_ISA 1
#endif
Copy the code
  • Determine whether support is supportedIsa optimization
  • According to the if condition, atiOSIn:
    • #define SUPPORT_PACKED_ISA 1Support the optimization

When analyzing the ISA_T data structure in class DE data Structure Analysis (Total), the ISA_BITFIELD (ISa.h) is defined in SUPPORT_PACKED_ISA

5, TARGET_OS_MACCATALYST

Mac Catalyst was launched by Apple at WWDC 19 as a “one-click operation” to help developers port iPad apps to The Mac OS. It says it “runs perfectly on the MAC with minimal optimization.” So the meaning of this macro is for that service.

6, SUPPORT_NONPOINTER_ISA

// Define SUPPORT_NONPOINTER_ISA=1 on any platform that may store something
// in the isa field that is not a raw pointer.
#if! SUPPORT_INDEXED_ISA && ! SUPPORT_PACKED_ISA
#   define SUPPORT_NONPOINTER_ISA 0
#else
#   define SUPPORT_NONPOINTER_ISA 1
#endif
Copy the code
  • Check whether it isa pure pointer isa
  • If condition, iniOSSUPPORT_INDEXED_ISA==0SUPPORT_PACKED_ISA ==1, that is:
    • # define SUPPORT_NONPOINTER_ISA 1:Impure pointer ISA