Skip to content

Commit 13937fd

Browse files
authored
Merge pull request #84528 from rjmccall/async-let-runtime-realism
Model async let begin/finish as builtins in SIL
2 parents 4de7e8c + a7d7970 commit 13937fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+456
-628
lines changed

include/swift/ABI/MetadataValues.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,9 +2910,9 @@ enum class TaskOptionRecordKind : uint8_t {
29102910
InitialSerialExecutor = 0,
29112911
/// Request a child task to be part of a specific task group.
29122912
TaskGroup = 1,
2913-
/// DEPRECATED. AsyncLetWithBuffer is used instead.
2913+
/// UNUSED. AsyncLetWithBuffer is used instead.
29142914
/// Request a child task for an 'async let'.
2915-
AsyncLet = 2,
2915+
// AsyncLet = 2,
29162916
/// Request a child task for an 'async let'.
29172917
AsyncLetWithBuffer = 3,
29182918
/// Information about the result type of the task, used in embedded Swift.

include/swift/ABI/TaskOptions.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -166,25 +166,6 @@ class InitialSerialExecutorTaskOptionRecord : public TaskOptionRecord {
166166
}
167167
};
168168

169-
/// DEPRECATED. AsyncLetWithBufferTaskOptionRecord is used instead.
170-
/// Task option to specify that the created task is for an 'async let'.
171-
class AsyncLetTaskOptionRecord : public TaskOptionRecord {
172-
AsyncLet *asyncLet;
173-
174-
public:
175-
AsyncLetTaskOptionRecord(AsyncLet *asyncLet)
176-
: TaskOptionRecord(TaskOptionRecordKind::AsyncLet),
177-
asyncLet(asyncLet) {}
178-
179-
AsyncLet *getAsyncLet() const {
180-
return asyncLet;
181-
}
182-
183-
static bool classof(const TaskOptionRecord *record) {
184-
return record->getKind() == TaskOptionRecordKind::AsyncLet;
185-
}
186-
};
187-
188169
class AsyncLetWithBufferTaskOptionRecord : public TaskOptionRecord {
189170
AsyncLet *asyncLet;
190171
void *resultBuffer;

include/swift/AST/Builtins.def

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -885,17 +885,7 @@ BUILTIN_MISC_OPERATION_WITH_SILGEN(GetCurrentAsyncTask, "getCurrentAsyncTask", "
885885
/// Cancel the given asynchronous task.
886886
BUILTIN_MISC_OPERATION_WITH_SILGEN(CancelAsyncTask, "cancelAsyncTask", "", Special)
887887

888-
/// startAsyncLet()<T>: (
889-
/// __owned @escaping () async throws -> sending T
890-
/// ) -> Builtin.RawPointer
891-
///
892-
/// DEPRECATED. startAsyncLetWithLocalBuffer is used instead.
893-
///
894-
/// Create, initialize and start a new async-let and associated task.
895-
/// Returns an AsyncLet* that must be passed to endAsyncLet for destruction.
896-
BUILTIN_MISC_OPERATION(StartAsyncLet, "startAsyncLet", "", Special)
897-
898-
/// startAsyncLetWithLocalBuffer()<T>: (
888+
/// startAsyncLetWithLocalBuffer: <T> (
899889
/// __owned @escaping () async throws -> sending T,
900890
/// _ resultBuf: Builtin.RawPointer
901891
/// ) -> Builtin.RawPointer
@@ -936,16 +926,11 @@ BUILTIN_MISC_OPERATION(FlowSensitiveSelfIsolation, "flowSensitiveSelfIsolation",
936926
BUILTIN_MISC_OPERATION(FlowSensitiveDistributedSelfIsolation,
937927
"flowSensitiveDistributedSelfIsolation", "", Special)
938928

939-
/// endAsyncLet(): (Builtin.RawPointer) -> Void
929+
/// finishAsyncLet(Builtin.RawPointer, Builtin.RawPointer) -> Void
940930
///
941-
/// DEPRECATED. The swift_asyncLet_finish intrinsic and endAsyncLetLifetime
942-
/// builtin are used instead.
943-
///
944-
/// Ends and destroys an async-let.
945-
/// The ClosureLifetimeFixup pass adds a second operand to the builtin to
946-
/// ensure that optimizations keep the stack-allocated closure arguments alive
947-
/// until the endAsyncLet.
948-
BUILTIN_MISC_OPERATION_WITH_SILGEN(EndAsyncLet, "endAsyncLet", "", Special)
931+
/// End the scope of an async let. An async operation. Deallocates stack
932+
/// memory that was allocated by startAsyncLetWithLocalBuffer.
933+
BUILTIN_MISC_OPERATION(FinishAsyncLet, "finishAsyncLet", "", Special)
949934

950935
/// endAsyncLetLifetime(): (Builtin.RawPointer) -> Void
951936
///

include/swift/AST/Builtins.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ enum class OverloadedBuiltinKind : uint8_t {
7777
};
7878

7979
/// BuiltinValueKind - The set of (possibly overloaded) builtin functions.
80-
enum class BuiltinValueKind {
80+
enum class BuiltinValueKind : unsigned {
8181
None = 0,
8282
#define BUILTIN(Id, Name, Attrs) Id,
8383
#include "swift/AST/Builtins.def"

0 commit comments

Comments
 (0)