@@ -66,9 +66,9 @@ part of a symbolic reference.
66
66
67
67
symbolic-reference ::= [\x01-\x17] .{4} // Relative symbolic reference
68
68
#if sizeof(void*) == 8
69
- symbolic-reference ::= [\x18-\x1F] .{8} // Absolute symbolic reference
69
+ symbolic-reference ::= [\x18-\x1F] .{8} // Absolute symbolic reference for 64-bit pointers
70
70
#elif sizeof(void*) == 4
71
- symbolic-reference ::= [\x18-\x1F] .{4} // Absolute symbolic reference
71
+ symbolic-reference ::= [\x18-\x1F] .{4} // Absolute symbolic reference for 32-bit pointers
72
72
#endif
73
73
74
74
Symbolic references are only valid in compiler-emitted metadata structures
@@ -110,7 +110,7 @@ The following symbolic reference kinds are currently implemented:
110
110
#endif
111
111
112
112
#if SWIFT_RUNTIME_VERSION >= 5.TBD
113
- objective-c-protocol-relative-reference ::= ` \x0C` .{4} // Reference points directly to a objective-c protcol reference
113
+ objective-c-protocol-relative-reference ::= ' \x0C' .{4} // Reference points directly to a objective-c protcol reference
114
114
#endif
115
115
116
116
A mangled name may also include ``\xFF `` bytes, which are only used for
@@ -151,7 +151,7 @@ Globals
151
151
global ::= protocol 'Hr' // protocol descriptor runtime record
152
152
global ::= nominal-type 'Hn' // nominal type descriptor runtime record
153
153
#if SWIFT_RUNTIME_VERSION >= 5.1
154
- global ::= opaque-type 'Ho' // opaque type descriptor runtime record
154
+ global ::= opaque-type-decl-name 'Ho' // opaque type descriptor runtime record
155
155
#endif
156
156
global ::= protocol-conformance 'Hc' // protocol conformance runtime record
157
157
global ::= global 'HF' // accessible function runtime record
@@ -250,14 +250,11 @@ types where the metadata itself has unknown layout.)
250
250
global ::= global specialization // function specialization
251
251
global ::= global 'Tm' // merged function
252
252
global ::= entity // some identifiable thing
253
- global ::= from-type to-type generic-signature? 'TR' // reabstraction thunk
254
- global ::= impl-function-type type 'Tz' index? // objc-to-swift-async completion handler block implementation
255
- global ::= impl-function-type type 'TZ' index? // objc-to-swift-async completion handler block implementation (predefined by runtime)
256
- global ::= from-type to-type generic-signature? 'TR' // reabstraction thunk
257
- global ::= impl-function-type type generic-signature? 'Tz' // objc-to-swift-async completion handler block implementation
258
- global ::= impl-function-type type generic-signature? 'TZ' // objc-to-swift-async completion handler block implementation (predefined by runtime)
259
- global ::= from-type to-type self-type generic-signature? 'Ty' // reabstraction thunk with dynamic 'Self' capture
260
- global ::= from-type to-type generic-signature? 'Tr' // obsolete mangling for reabstraction thunk
253
+ global ::= type type generic-signature? 'TR' // reabstraction thunk
254
+ global ::= impl-function-type type generic-signature? 'Tz' index? // objc-to-swift-async completion handler block implementation
255
+ global ::= impl-function-type type generic-signature? 'TZ' index? // objc-to-swift-async completion handler block implementation predefined by runtime
256
+ global ::= type type type generic-signature? 'Ty' // reabstraction thunk with dynamic 'Self' capture
257
+ global ::= type type generic-signature? 'Tr' // obsolete mangling for reabstraction thunk
261
258
global ::= entity generic-signature? type type* 'TK' // key path getter
262
259
global ::= entity generic-signature? type type* 'Tk' // key path setter
263
260
global ::= entity generic-signature? type type* 'Tkmu' // key path unapplied method
@@ -266,9 +263,9 @@ types where the metadata itself has unknown layout.)
266
263
global ::= type generic-signature 'Th' // key path hasher
267
264
global ::= global generic-signature? 'TJ' AUTODIFF-FUNCTION-KIND INDEX-SUBSET 'p' INDEX-SUBSET 'r' // autodiff function
268
265
global ::= global generic-signature? 'TJV' AUTODIFF-FUNCTION-KIND INDEX-SUBSET 'p' INDEX-SUBSET 'r' // autodiff derivative vtable thunk
269
- global ::= from- type to- type 'TJO' AUTODIFF-FUNCTION-KIND // autodiff self-reordering reabstraction thunk
270
- global ::= from- type 'TJS' AUTODIFF-FUNCTION-KIND INDEX-SUBSET 'p' INDEX-SUBSET 'r' INDEX-SUBSET 'P' // autodiff linear map subset parameters thunk
271
- global ::= global to- type 'TJS' AUTODIFF-FUNCTION-KIND INDEX-SUBSET 'p' INDEX-SUBSET 'r' INDEX-SUBSET 'P' // autodiff derivative function subset parameters thunk
266
+ global ::= type type 'TJO' AUTODIFF-FUNCTION-KIND // autodiff self-reordering reabstraction thunk
267
+ global ::= type 'TJS' AUTODIFF-FUNCTION-KIND INDEX-SUBSET 'p' INDEX-SUBSET 'r' INDEX-SUBSET 'P' // autodiff linear map subset parameters thunk
268
+ global ::= global type 'TJS' AUTODIFF-FUNCTION-KIND INDEX-SUBSET 'p' INDEX-SUBSET 'r' INDEX-SUBSET 'P' // autodiff derivative function subset parameters thunk
272
269
273
270
global ::= protocol 'TL' // protocol requirements base descriptor
274
271
global ::= assoc-type-name 'Tl' // associated type descriptor
@@ -280,9 +277,9 @@ types where the metadata itself has unknown layout.)
280
277
REABSTRACT-THUNK-TYPE ::= 'R' // reabstraction thunk
281
278
REABSTRACT-THUNK-TYPE ::= 'r' // reabstraction thunk (obsolete)
282
279
283
- global ::= reabstraction-thunk type 'TU' // reabstraction thunk with global actor constraint
280
+ global ::= global type 'TU' // reabstraction thunk with global actor constraint
284
281
285
- The ` from-type ` and ` to-type ` in a reabstraction thunk helper function
282
+ All reabstraction thunks have the " from" and "to" types in that order, and
286
283
are always non-polymorphic ``<impl-function-type> `` types.
287
284
288
285
::
@@ -341,9 +338,9 @@ with a differentiable function used for differentiable programming.
341
338
global ::= generic-signature? type 'WOF' // Outlined assignWithCopy, not using value witness
342
339
global ::= generic-signature? type 'WOh' // Outlined destroy
343
340
global ::= generic-signature? type 'WOH' // Outlined destroy, not using value witness
344
- global ::= generic-signature? type 'WOi` // Outlined store enum tag
345
- global ::= generic-signature? type 'WOj` // Outlined enum destructive project
346
- global ::= generic-signature? type 'WOg` // Outlined enum get tag
341
+ global ::= generic-signature? type 'WOi' // Outlined store enum tag
342
+ global ::= generic-signature? type 'WOj' // Outlined enum destructive project
343
+ global ::= generic-signature? type 'WOg' // Outlined enum get tag
347
344
348
345
Entities
349
346
~~~~~~~~
@@ -357,8 +354,10 @@ Entities
357
354
curry-thunk ::= 'Tc'
358
355
359
356
label-list ::= empty-list // represents complete absence of parameter labels
360
- label-list ::= ('_' | identifier) * // '_' is inserted as placeholder for empty label,
357
+ label-list ::= label * // '_' is inserted as placeholder for empty label,
361
358
// since the number of labels should match the number of parameters
359
+ label ::= '_' // empty label
360
+ label ::= identifier // label
362
361
363
362
// The leading type is the function type
364
363
entity-spec ::= label-list type file-discriminator? 'fC' // allocating constructor
@@ -602,6 +601,8 @@ Types
602
601
603
602
any-generic-type ::= standard-substitutions
604
603
604
+ nominal-type ::= any-generic-type // nominal type
605
+
605
606
standard-substitutions ::= 'S' KNOWN-TYPE-KIND // known nominal type substitution
606
607
standard-substitutions ::= 'S' NATURAL KNOWN-TYPE-KIND // repeated known type substitutions of the same kind
607
608
@@ -724,8 +725,9 @@ Types
724
725
type ::= '$' 'n'? INDEX // integer type
725
726
#endif
726
727
727
- bound-generic-type ::= type 'y' (type* '_')* type* retroactive-conformance* 'G' // one type-list per nesting level of type
728
+ bound-generic-type ::= type bound-generic-args 'G' // one type-list per nesting level of type
728
729
bound-generic-type ::= substitution
730
+ bound-generic-args ::= 'y' (type* '_')* type* retroactive-conformance* // generic arguments
729
731
730
732
FUNCTION-KIND ::= 'f' // @thin function type
731
733
FUNCTION-KIND ::= 'U' // uncurried function type (currently not used)
@@ -738,7 +740,7 @@ Types
738
740
FUNCTION-KIND ::= 'A' // @auto_closure function type (escaping)
739
741
FUNCTION-KIND ::= 'E' // function type (noescape)
740
742
741
- C-TYPE ::= NATURAL CHAR* // raw Itanium mangling
743
+ C-TYPE ::= NATURAL IDENTIFIER-STRING // raw Itanium mangling
742
744
743
745
function-signature ::= result-type params-type async? sendable? throws? differentiable? function-isolation? sending-result? // results and parameters
744
746
@@ -785,7 +787,7 @@ The 6.0 Swift runtime supports demangling ``sending-result``, but has a bug when
785
787
METATYPE-REPR ::= 'o' // ObjC metatype representation
786
788
787
789
existential-layout ::= protocol-list 'p' // existential layout
788
- existential-layout ::= protocol-list superclass 'Xc' // existential layout with superclass
790
+ existential-layout ::= protocol-list type 'Xc' // existential layout with superclass
789
791
existential-layout ::= protocol-list 'Xl' // existential layout with AnyObject
790
792
791
793
type ::= associated-type
@@ -801,11 +803,10 @@ The 6.0 Swift runtime supports demangling ``sending-result``, but has a bug when
801
803
type ::= assoc-type-name 'Qz' // shortcut for 'Qyz'
802
804
type ::= assoc-type-list 'QY' GENERIC-PARAM-INDEX // associated type at depth
803
805
type ::= assoc-type-list 'QZ' // shortcut for 'QYz'
804
- type ::= opaque-type-decl-name bound-generic-args 'Qo' INDEX // opaque type
805
-
806
- type ::= pack-type 'Qe' INDEX // pack element type
806
+
807
+ type ::= type 'Qe' INDEX // pack element type
807
808
808
- type ::= pattern- type count- type 'Qp' // pack expansion type
809
+ type ::= type type 'Qp' // pack expansion type (pattern, count)
809
810
type ::= pack-element-list 'QP' // pack type
810
811
type ::= pack-element-list 'QS' DIRECTNESS // SIL pack type
811
812
@@ -814,7 +815,7 @@ The 6.0 Swift runtime supports demangling ``sending-result``, but has a bug when
814
815
815
816
#if SWIFT_RUNTIME_VERSION >= 5.2
816
817
type ::= type assoc-type-name 'Qx' // associated type relative to base `type`
817
- type ::= type assoc-type-list 'QX' // associated type relative to base `type`
818
+ type ::= type assoc-type-list 'QX' // associated type relative to base `type` list
818
819
#endif
819
820
820
821
#if SWIFT_RUNTIME_VERSION >= 5.7
@@ -830,7 +831,7 @@ The 6.0 Swift runtime supports demangling ``sending-result``, but has a bug when
830
831
associated-type ::= type identifier 'Qa' // associated type
831
832
832
833
assoc-type-name ::= identifier // associated type name without protocol
833
- assoc-type-name ::= identifier protocol 'P' //
834
+ assoc-type-name ::= identifier protocol 'P' // associated type name with protocol
834
835
835
836
empty-list ::= 'y'
836
837
@@ -845,7 +846,7 @@ mangled in to disambiguate.
845
846
impl-function-type ::= type* 'I' FUNC-ATTRIBUTES '_'
846
847
impl-function-type ::= type* generic-signature 'I' FUNC-ATTRIBUTES '_'
847
848
848
- FUNC-ATTRIBUTES ::= PATTERN-SUBS? INVOCATION-SUBS ? PSEUDO-GENERIC? CALLEE-ESCAPE? ISOLATION? DIFFERENTIABILITY-KIND? CALLEE-CONVENTION FUNC-REPRESENTATION? COROUTINE-KIND? SENDABLE? ASYNC? SENDING-RESULT? (PARAM-CONVENTION PARAM-DIFFERENTIABILITY?)* RESULT-CONVENTION* ('Y' PARAM-CONVENTION)* ('z' RESULT-CONVENTION RESULT-DIFFERENTIABILITY?)?
849
+ FUNC-ATTRIBUTES ::= PATTERN-SUBS? INVOCATION-SUB ? PSEUDO-GENERIC? CALLEE-ESCAPE? ISOLATION? DIFFERENTIABILITY-KIND? CALLEE-CONVENTION FUNC-REPRESENTATION? COROUTINE-KIND? SENDABLE? ASYNC? SENDING-RESULT? (PARAM-CONVENTION PARAM-DIFFERENTIABILITY?)* RESULT-CONVENTION* ('Y' PARAM-CONVENTION)* ('z' RESULT-CONVENTION RESULT-DIFFERENTIABILITY?)?
849
850
850
851
PATTERN-SUBS ::= 's' // has pattern substitutions
851
852
INVOCATION-SUB ::= 'I' // has invocation substitutions
@@ -953,10 +954,10 @@ productions:
953
954
::
954
955
955
956
any-generic-type ::= context decl-name 'a' // typealias type
956
- type ::= base- type " XSq" // sugared Optional type
957
- type ::= base- type " XSa" // sugared Array type
958
- type ::= key- type value- type " XSD" // sugared Dictionary type
959
- type ::= count- type element- type " XSA" // sugared InlineArray type
957
+ type ::= type ' XSq' // sugared Optional type
958
+ type ::= type ' XSa' // sugared Array type
959
+ type ::= type type ' XSD' // sugared Dictionary type (key, value)
960
+ type ::= type type ' XSA' // sugared InlineArray type (count, element)
960
961
961
962
Generics
962
963
~~~~~~~~
@@ -1005,7 +1006,7 @@ Property behaviors are implemented using private protocol conformances.
1005
1006
dependent-associated-conformance 'HA' DEPENDENT-CONFORMANCE-INDEX
1006
1007
1007
1008
dependent-associated-conformance ::= type protocol
1008
- dependent-protocol-conformance ::= dependent-protocol-conformance opaque- type 'HO'
1009
+ dependent-protocol-conformance ::= dependent-protocol-conformance type 'HO'
1009
1010
1010
1011
pack-protocol-conformance ::= any-protocol-conformance-list 'HX'
1011
1012
@@ -1041,7 +1042,7 @@ now codified into the ABI; the index 0 is therefore reserved.
1041
1042
generic-param-marker ::= generic-param-pack-marker
1042
1043
generic-param-marker ::= generic-param-value-marker
1043
1044
1044
- generic-param-pack-marker ::= 'Rv' GENERIC_PARAM -INDEX // generic parameter pack marker
1045
+ generic-param-pack-marker ::= 'Rv' GENERIC-PARAM -INDEX // generic parameter pack marker
1045
1046
1046
1047
#if SWIFT_RUNTIME_VERSION >= 6.TBD
1047
1048
generic-param-value-marker ::= type 'RV' GENERIC-PARAM-INDEX // generic parameter value marker
@@ -1085,9 +1086,9 @@ now codified into the ABI; the index 0 is therefore reserved.
1085
1086
LAYOUT-CONSTRAINT ::= 'T' // Trivial
1086
1087
LAYOUT-CONSTRAINT ::= 'C' // Class
1087
1088
LAYOUT-CONSTRAINT ::= 'D' // NativeClass
1088
- LAYOUT-CONSTRAINT ::= 'E' LAYOUT-SIZE-AND-ALIGNMENT // Trivial of exact size
1089
+ LAYOUT-CONSTRAINT ::= 'E' LAYOUT-SIZE-AND-ALIGNMENT // Trivial of exact size and alignment
1089
1090
LAYOUT-CONSTRAINT ::= 'e' LAYOUT-SIZE // Trivial of exact size
1090
- LAYOUT-CONSTRAINT ::= 'M' LAYOUT-SIZE-AND-ALIGNMENT // Trivial of size at most N bits
1091
+ LAYOUT-CONSTRAINT ::= 'M' LAYOUT-SIZE-AND-ALIGNMENT // Trivial of size and alignment at most N bits
1091
1092
LAYOUT-CONSTRAINT ::= 'm' LAYOUT-SIZE // Trivial of size at most N bits
1092
1093
LAYOUT-CONSTRAINT ::= 'U' // Unknown layout
1093
1094
LAYOUT-CONSTRAINT ::= 'B' // BridgeObject
@@ -1231,7 +1232,7 @@ Substitutions
1231
1232
::
1232
1233
1233
1234
substitution ::= 'A' INDEX // substitution of N+26
1234
- substitution ::= 'A' SUBST_IDX * LAST-SUBST-IDX // One or more consecutive substitutions of N < 26
1235
+ substitution ::= 'A' SUBST-IDX * LAST-SUBST-IDX // One or more consecutive substitutions of N < 26
1235
1236
SUBST-IDX ::= [a-z]
1236
1237
SUBST-IDX ::= NATURAL [a-z]
1237
1238
LAST-SUBST-IDX ::= [A-Z]
@@ -1282,14 +1283,14 @@ Numbers and Indexes
1282
1283
INDEX ::= '_' // 0
1283
1284
INDEX ::= NATURAL '_' // N+1
1284
1285
NATURAL ::= [1-9] [0-9]*
1285
- NATURAL_ZERO ::= [0-9]+
1286
+ NATURAL-ZERO ::= [0-9]+
1286
1287
1287
1288
``<INDEX> `` is a production for encoding numbers in contexts that can't
1288
1289
end in a digit; it's optimized for encoding smaller numbers.
1289
1290
1290
1291
::
1291
1292
1292
- INDEX-SUBSET ::= ('S' | 'U') +
1293
+ INDEX-SUBSET ::= [SU] +
1293
1294
1294
1295
``<INDEX-SUBSET> `` is encoded like a bit vector and is optimized for encoding
1295
1296
indices with a small upper bound.
@@ -1359,14 +1360,14 @@ Some kinds need arguments, which precede ``Tf``.
1359
1360
1360
1361
CONST-PROP ::= 'f' // Consumes one identifier argument which is a function symbol name
1361
1362
CONST-PROP ::= 'g' // Consumes one identifier argument which is a global symbol name
1362
- CONST-PROP ::= 'i' NATURAL_ZERO // 64-bit-integer
1363
- CONST-PROP ::= 'd' NATURAL_ZERO // float-as-64-bit-integer
1363
+ CONST-PROP ::= 'i' NATURAL-ZERO // 64-bit-integer
1364
+ CONST-PROP ::= 'd' NATURAL-ZERO // float-as-64-bit-integer
1364
1365
CONST-PROP ::= 's' ENCODING // string literal. Consumes one identifier argument.
1365
1366
CONST-PROP ::= 'k' // keypath. Consumes one identifier - the SHA1 of the keypath and two types (root and value).
1366
1367
1367
1368
ENCODING ::= 'b' // utf8
1368
1369
ENCODING ::= 'w' // utf16
1369
- ENCODING ::= 'c' // utf16
1370
+ ENCODING ::= 'c' // objc
1370
1371
1371
1372
If the first character of the string literal is a digit ``[0-9] `` or an
1372
1373
underscore ``_ ``, the identifier for the string literal is prefixed with an
0 commit comments