Skip to content

Commit f29f439

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

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@ AsyncContextLayout irgen::getAsyncContextLayout(
111111
typeInfos.push_back(&ti);
112112
}
113113

114+
// TaskContinuationFunction * __ptrauth_swift_async_context_resume
115+
// ResumeParent;
116+
{
117+
auto ty = SILType();
118+
auto &ti = IGF.IGM.getTaskContinuationFunctionPtrTypeInfo();
119+
valTypes.push_back(ty);
120+
typeInfos.push_back(&ti);
121+
}
122+
114123
// SwiftError *errorResult;
115124
auto errorCanType = IGF.IGM.Context.getExceptionType();
116125
auto errorType = SILType::getPrimitiveObjectType(errorCanType);

lib/IRGen/GenCall.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ namespace irgen {
9494
private:
9595
enum class FixedIndex : unsigned {
9696
Parent = 0,
97-
Error = 1,
97+
ResumeParent = 1,
98+
Error = 2,
9899
};
99100
enum class FixedCount : unsigned {
100101
Parent = 1,
102+
ResumeParent = 1,
101103
Error = 1,
102104
};
103105
IRGenFunction &IGF;
@@ -114,6 +116,9 @@ namespace irgen {
114116
SmallVector<ArgumentInfo, 4> argumentInfos;
115117

116118
unsigned getParentIndex() { return (unsigned)FixedIndex::Parent; }
119+
unsigned getResumeParentIndex() {
120+
return (unsigned)FixedIndex::ResumeParent;
121+
}
117122
unsigned getErrorIndex() { return (unsigned)FixedIndex::Error; }
118123
unsigned getFirstIndirectReturnIndex() {
119124
return getErrorIndex() + getErrorCount();
@@ -160,6 +165,9 @@ namespace irgen {
160165

161166
public:
162167
ElementLayout getParentLayout() { return getElement(getParentIndex()); }
168+
ElementLayout getResumeParentLayout() {
169+
return getElement(getResumeParentIndex());
170+
}
163171
bool canHaveError() { return canHaveValidError; }
164172
ElementLayout getErrorLayout() { return getElement(getErrorIndex()); }
165173
unsigned getErrorCount() { return (unsigned)FixedCount::Error; }

0 commit comments

Comments
 (0)