mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Prototype an @_addressable attribute that puts an argument at a stable address.
Many APIs using nonescapable types would like to vend interior pointers to their parameter bindings, but this isn't normally always possible because of representation changes the caller may do around the call, such as moving the value in or out of memory, bridging or reabstracting it, etc. `@_addressable` forces the corresponding parameter to be passed indirectly in memory, in its maximally-abstracted representation. [TODO] If return values have a lifetime dependency on this parameter, the caller must keep this in-memory representation alive for the duration of the dependent value's lifetime.
This commit is contained in:
@@ -7100,12 +7100,12 @@ detail::function_deserializer::deserialize(ModuleFile &MF,
|
||||
TypeID typeID;
|
||||
bool isVariadic, isAutoClosure, isNonEphemeral, isIsolated,
|
||||
isCompileTimeConst;
|
||||
bool isNoDerivative, isSending;
|
||||
bool isNoDerivative, isSending, isAddressable;
|
||||
unsigned rawOwnership;
|
||||
decls_block::FunctionParamLayout::readRecord(
|
||||
scratch, labelID, internalLabelID, typeID, isVariadic, isAutoClosure,
|
||||
isNonEphemeral, rawOwnership, isIsolated, isNoDerivative,
|
||||
isCompileTimeConst, isSending);
|
||||
isCompileTimeConst, isSending, isAddressable);
|
||||
|
||||
auto ownership = getActualParamDeclSpecifier(
|
||||
(serialization::ParamDeclSpecifier)rawOwnership);
|
||||
@@ -7120,7 +7120,8 @@ detail::function_deserializer::deserialize(ModuleFile &MF,
|
||||
ParameterTypeFlags(isVariadic, isAutoClosure,
|
||||
isNonEphemeral, *ownership,
|
||||
isIsolated, isNoDerivative,
|
||||
isCompileTimeConst, isSending),
|
||||
isCompileTimeConst, isSending,
|
||||
isAddressable),
|
||||
MF.getIdentifier(internalLabelID));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user