Skip to content

Commit 5d67c4a

Browse files
committed
[Async CC] Add parent to async context.
1 parent 0adfc0b commit 5d67c4a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ AsyncContextLayout irgen::getAsyncContextLayout(
103103
auto parameters = substitutedType->getParameters();
104104
SILFunctionConventions fnConv(substitutedType, IGF.getSILModule());
105105

106+
// AsyncContext * __ptrauth_swift_async_context_parent Parent;
107+
{
108+
auto ty = SILType();
109+
auto &ti = IGF.IGM.getSwiftContextPtrTypeInfo();
110+
valTypes.push_back(ty);
111+
typeInfos.push_back(&ti);
112+
}
113+
106114
// SwiftError *errorResult;
107115
auto errorCanType = IGF.IGM.Context.getExceptionType();
108116
auto errorType = SILType::getPrimitiveObjectType(errorCanType);

lib/IRGen/GenCall.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ namespace irgen {
9393

9494
private:
9595
enum class FixedIndex : unsigned {
96-
Error = 0,
96+
Parent = 0,
97+
Error = 1,
9798
};
9899
enum class FixedCount : unsigned {
100+
Parent = 1,
99101
Error = 1,
100102
};
101103
IRGenFunction &IGF;
@@ -111,6 +113,7 @@ namespace irgen {
111113
Optional<TrailingWitnessInfo> trailingWitnessInfo;
112114
SmallVector<ArgumentInfo, 4> argumentInfos;
113115

116+
unsigned getParentIndex() { return (unsigned)FixedIndex::Parent; }
114117
unsigned getErrorIndex() { return (unsigned)FixedIndex::Error; }
115118
unsigned getFirstIndirectReturnIndex() {
116119
return getErrorIndex() + getErrorCount();
@@ -156,6 +159,7 @@ namespace irgen {
156159
}
157160

158161
public:
162+
ElementLayout getParentLayout() { return getElement(getParentIndex()); }
159163
bool canHaveError() { return canHaveValidError; }
160164
ElementLayout getErrorLayout() { return getElement(getErrorIndex()); }
161165
unsigned getErrorCount() { return (unsigned)FixedCount::Error; }

0 commit comments

Comments
 (0)