Add a SIL-only '@block_storage T' type to represent on-stack storage for blocks.

Blocks need to be born on the stack, so we need a way to represent that on-stack storage. @block_storage T will represent the layout of a block that contains storage for a capture of type T.

Swift SVN r16355
This commit is contained in:
Joe Groff
2014-04-15 03:56:09 +00:00
parent 8956b2d2dc
commit f7cf592777
23 changed files with 196 additions and 12 deletions

View File

@@ -2143,7 +2143,16 @@ void Serializer::writeType(Type ty) {
writeRequirements(fnTy->getRequirements());
break;
}
case TypeKind::SILBlockStorage: {
auto storageTy = cast<SILBlockStorageType>(ty.getPointer());
unsigned abbrCode = DeclTypeAbbrCodes[SILBlockStorageTypeLayout::Code];
SILBlockStorageTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
addTypeRef(storageTy->getCaptureType()));
break;
}
case TypeKind::SILFunction: {
auto fnTy = cast<SILFunctionType>(ty.getPointer());
@@ -2331,6 +2340,7 @@ void Serializer::writeAllDeclsAndTypes() {
registerDeclTypeAbbr<BoundGenericSubstitutionLayout>();
registerDeclTypeAbbr<PolymorphicFunctionTypeLayout>();
registerDeclTypeAbbr<GenericFunctionTypeLayout>();
registerDeclTypeAbbr<SILBlockStorageTypeLayout>();
registerDeclTypeAbbr<SILFunctionTypeLayout>();
registerDeclTypeAbbr<ArraySliceTypeLayout>();
registerDeclTypeAbbr<ArrayTypeLayout>();