@@ -119,6 +119,16 @@ class LinkEntity {
119119 // This field appears in SILFunction.
120120 IsDynamicallyReplaceableImplShift = 8 ,
121121 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),
122132 };
123133#define LINKENTITY_SET_FIELD (field, value ) (value << field##Shift)
124134#define LINKENTITY_GET_FIELD (value, field ) ((value & field##Mask) >> field##Shift)
@@ -493,6 +503,11 @@ class LinkEntity {
493503 // / Accessible function record, which describes a function that can be
494504 // / looked up by name by the runtime.
495505 AccessibleFunctionRecord,
506+
507+ // / Extended existential type shape.
508+ // / Pointer is the (generalized) existential type.
509+ // / SecondaryPointer is the GenericSignatureImpl*.
510+ ExtendedExistentialTypeShape,
496511 };
497512 friend struct llvm ::DenseMapInfo<LinkEntity>;
498513
@@ -1352,6 +1367,24 @@ class LinkEntity {
13521367 return entity;
13531368 }
13541369
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+
13551388 void mangle (llvm::raw_ostream &out) const ;
13561389 void mangle (SmallVectorImpl<char > &buffer) const ;
13571390 std::string mangleAsString () const ;
@@ -1445,6 +1478,32 @@ class LinkEntity {
14451478 SecondaryPointer);
14461479 }
14471480
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+
14481507 bool isDynamicallyReplaceable () const {
14491508 assert (getKind () == Kind::SILFunction);
14501509 return LINKENTITY_GET_FIELD (Data, IsDynamicallyReplaceableImpl);
0 commit comments