[CoroutineAccessors] Use retcon.once variant.

Allocate a coroutine frame in the caller based on the size in the
corresponding "function pointer" and pass it along with an allocator to
the callee.
This commit is contained in:
Nate Chandler
2025-02-14 16:07:38 -08:00
parent 3d655f58a2
commit dd8cbe3e0a
34 changed files with 1049 additions and 140 deletions

View File

@@ -2325,6 +2325,16 @@ FUNCTION(TaskDealloc,
EFFECT(Concurrency),
MEMEFFECTS(ArgMemOnly))
// void swift_task_dealloc_through(void *ptr);
FUNCTION(TaskDeallocThrough,
_Concurrency, swift_task_dealloc_through, SwiftCC,
CoroutineAccessorsAvailability,
RETURNS(VoidTy),
ARGS(Int8PtrTy),
ATTRS(NoUnwind),
EFFECT(Concurrency),
MEMEFFECTS(ArgMemOnly))
// void swift_task_cancel(AsyncTask *task);
FUNCTION(TaskCancel,
_Concurrency, swift_task_cancel, SwiftCC,
@@ -2989,6 +2999,36 @@ FUNCTION(MemsetS, c, memset_s, C_CC, AlwaysAvailable,
EFFECT(NoEffect),
UNKNOWN_MEMEFFECTS)
// void *swift_coro_alloc(CoroAllocator *, size_t size);
FUNCTION(CoroAlloc,
_Concurrency, swift_coro_alloc, SwiftCC,
CoroutineAccessorsAvailability,
RETURNS(Int8PtrTy),
ARGS(CoroAllocatorPtrTy, SizeTy),
NO_ATTRS,
EFFECT(Allocating, Concurrency),
UNKNOWN_MEMEFFECTS)
// void swift_coro_dealloc(CoroAllocator *, void *ptr);
FUNCTION(CoroDealloc,
_Concurrency, swift_coro_dealloc, SwiftCC,
CoroutineAccessorsAvailability,
RETURNS(VoidTy),
ARGS(CoroAllocatorPtrTy, Int8PtrTy),
NO_ATTRS,
EFFECT(Deallocating, Concurrency),
UNKNOWN_MEMEFFECTS)
// const CoroAllocator *swift_coro_getGlobalAllocator(CoroAllocatorFlags flags);
FUNCTION(CoroGetGlobalAllocator,
_Concurrency, swift_coro_getGlobalAllocator, SwiftCC,
CoroutineAccessorsAvailability,
RETURNS(CoroAllocatorPtrTy),
ARGS(CoroAllocatorFlagsTy),
ATTRS(NoUnwind, WillReturn),
EFFECT(Allocating),
UNKNOWN_MEMEFFECTS)
#undef RETURNS
#undef ARGS
#undef ATTRS