@@ -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 {
@@ -1520,6 +1527,30 @@ TypeConverter::getAnyMetatypeTypeInfo() {
1520
1527
return AnyMetatypeTI;
1521
1528
}
1522
1529
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
+
1523
1554
const TypeInfo *TypeConverter::getEmptyTypeInfo () {
1524
1555
if (EmptyTI != nullptr )
1525
1556
return EmptyTI;
@@ -2144,6 +2175,8 @@ class LowerType
2144
2175
} else if (B->getMangledName () == " BO" ) {
2145
2176
return TC.getReferenceTypeInfo (ReferenceKind::Strong,
2146
2177
ReferenceCounting::Unknown);
2178
+ } else if (B->getMangledName () == " BD" ) {
2179
+ return TC.getDefaultActorStorageTypeInfo ();
2147
2180
}
2148
2181
2149
2182
// / Otherwise, get the fixed layout information from reflection
0 commit comments