[concurrency] Create builtins for invoking specific concurrency runtime functions.

Specifically:

1. swift_task_addCancellationHandler
2. swift_task_removeCancellationHandler
3. swift_task_addPriorityEscalationHandler
4. swift_task_removePriorityEscalationHandler
5. swift_task_localValuePush
6. swift_task_localValuePop

rdar://109850951
This commit is contained in:
Michael Gottesman
2025-10-30 13:06:09 -07:00
parent 1711ef2e62
commit 97b0e2ebae
13 changed files with 450 additions and 0 deletions

View File

@@ -2660,6 +2660,72 @@ FUNCTION(TaskGroupDestroy,
EFFECT(RuntimeEffect::Concurrency),
UNKNOWN_MEMEFFECTS)
// CancellationNotificationStatusRecord*
// swift_task_addCancellationHandler(
// CancellationNotificationStatusRecord::FunctionType handler,
// void *context);
FUNCTION(TaskAddCancellationHandler,
_Concurrency, swift_task_addCancellationHandler, SwiftCC,
ConcurrencyAvailability,
RETURNS(Int8PtrTy),
ARGS(Int8PtrTy, Int8PtrTy),
ATTRS(NoUnwind),
EFFECT(RuntimeEffect::Concurrency),
UNKNOWN_MEMEFFECTS)
// void swift_task_removeCancellationHandler(
// CancellationNotificationStatusRecord *record);
FUNCTION(TaskRemoveCancellationHandler,
_Concurrency, swift_task_removeCancellationHandler, SwiftCC,
ConcurrencyAvailability,
RETURNS(VoidTy),
ARGS(Int8PtrTy),
ATTRS(NoUnwind),
EFFECT(RuntimeEffect::Concurrency),
UNKNOWN_MEMEFFECTS)
// EscalationNotificationStatusRecord*
// swift_task_addPriorityEscalationHandler(
// EscalationNotificationStatusRecord::FunctionType handler,
// void *context);
FUNCTION(TaskAddPriorityEscalationHandler,
_Concurrency, swift_task_addPriorityEscalationHandler, SwiftCC,
ConcurrencyAvailability,
RETURNS(Int8PtrTy),
ARGS(Int8PtrTy, Int8PtrTy),
ATTRS(NoUnwind),
EFFECT(RuntimeEffect::Concurrency),
UNKNOWN_MEMEFFECTS)
// void swift_task_removePriorityEscalationHandler(
// EscalationNotificationStatusRecord *record);
FUNCTION(TaskRemovePriorityEscalationHandler,
_Concurrency, swift_task_removePriorityEscalationHandler, SwiftCC,
ConcurrencyAvailability,
RETURNS(VoidTy),
ARGS(Int8PtrTy),
ATTRS(NoUnwind),
EFFECT(RuntimeEffect::Concurrency),
UNKNOWN_MEMEFFECTS)
// void swift_task_localValuePush(const HeapObject *key,
// /* +1 */ OpaqueValue *value,
// const Metadata *valueType);
FUNCTION(TaskLocalValuePush, _Concurrency, swift_task_localValuePush, SwiftCC,
ConcurrencyAvailability, RETURNS(),
ARGS(RefCountedPtrTy, OpaquePtrTy, TypeMetadataPtrTy), ATTRS(NoUnwind),
EFFECT(RuntimeEffect::Concurrency), UNKNOWN_MEMEFFECTS)
// void swift_task_localValuePop();
FUNCTION(TaskLocalValuePop,
_Concurrency, swift_task_localValuePop, SwiftCC,
ConcurrencyAvailability,
RETURNS(),
ARGS(),
ATTRS(NoUnwind),
EFFECT(RuntimeEffect::Concurrency),
UNKNOWN_MEMEFFECTS)
// AutoDiffLinearMapContext *swift_autoDiffCreateLinearMapContextWithType(const Metadata *);
FUNCTION(AutoDiffCreateLinearMapContextWithType,
Swift, swift_autoDiffCreateLinearMapContextWithType, SwiftCC,