@@ -159,27 +159,32 @@ contain the following fields:
159
159
describe the existential container layout used to represent
160
160
values of the type. The word is laid out as follows:
161
161
162
- * The **number of witness tables ** is stored in the least significant 31 bits.
162
+ * The **number of witness tables ** is stored in the least significant 24 bits.
163
163
Values of the protocol type contain this number of witness table pointers
164
164
in their layout.
165
+ * The **special protocol kind ** is stored in 6 bits starting at
166
+ bit 24. Only one special protocol kind is defined: the `Error ` protocol has
167
+ value 1.
168
+ * The **superclass constraint indicator ** is stored at bit 30. When set, the
169
+ protocol type includes a superclass constraint (described below).
165
170
* The **class constraint ** is stored at bit 31. This bit is set if the type
166
171
is **not ** class-constrained, meaning that struct, enum, or class values
167
172
can be stored in the type. If not set, then only class values can be stored
168
173
in the type, and the type uses a more efficient layout.
169
174
170
- Note that the field is pointer-sized, even though only the lowest 32 bits are
171
- currently inhabited on all platforms. These values can be derived from the
172
- `protocol descriptor `_ records, but are pre-calculated for convenience.
173
-
174
175
- The **number of protocols ** that make up the protocol composition is stored at
175
- **offset 2 **. For the "any" types ``Any `` or ``Any : class ``, this
176
+ **offset 2 **. For the "any" types ``Any `` or ``AnyObject ``, this
176
177
is zero. For a single-protocol type ``P ``, this is one. For a protocol
177
178
composition type ``P & Q & ... ``, this is the number of protocols.
178
179
179
- - The **protocol descriptor vector ** begins at **offset 3 **. This is an inline
180
- array of pointers to the `protocol descriptor `_ for every protocol in the
181
- composition, or the single protocol descriptor for a protocol type. For
182
- an "any" type, there is no protocol descriptor vector.
180
+ - If the **superclass constraint indicator ** is set, type metadata for the
181
+ superclass follows at the next offset.
182
+
183
+ - The **protocol vector ** follows. This is an inline array of pointers to
184
+ descriptions of each protocol in the composition. Each pointer references
185
+ either a Swift `protocol descriptor `_ or an Objective-C `Protocol `; the low
186
+ bit will be set to indicate when it references an Objective-C protocol. For an
187
+ "any" or "AnyObject" type, there is no protocol descriptor vector.
183
188
184
189
Metatype Metadata
185
190
~~~~~~~~~~~~~~~~~
0 commit comments