@@ -119,6 +119,16 @@ class LinkEntity {
119
119
// This field appears in SILFunction.
120
120
IsDynamicallyReplaceableImplShift = 8 ,
121
121
IsDynamicallyReplaceableImplMask = ~KindMask,
122
+
123
+ // These fields appear in ExtendedExistentialTypeShape.
124
+ ExtendedExistentialIsUniqueShift = 8 ,
125
+ ExtendedExistentialIsUniqueMask = 0x100 ,
126
+ ExtendedExistentialIsSharedShift = 9 ,
127
+ ExtendedExistentialIsSharedMask = 0x200 ,
128
+ ExtendedExistentialMetatypeDepthShift = 10 ,
129
+ ExtendedExistentialMetatypeDepthMask =
130
+ ~(KindMask | ExtendedExistentialIsUniqueMask |
131
+ ExtendedExistentialIsSharedMask),
122
132
};
123
133
#define LINKENTITY_SET_FIELD (field, value ) (value << field##Shift)
124
134
#define LINKENTITY_GET_FIELD (value, field ) ((value & field##Mask) >> field##Shift)
@@ -493,6 +503,11 @@ class LinkEntity {
493
503
// / Accessible function record, which describes a function that can be
494
504
// / looked up by name by the runtime.
495
505
AccessibleFunctionRecord,
506
+
507
+ // / Extended existential type shape.
508
+ // / Pointer is the (generalized) existential type.
509
+ // / SecondaryPointer is the GenericSignatureImpl*.
510
+ ExtendedExistentialTypeShape,
496
511
};
497
512
friend struct llvm ::DenseMapInfo<LinkEntity>;
498
513
@@ -1352,6 +1367,24 @@ class LinkEntity {
1352
1367
return entity;
1353
1368
}
1354
1369
1370
+ static LinkEntity forExtendedExistentialTypeShape (CanGenericSignature genSig,
1371
+ CanExistentialType
1372
+ existentialType,
1373
+ unsigned metatypeDepth,
1374
+ bool isUnique,
1375
+ bool isShared) {
1376
+ LinkEntity entity;
1377
+ entity.Pointer = existentialType.getPointer ();
1378
+ entity.SecondaryPointer =
1379
+ const_cast <GenericSignatureImpl*>(genSig.getPointer ());
1380
+ entity.Data =
1381
+ LINKENTITY_SET_FIELD (Kind, unsigned (Kind::ExtendedExistentialTypeShape))
1382
+ | LINKENTITY_SET_FIELD (ExtendedExistentialIsUnique, unsigned (isUnique))
1383
+ | LINKENTITY_SET_FIELD (ExtendedExistentialIsShared, unsigned (isShared))
1384
+ | LINKENTITY_SET_FIELD (ExtendedExistentialMetatypeDepth, metatypeDepth);
1385
+ return entity;
1386
+ }
1387
+
1355
1388
void mangle (llvm::raw_ostream &out) const ;
1356
1389
void mangle (SmallVectorImpl<char > &buffer) const ;
1357
1390
std::string mangleAsString () const ;
@@ -1445,6 +1478,32 @@ class LinkEntity {
1445
1478
SecondaryPointer);
1446
1479
}
1447
1480
1481
+ CanGenericSignature getExtendedExistentialTypeShapeGenSig () const {
1482
+ assert (getKind () == Kind::ExtendedExistentialTypeShape);
1483
+ return CanGenericSignature (
1484
+ reinterpret_cast <const GenericSignatureImpl*>(SecondaryPointer));
1485
+ }
1486
+
1487
+ CanExistentialType getExtendedExistentialTypeShapeType () const {
1488
+ assert (getKind () == Kind::ExtendedExistentialTypeShape);
1489
+ return cast<ExistentialType>(CanType (reinterpret_cast <TypeBase*>(Pointer)));
1490
+ }
1491
+
1492
+ bool isExtendedExistentialTypeShapeUnique () const {
1493
+ assert (getKind () == Kind::ExtendedExistentialTypeShape);
1494
+ return LINKENTITY_GET_FIELD (Data, ExtendedExistentialIsUnique);
1495
+ }
1496
+
1497
+ bool isExtendedExistentialTypeShapeShared () const {
1498
+ assert (getKind () == Kind::ExtendedExistentialTypeShape);
1499
+ return LINKENTITY_GET_FIELD (Data, ExtendedExistentialIsShared);
1500
+ }
1501
+
1502
+ unsigned getExtendedExistentialTypeShapeMetatypeDepth () const {
1503
+ assert (getKind () == Kind::ExtendedExistentialTypeShape);
1504
+ return LINKENTITY_GET_FIELD (Data, ExtendedExistentialMetatypeDepth);
1505
+ }
1506
+
1448
1507
bool isDynamicallyReplaceable () const {
1449
1508
assert (getKind () == Kind::SILFunction);
1450
1509
return LINKENTITY_GET_FIELD (Data, IsDynamicallyReplaceableImpl);
0 commit comments