@@ -243,6 +243,12 @@ BuiltinTypeInfo::BuiltinTypeInfo(TypeRefBuilder &builder,
243
243
descriptor.IsBitwiseTakable),
244
244
Name (descriptor.getMangledTypeName()) {}
245
245
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
+
246
252
// Builtin.Int<N> is mangled as 'Bi' N '_'
247
253
// Returns 0 if this isn't an Int
248
254
static unsigned isIntType (std::string name) {
@@ -258,6 +264,7 @@ static unsigned isIntType(std::string name) {
258
264
return 0 ;
259
265
}
260
266
267
+
261
268
bool BuiltinTypeInfo::readExtraInhabitantIndex (
262
269
remote::MemoryReader &reader, remote::RemoteAddress address,
263
270
int *extraInhabitantIndex) const {
@@ -1532,6 +1539,30 @@ TypeConverter::getAnyMetatypeTypeInfo() {
1532
1539
return AnyMetatypeTI;
1533
1540
}
1534
1541
1542
+ const TypeInfo *TypeConverter::getDefaultActorStorageTypeInfo () {
1543
+ if (DefaultActorStorageTI != nullptr )
1544
+ return DefaultActorStorageTI;
1545
+
1546
+ // The default actor storage is an opaque fixed-size buffer. Use the raw
1547
+ // pointer descriptor to find the word size and pointer alignment in the
1548
+ // current platform.
1549
+ auto descriptor =
1550
+ getBuilder ().getBuiltinTypeDescriptor (getRawPointerTypeRef ());
1551
+ if (descriptor == nullptr ) {
1552
+ DEBUG_LOG (fprintf (stderr, " No TypeInfo for default actor storage type\n " ));
1553
+ return nullptr ;
1554
+ }
1555
+
1556
+ auto size = descriptor->Size * NumWords_DefaultActor;
1557
+ auto alignment = 2 * descriptor->Alignment ;
1558
+
1559
+ DefaultActorStorageTI = makeTypeInfo<BuiltinTypeInfo>(
1560
+ /* Size=*/ size, /* Alignment*/ alignment, /* Stride=*/ size,
1561
+ /* NumExtraInhabitants*/ 0 , /* BitwiseTakable*/ true );
1562
+
1563
+ return DefaultActorStorageTI;
1564
+ }
1565
+
1535
1566
const TypeInfo *TypeConverter::getEmptyTypeInfo () {
1536
1567
if (EmptyTI != nullptr )
1537
1568
return EmptyTI;
@@ -2156,6 +2187,8 @@ class LowerType
2156
2187
} else if (B->getMangledName () == " BO" ) {
2157
2188
return TC.getReferenceTypeInfo (ReferenceKind::Strong,
2158
2189
ReferenceCounting::Unknown);
2190
+ } else if (B->getMangledName () == " BD" ) {
2191
+ return TC.getDefaultActorStorageTypeInfo ();
2159
2192
}
2160
2193
2161
2194
// / Otherwise, get the fixed layout information from reflection
0 commit comments