Skip to content

Commit 38fc849

Browse files
authored
Document Class Metadata offsets and fields when there is no Objective-C interoperability (#32374)
1 parent 33693c6 commit 38fc849

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

docs/ABI/TypeMetadata.rst

+15-7
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,18 @@ classes.
222222
record is stored at **offset 0**, in place of an integer kind discriminator.
223223
- The **super pointer** pointing to the metadata record for the superclass is
224224
stored at **offset 1**. If the class is a root class, it is null.
225-
- Two words are reserved for use by the Objective-C runtime at **offset 2**
226-
and **offset 3**.
227-
- The **rodata pointer** is stored at **offset 4**; it points to an Objective-C
228-
compatible rodata record for the class. This pointer value includes a tag.
225+
- On platforms which support Objective-C interoperability, two words are
226+
reserved for use by the Objective-C runtime at **offset 2** and **offset
227+
3**; on other platforms, nothing is reserved.
228+
- On platforms which support Objective-C interoperability, the **rodata
229+
pointer** is stored at **offset 4**; on other platforms, it is not present.
230+
The rodata pointer points to an Objective-C compatible rodata record for the
231+
class. This pointer value includes a tag.
229232
The **low bit is always set to 1** for Swift classes and always set to 0 for
230233
Objective-C classes.
231-
- The **class flags** are a 32-bit field at **offset 5**.
234+
- The **class flags** are a 32-bit field at **offset 5** on platforms which
235+
support Objective-C interoperability; on other platforms, the field is at
236+
**offset 2**.
232237
- The **instance address point** is a 32-bit field following the class flags.
233238
A pointer to an instance of this class points this number of bytes after the
234239
beginning of the instance.
@@ -246,8 +251,11 @@ classes.
246251
object size. This is the number of bytes of storage in the class metadata
247252
object.
248253
- The `nominal type descriptor`_ for the most-derived class type is referenced
249-
at an offset immediately following the class object address point. This is
250-
**offset 8** on a 64-bit platform or **offset 11** on a 32-bit platform.
254+
at an offset immediately following the class object address point. On 64-bit
255+
and 32-bit platforms which support Objective-C interoperability, this is,
256+
respectively, at **offset 8** and at **offset 11**; in platforms that do not
257+
support Objective-C interoperability, this is, respectively, at **offset 5**
258+
and at **offset 8**.
251259
- For each Swift class in the class's inheritance hierarchy, in order starting
252260
from the root class and working down to the most derived class, the following
253261
fields are present:

0 commit comments

Comments
 (0)