Skip to content

Commit 86248e4

Browse files
committed
Runtime: Add a comment
1 parent ac199ac commit 86248e4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

include/swift/ABI/GenericContext.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,18 @@ enum class GenericPackKind: uint16_t {
265265
WitnessTable = 1
266266
};
267267

268+
/// The GenericPackShapeHeader is followed by an array of these descriptors,
269+
/// whose length is given by the header's NumPacks field.
270+
///
271+
/// The invariant is that all pack descriptors with GenericPackKind::Metadata
272+
/// must precede those with GenericPackKind::WitnessTable, and for each kind,
273+
/// the pack descriptors are ordered by their Index.
274+
///
275+
/// This allows us to iterate over the generic arguments array in parallel
276+
/// with the array of pack shape descriptors. We know we have a metadata
277+
/// or witness table when we reach the generic argument whose index is
278+
/// stored in the next descriptor; we increment the descriptor pointer in
279+
/// this case.
268280
struct GenericPackShapeDescriptor {
269281
GenericPackKind Kind;
270282

0 commit comments

Comments
 (0)