mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
alloc_stack needs to return two values like alloc_box.
The current implementation of dealloc_stack in IR-gen is a no-op, but that's very much wrong for types with non-trivial local allocation requirements, e.g. archetypes. So we need to be able to do non-trivial code here. However, that means modeling both the buffer pointer and the allocated address in SIL. To make this more type-safe, introduce a SIL-specific '[local_storage] T' type that represents the required allocation for locally storing a T. alloc_stack now returns one of those in additon to a *T, and dealloc_stack expects the former. IR-gen still implements dealloc_stack as a no-op, but that's now easy to fix. Swift SVN r6937
This commit is contained in:
@@ -1671,6 +1671,14 @@ Type ModuleFile::getType(TypeID TID) {
|
||||
break;
|
||||
}
|
||||
|
||||
case decls_block::LOCAL_STORAGE_TYPE: {
|
||||
TypeID valueTypeID;
|
||||
decls_block::LocalStorageTypeLayout::readRecord(scratch, valueTypeID);
|
||||
|
||||
typeOrOffset = LocalStorageType::get(getType(valueTypeID), ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
case decls_block::REFERENCE_STORAGE_TYPE: {
|
||||
uint8_t rawOwnership;
|
||||
TypeID referentTypeID;
|
||||
|
||||
Reference in New Issue
Block a user