Skip to content

Commit 1a26b3c

Browse files
committed
[AST] Increase size of type variable id field to 20 bits
Currently `id` field is only 12 bits long which is a lot smaller than `graph index` which is 28 bits and creates problems with large collections of literals since `id` is going to overflow pretty quickly (4096 elements max). Let's change it so both fields have the same 20 bits which is big enough. Resolves: [SR-10914](https://bugs.swift.org/browse/SR-10914) Resolves: rdar://problem/51616307
1 parent dae1971 commit 1a26b3c

File tree

2 files changed

+289
-2
lines changed

2 files changed

+289
-2
lines changed

include/swift/AST/Types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,14 @@ class alignas(1 << TypeAlignInBits) TypeBase {
338338

339339
SWIFT_INLINE_BITFIELD_FULL(TypeVariableType, TypeBase, 64-NumTypeBaseBits,
340340
/// The unique number assigned to this type variable.
341-
ID : 32 - NumTypeBaseBits,
341+
ID : 20,
342342

343343
/// Type variable options.
344344
Options : 4,
345345

346346
/// Index into the list of type variables, as used by the
347347
/// constraint graph.
348-
GraphIndex : 28
348+
GraphIndex : 20
349349
);
350350

351351
SWIFT_INLINE_BITFIELD(SILFunctionType, TypeBase, NumSILExtInfoBits+3+1+2,

0 commit comments

Comments
 (0)