@@ -243,6 +243,12 @@ BuiltinTypeInfo::BuiltinTypeInfo(TypeRefBuilder &builder,
243243 descriptor.IsBitwiseTakable),
244244 Name (descriptor.getMangledTypeName()) {}
245245
246+ BuiltinTypeInfo::BuiltinTypeInfo (unsigned Size, unsigned Alignment,
247+ unsigned Stride, unsigned NumExtraInhabitants,
248+ bool BitwiseTakable)
249+ : TypeInfo(TypeInfoKind::Builtin, Size, Alignment, Stride,
250+ NumExtraInhabitants, BitwiseTakable) {}
251+
246252// Builtin.Int<N> is mangled as 'Bi' N '_'
247253// Returns 0 if this isn't an Int
248254static unsigned isIntType (std::string name) {
@@ -258,6 +264,7 @@ static unsigned isIntType(std::string name) {
258264 return 0 ;
259265}
260266
267+
261268bool BuiltinTypeInfo::readExtraInhabitantIndex (
262269 remote::MemoryReader &reader, remote::RemoteAddress address,
263270 int *extraInhabitantIndex) const {
@@ -1520,6 +1527,30 @@ TypeConverter::getAnyMetatypeTypeInfo() {
15201527 return AnyMetatypeTI;
15211528}
15221529
1530+ const TypeInfo *TypeConverter::getDefaultActorStorageTypeInfo () {
1531+ if (DefaultActorStorageTI != nullptr )
1532+ return DefaultActorStorageTI;
1533+
1534+ // The default actor storage is an opaque fixed-size buffer. Use the raw
1535+ // pointer descriptor to find the word size and pointer alignment in the
1536+ // current platform.
1537+ auto descriptor =
1538+ getBuilder ().getBuiltinTypeDescriptor (getRawPointerTypeRef ());
1539+ if (descriptor == nullptr ) {
1540+ DEBUG_LOG (fprintf (stderr, " No TypeInfo for default actor storage type\n " ));
1541+ return nullptr ;
1542+ }
1543+
1544+ auto size = descriptor->Size * NumWords_DefaultActor;
1545+ auto alignment = 2 * descriptor->Alignment ;
1546+
1547+ DefaultActorStorageTI = makeTypeInfo<BuiltinTypeInfo>(
1548+ /* Size=*/ size, /* Alignment*/ alignment, /* Stride=*/ size,
1549+ /* NumExtraInhabitants*/ 0 , /* BitwiseTakable*/ true );
1550+
1551+ return DefaultActorStorageTI;
1552+ }
1553+
15231554const TypeInfo *TypeConverter::getEmptyTypeInfo () {
15241555 if (EmptyTI != nullptr )
15251556 return EmptyTI;
@@ -2144,6 +2175,8 @@ class LowerType
21442175 } else if (B->getMangledName () == " BO" ) {
21452176 return TC.getReferenceTypeInfo (ReferenceKind::Strong,
21462177 ReferenceCounting::Unknown);
2178+ } else if (B->getMangledName () == " BD" ) {
2179+ return TC.getDefaultActorStorageTypeInfo ();
21472180 }
21482181
21492182 // / Otherwise, get the fixed layout information from reflection
0 commit comments