Skip to content

Commit 61c60e8

Browse files
authored
Merge pull request swiftlang#36991 from apple/revert-36987-cherry-cleaner-abi-asynclet
2 parents 0c6b80e + 7f023ab commit 61c60e8

Some content is hidden

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

41 files changed

+162
-885
lines changed

include/swift/ABI/AsyncLet.h

Lines changed: 0 additions & 52 deletions
This file was deleted.

include/swift/ABI/MetadataValues.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ enum {
4949

5050
/// The number of words in a task group.
5151
NumWords_TaskGroup = 32,
52-
53-
/// The number of words in an AsyncLet (flags + task pointer)
54-
NumWords_AsyncLet = 8, // TODO: not sure how much is enough, these likely could be pretty small
5552
};
5653

5754
struct InProcess;
@@ -130,9 +127,6 @@ const size_t Alignment_DefaultActor = MaximumAlignment;
130127
/// The alignment of a TaskGroup.
131128
const size_t Alignment_TaskGroup = MaximumAlignment;
132129

133-
/// The alignment of an AsyncLet.
134-
const size_t Alignment_AsyncLet = MaximumAlignment;
135-
136130
/// Flags stored in the value-witness table.
137131
template <typename int_type>
138132
class TargetValueWitnessFlags {

include/swift/ABI/TaskGroup.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ namespace swift {
2929
/// The task group is responsible for maintaining dynamically created child tasks.
3030
class alignas(Alignment_TaskGroup) TaskGroup {
3131
public:
32-
// These constructors do not initialize the group instance, and the
33-
// destructor does not destroy the group instance; you must call
32+
// These constructors do not initialize the actor instance, and the
33+
// destructor does not destroy the actor instance; you must call
3434
// swift_taskGroup_{initialize,destroy} yourself.
3535
constexpr TaskGroup()
3636
: PrivateData{} {}
@@ -43,4 +43,4 @@ class alignas(Alignment_TaskGroup) TaskGroup {
4343

4444
} // end namespace swift
4545

46-
#endif // SWIFT_ABI_TASK_GROUP_H
46+
#endif

include/swift/AST/Builtins.def

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -782,19 +782,6 @@ BUILTIN_MISC_OPERATION_WITH_SILGEN(GetCurrentAsyncTask, "getCurrentAsyncTask", "
782782
/// Cancel the given asynchronous task.
783783
BUILTIN_MISC_OPERATION_WITH_SILGEN(CancelAsyncTask, "cancelAsyncTask", "", Special)
784784

785-
/// startAsyncLet()<T>: (
786-
/// __owned @Sendable @escaping () async throws -> T
787-
/// ) -> Builtin.RawPointer
788-
///
789-
/// Create, initialize and start a new async-let and associated task.
790-
/// Returns an AsyncLet* that must be passed to endAsyncLet for destruction.
791-
BUILTIN_MISC_OPERATION(StartAsyncLet, "startAsyncLet", "", Special)
792-
793-
/// asyncLetEnd(): (Builtin.RawPointer) -> Void
794-
///
795-
/// Ends and destroys an async-let.
796-
BUILTIN_MISC_OPERATION_WITH_SILGEN(EndAsyncLet, "endAsyncLet", "", Special)
797-
798785
/// createAsyncTaskFuture(): (
799786
/// Int, Builtin.NativeObject?, @escaping () async throws -> T
800787
/// ) -> Builtin.NativeObject

include/swift/Runtime/Concurrency.h

Lines changed: 12 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#define SWIFT_RUNTIME_CONCURRENCY_H
1919

2020
#include "swift/ABI/TaskGroup.h"
21-
#include "swift/ABI/AsyncLet.h"
2221
#include "swift/ABI/TaskStatus.h"
2322

2423
#pragma clang diagnostic push
@@ -50,17 +49,15 @@ using FutureAsyncSignature =
5049
/// closure.
5150
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
5251
AsyncTaskAndContext swift_task_create_future(
53-
JobFlags flags,
54-
const Metadata *futureResultType,
52+
JobFlags flags, const Metadata *futureResultType,
5553
void *closureEntryPoint,
5654
HeapObject * /* +1 */ closureContext);
5755

5856
/// Create a task object with a future which will run the given
5957
/// function.
6058
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
6159
AsyncTaskAndContext swift_task_create_future_f(
62-
JobFlags flags,
63-
const Metadata *futureResultType,
60+
JobFlags flags, const Metadata *futureResultType,
6461
FutureAsyncSignature::FunctionType *function,
6562
size_t initialContextSize);
6663

@@ -77,8 +74,7 @@ AsyncTaskAndContext swift_task_create_group_future(
7774
/// function, and offer its result to the task group
7875
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
7976
AsyncTaskAndContext swift_task_create_group_future_f(
80-
JobFlags flags,
81-
TaskGroup *group,
77+
JobFlags flags, TaskGroup *group,
8278
const Metadata *futureResultType,
8379
FutureAsyncSignature::FunctionType *function,
8480
size_t initialContextSize);
@@ -173,7 +169,7 @@ SWIFT_CC(swiftasync)
173169
/// \code
174170
/// func swift_taskGroup_wait_next_throwing(
175171
/// waitingTask: Builtin.NativeObject, // current task
176-
/// group: Builtin.RawPointer
172+
/// group: UnsafeRawPointer
177173
/// ) async -> T
178174
/// \endcode
179175
SWIFT_EXPORT_FROM(swift_Concurrency)
@@ -188,7 +184,8 @@ void swift_taskGroup_wait_next_throwing(
188184
/// Its Swift signature is
189185
///
190186
/// \code
191-
/// func swift_taskGroup_initialize(group: Builtin.RawPointer)
187+
/// func swift_taskGroup_initialize(group: Builtin.RawPointer
188+
/// )
192189
/// \endcode
193190
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
194191
void swift_taskGroup_initialize(TaskGroup *group);
@@ -205,6 +202,7 @@ void swift_taskGroup_initialize(TaskGroup *group);
205202
/// \code
206203
/// func swift_taskGroup_attachChild(
207204
/// group: Builtin.RawPointer,
205+
/// parent: Builtin.NativeObject,
208206
/// child: Builtin.NativeObject
209207
/// )
210208
/// \endcode
@@ -216,7 +214,7 @@ void swift_taskGroup_attachChild(TaskGroup *group, AsyncTask *child);
216214
/// This function MUST be called from the AsyncTask running the task group.
217215
///
218216
/// \code
219-
/// func swift_taskGroup_destroy(_ group: Builtin.RawPointer)
217+
/// func swift_taskGroup_destroy(_ group: UnsafeRawPointer)
220218
/// \endcode
221219
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
222220
void swift_taskGroup_destroy(TaskGroup *group);
@@ -246,7 +244,7 @@ bool swift_taskGroup_addPending(TaskGroup *group, bool unconditionally);
246244
/// Its Swift signature is
247245
///
248246
/// \code
249-
/// func swift_taskGroup_cancelAll(group: Builtin.RawPointer)
247+
/// func swift_taskGroup_cancelAll(group: UnsafeRawPointer)
250248
/// \endcode
251249
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
252250
void swift_taskGroup_cancelAll(TaskGroup *group);
@@ -259,7 +257,7 @@ void swift_taskGroup_cancelAll(TaskGroup *group);
259257
/// This can be called from any thread. Its Swift signature is
260258
///
261259
/// \code
262-
/// func swift_taskGroup_isCancelled(group: Builtin.RawPointer)
260+
/// func swift_taskGroup_isCancelled(group: UnsafeRawPointer)
263261
/// \endcode
264262
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
265263
bool swift_taskGroup_isCancelled(TaskGroup *group);
@@ -276,63 +274,6 @@ bool swift_taskGroup_isCancelled(TaskGroup *group);
276274
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
277275
bool swift_taskGroup_isEmpty(TaskGroup *group);
278276

279-
/// Its Swift signature is
280-
///
281-
/// \code
282-
/// func swift_asyncLet_start<T>(
283-
/// _ alet: Builtin.RawPointer,
284-
/// operation: __owned @Sendable @escaping () async throws -> T
285-
/// )
286-
/// \endcode
287-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
288-
void swift_asyncLet_start(
289-
AsyncLet *alet,
290-
const Metadata *futureResultType,
291-
void *closureEntryPoint,
292-
HeapObject * /* +1 */ closureContext);
293-
294-
/// This matches the ABI of a closure `<T>(Builtin.RawPointer) async -> T`
295-
using AsyncLetWaitSignature =
296-
SWIFT_CC(swiftasync)
297-
void(OpaqueValue *,
298-
SWIFT_ASYNC_CONTEXT AsyncContext *, AsyncTask *, Metadata *);
299-
300-
/// Wait for a non-throwing async-let to complete.
301-
///
302-
/// This can be called from any thread. Its Swift signature is
303-
///
304-
/// \code
305-
/// func swift_asyncLet_wait(
306-
/// _ asyncLet: _owned Builtin.RawPointer
307-
/// ) async -> Success
308-
/// \endcode
309-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swiftasync)
310-
void swift_asyncLet_wait(OpaqueValue *,
311-
SWIFT_ASYNC_CONTEXT AsyncContext *,
312-
AsyncLet *, Metadata *);
313-
314-
/// Wait for a potentially-throwing async-let to complete.
315-
///
316-
/// This can be called from any thread. Its Swift signature is
317-
///
318-
/// \code
319-
/// func swift_asyncLet_wait_throwing(
320-
/// _ asyncLet: _owned Builtin.RawPointer
321-
/// ) async throws -> Success
322-
/// \endcode
323-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swiftasync)
324-
void swift_asyncLet_wait_throwing(OpaqueValue *,
325-
SWIFT_ASYNC_CONTEXT AsyncContext *,
326-
AsyncLet *, Metadata *);
327-
328-
/// Its Swift signature is
329-
///
330-
/// \code
331-
/// func swift_asyncLet_end(_ alet: Builtin.RawPointer)
332-
/// \endcode
333-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
334-
void swift_asyncLet_end(AsyncLet *alet);
335-
336277
/// Add a status record to a task. The record should not be
337278
/// modified while it is registered with a task.
338279
///
@@ -373,7 +314,8 @@ bool swift_task_removeStatusRecord(TaskStatusRecord *record);
373314
/// The record must be removed with by the parent invoking
374315
/// `swift_task_detachChild` when the child has completed.
375316
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
376-
ChildTaskStatusRecord* swift_task_attachChild(AsyncTask *child);
317+
ChildTaskStatusRecord*
318+
swift_task_attachChild(AsyncTask *child);
377319

378320
/// Remove a child task from the parent tracking it.
379321
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)

include/swift/Runtime/RuntimeFunctions.def

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,8 +1541,7 @@ FUNCTION(TaskCreateFunc,
15411541
// AsyncTaskAndContext swift_task_create_future(
15421542
// size_t flags,
15431543
// const Metadata *futureResultType,
1544-
// void *closureEntry,
1545-
// HeapObject *closureContext);
1544+
// void *closureEntry, HeapObject *closureContext);
15461545
FUNCTION(TaskCreateFuture,
15471546
swift_task_create_future, SwiftCC,
15481547
ConcurrencyAvailability,
@@ -1554,8 +1553,7 @@ FUNCTION(TaskCreateFuture,
15541553
// AsyncTaskAndContext swift_task_create_future_f(
15551554
// size_t flags,
15561555
// const Metadata *futureResultType,
1557-
// TaskContinuationFunction *function,
1558-
// size_t contextSize);
1556+
// TaskContinuationFunction *function, size_t contextSize);
15591557
FUNCTION(TaskCreateFutureFunc,
15601558
swift_task_create_future_f, SwiftCC,
15611559
ConcurrencyAvailability,
@@ -1565,11 +1563,9 @@ FUNCTION(TaskCreateFutureFunc,
15651563
ATTRS(NoUnwind, ArgMemOnly))
15661564

15671565
// AsyncTaskAndContext swift_task_create_group_future(
1568-
// size_t flags,
1569-
// TaskGroup *group,
1566+
// size_t flags, TaskGroup *group,
15701567
// const Metadata *futureResultType,
1571-
// void *closureEntry,
1572-
// HeapObject *closureContext);
1568+
// void *closureEntry, HeapObject *closureContext);
15731569
FUNCTION(TaskCreateGroupFuture,
15741570
swift_task_create_group_future, SwiftCC,
15751571
ConcurrencyAvailability,
@@ -1580,11 +1576,9 @@ FUNCTION(TaskCreateGroupFuture,
15801576
ATTRS(NoUnwind, ArgMemOnly))
15811577

15821578
// AsyncTaskAndContext swift_task_create_group_future_f(
1583-
// size_t flags,
1584-
// TaskGroup *group,
1579+
// size_t flags, TaskGroup *group,
15851580
// const Metadata *futureResultType,
1586-
// TaskContinuationFunction *function,
1587-
// size_t contextSize);
1581+
// TaskContinuationFunction *function, size_t contextSize);
15881582
FUNCTION(TaskCreateGroupFutureFunc,
15891583
swift_task_create_group_future_f, SwiftCC,
15901584
ConcurrencyAvailability,
@@ -1678,31 +1672,6 @@ FUNCTION(DefaultActorDeallocateResilient,
16781672
ARGS(RefCountedPtrTy),
16791673
ATTRS(NoUnwind))
16801674

1681-
/// void swift_asyncLet_start(
1682-
/// AsyncLet *alet,
1683-
/// const Metadata *futureResultType,
1684-
/// void *closureEntryPoint,
1685-
/// HeapObject *closureContext
1686-
/// );
1687-
FUNCTION(AsyncLetStart,
1688-
swift_asyncLet_start, SwiftCC,
1689-
ConcurrencyAvailability,
1690-
RETURNS(VoidTy),
1691-
ARGS(SwiftAsyncLetPtrTy, // AsyncLet*, alias for Int8PtrTy
1692-
TypeMetadataPtrTy, // futureResultType
1693-
Int8PtrTy, // closureEntry
1694-
RefCountedPtrTy, // closureContext
1695-
),
1696-
ATTRS(NoUnwind, ArgMemOnly))
1697-
1698-
// void swift_asyncLet_end(AsyncLet *alet);
1699-
FUNCTION(EndAsyncLet,
1700-
swift_asyncLet_end, SwiftCC,
1701-
ConcurrencyAvailability,
1702-
RETURNS(VoidTy),
1703-
ARGS(SwiftAsyncLetPtrTy),
1704-
ATTRS(NoUnwind))
1705-
17061675
// void swift_taskGroup_initialize(TaskGroup *group);
17071676
FUNCTION(TaskGroupInitialize,
17081677
swift_taskGroup_initialize, SwiftCC,

0 commit comments

Comments
 (0)