Skip to content

Commit c22c0c5

Browse files
committed
[Async CC] Add Flags to context.
1 parent e3f92e4 commit c22c0c5

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,16 @@ AsyncContextLayout irgen::getAsyncContextLayout(
131131
// ExecutorRef ResumeParentExecutor;
132132
addExecutor();
133133

134+
// AsyncContextFlags Flags;
135+
{
136+
auto ty = SILType::getPrimitiveObjectType(
137+
BuiltinIntegerType::get(32, IGF.IGM.IRGen.SIL.getASTContext())
138+
->getCanonicalType());
139+
const auto &ti = IGF.IGM.getTypeInfo(ty);
140+
valTypes.push_back(ty);
141+
typeInfos.push_back(&ti);
142+
}
143+
134144
// SwiftError *errorResult;
135145
auto errorCanType = IGF.IGM.Context.getExceptionType();
136146
auto errorType = SILType::getPrimitiveObjectType(errorCanType);

lib/IRGen/GenCall.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ namespace irgen {
9696
Parent = 0,
9797
ResumeParent = 1,
9898
ResumeParentExecutor = 2,
99-
Error = 3,
99+
Flags = 3,
100+
Error = 4,
100101
};
101102
enum class FixedCount : unsigned {
102103
Parent = 1,
@@ -124,6 +125,7 @@ namespace irgen {
124125
unsigned getResumeParentExecutorIndex() {
125126
return (unsigned)FixedIndex::ResumeParentExecutor;
126127
}
128+
unsigned getFlagsIndex() { return (unsigned)FixedIndex::Flags; }
127129
unsigned getErrorIndex() { return (unsigned)FixedIndex::Error; }
128130
unsigned getFirstIndirectReturnIndex() {
129131
return getErrorIndex() + getErrorCount();
@@ -176,6 +178,7 @@ namespace irgen {
176178
ElementLayout getResumeParentExecutorLayout() {
177179
return getElement(getResumeParentExecutorIndex());
178180
}
181+
ElementLayout getFlagsLayout() { return getElement(getFlagsIndex()); }
179182
bool canHaveError() { return canHaveValidError; }
180183
ElementLayout getErrorLayout() { return getElement(getErrorIndex()); }
181184
unsigned getErrorCount() { return (unsigned)FixedCount::Error; }

0 commit comments

Comments
 (0)