Skip to content

Commit 5546f4d

Browse files
committed
Rename ExecutorRef to SerialExecutorRef
1 parent 9e75142 commit 5546f4d

23 files changed

+109
-109
lines changed

include/swift/ABI/Executor.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class TaskExecutorWitnessTable;
5454
/// bits off before accessing the witness table, so setting them
5555
/// in the future should back-deploy as long as the witness table
5656
/// reference is still present.
57-
class ExecutorRef {
57+
class SerialExecutorRef {
5858
HeapObject *Identity; // Not necessarily Swift reference-countable
5959
uintptr_t Implementation;
6060

@@ -80,7 +80,7 @@ class ExecutorRef {
8080

8181
static_assert(static_cast<uintptr_t>(ExecutorKind::Ordinary) == 0);
8282

83-
constexpr ExecutorRef(HeapObject *identity, uintptr_t implementation)
83+
constexpr SerialExecutorRef(HeapObject *identity, uintptr_t implementation)
8484
: Identity(identity), Implementation(implementation) {}
8585

8686
public:
@@ -89,35 +89,35 @@ class ExecutorRef {
8989
/// environment, it's presumed to be okay to switch synchronously
9090
/// to an actor. As an executor request, this represents a request
9191
/// to drop whatever the current actor is.
92-
constexpr static ExecutorRef generic() {
93-
return ExecutorRef(nullptr, 0);
92+
constexpr static SerialExecutorRef generic() {
93+
return SerialExecutorRef(nullptr, 0);
9494
}
9595

9696
/// Given a pointer to a default actor, return an executor reference
9797
/// for it.
98-
static ExecutorRef forDefaultActor(DefaultActor *actor) {
98+
static SerialExecutorRef forDefaultActor(DefaultActor *actor) {
9999
assert(actor);
100-
return ExecutorRef(actor, 0);
100+
return SerialExecutorRef(actor, 0);
101101
}
102102

103103
/// Given a pointer to a serial executor and its SerialExecutor
104104
/// conformance, return an executor reference for it.
105-
static ExecutorRef forOrdinary(HeapObject *identity,
105+
static SerialExecutorRef forOrdinary(HeapObject *identity,
106106
const SerialExecutorWitnessTable *witnessTable) {
107107
assert(identity);
108108
assert(witnessTable);
109109
auto wtable = reinterpret_cast<uintptr_t>(witnessTable) |
110110
static_cast<uintptr_t>(ExecutorKind::Ordinary);
111-
return ExecutorRef(identity, wtable);
111+
return SerialExecutorRef(identity, wtable);
112112
}
113113

114-
static ExecutorRef forComplexEquality(HeapObject *identity,
114+
static SerialExecutorRef forComplexEquality(HeapObject *identity,
115115
const SerialExecutorWitnessTable *witnessTable) {
116116
assert(identity);
117117
assert(witnessTable);
118118
auto wtable = reinterpret_cast<uintptr_t>(witnessTable) |
119119
static_cast<uintptr_t>(ExecutorKind::ComplexEquality);
120-
return ExecutorRef(identity, wtable);
120+
return SerialExecutorRef(identity, wtable);
121121
}
122122

123123
HeapObject *getIdentity() const {
@@ -163,7 +163,7 @@ class ExecutorRef {
163163

164164
/// Do we have to do any work to start running as the requested
165165
/// executor?
166-
bool mustSwitchToRun(ExecutorRef newExecutor) const {
166+
bool mustSwitchToRun(SerialExecutorRef newExecutor) const {
167167
return Identity != newExecutor.Identity;
168168
}
169169

@@ -175,14 +175,18 @@ class ExecutorRef {
175175
return Implementation & WitnessTableMask;
176176
}
177177

178-
bool operator==(ExecutorRef other) const {
178+
bool operator==(SerialExecutorRef other) const {
179179
return Identity == other.Identity;
180180
}
181-
bool operator!=(ExecutorRef other) const {
181+
bool operator!=(SerialExecutorRef other) const {
182182
return !(*this == other);
183183
}
184184
};
185185

186+
/// Deprecated name for "SerialExecutorRef"; When it was first introduced it was ExecutorRef,
187+
/// but it always meant specifically a serial executor.
188+
typedef SerialExecutorRef ExecutorRef;
189+
186190
class TaskExecutorRef {
187191
HeapObject *Identity; // Not necessarily Swift reference-countable
188192
uintptr_t Implementation;
@@ -250,7 +254,7 @@ class TaskExecutorRef {
250254

251255
// /// Do we have to do any work to start running as the requested
252256
// /// executor?
253-
// bool mustSwitchToRun(ExecutorRef newExecutor) const {
257+
// bool mustSwitchToRun(TaskExecutorRef newExecutor) const {
254258
// return Identity != newExecutor.Identity;
255259
// }
256260

@@ -267,10 +271,6 @@ class TaskExecutorRef {
267271
}
268272
};
269273

270-
// Historically the 'ExecutorRef' was introduced initially, however it always has meant specifically
271-
// a SERIAL executor. This typedef fixes up this confusion and especially since now there is also a TaskExecutor.
272-
typedef ExecutorRef SerialExecutorRef;
273-
274274
using JobInvokeFunction =
275275
SWIFT_CC(swiftasync)
276276
void (Job *);

include/swift/ABI/Task.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ class AsyncTask : public Job {
400400
public:
401401
/// Flag that the task is to be enqueued on the provided executor and actually
402402
/// enqueue it
403-
void flagAsAndEnqueueOnExecutor(ExecutorRef newExecutor);
403+
void flagAsAndEnqueueOnExecutor(SerialExecutorRef newExecutor);
404404

405405
/// Flag that this task is now completed. This normally does not do anything
406406
/// but can be used to locally insert logging.
@@ -790,7 +790,7 @@ class ContinuationAsyncContext : public AsyncContext {
790790

791791
/// The executor that should be resumed to.
792792
/// Public ABI.
793-
ExecutorRef ResumeToExecutor;
793+
SerialExecutorRef ResumeToExecutor;
794794

795795
#if defined(SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY)
796796
/// In a task-to-thread model, instead of voluntarily descheduling the task

include/swift/ABI/TaskOptions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ class TaskGroupTaskOptionRecord : public TaskOptionRecord {
8282
/// executor should be used instead, most often this may mean the global
8383
/// concurrent executor, or the enclosing actor's executor.
8484
class ExecutorTaskOptionRecord : public TaskOptionRecord {
85-
const ExecutorRef Executor;
85+
const SerialExecutorRef Executor;
8686

8787
public:
88-
ExecutorTaskOptionRecord(ExecutorRef executor)
88+
ExecutorTaskOptionRecord(SerialExecutorRef executor)
8989
: TaskOptionRecord(TaskOptionRecordKind::Executor),
9090
Executor(executor) {}
9191

92-
ExecutorRef getExecutor() const {
92+
SerialExecutorRef getExecutor() const {
9393
return Executor;
9494
}
9595

include/swift/ABI/TaskStatus.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ class TaskDependencyStatusRecord : public TaskStatusRecord {
321321
// (potentially intrusively), so that the appropriate escalation effect
322322
// (which may be different for each type of executor) can happen if a task
323323
// is escalated while enqueued.
324-
ExecutorRef Executor;
324+
SerialExecutorRef Executor;
325325
} DependentOn;
326326

327327
// Enum specifying the type of dependency this task has
@@ -359,7 +359,7 @@ class TaskDependencyStatusRecord : public TaskStatusRecord {
359359
DependentOn.TaskGroup = taskGroup;
360360
}
361361

362-
TaskDependencyStatusRecord(AsyncTask *waitingTask, ExecutorRef executor) :
362+
TaskDependencyStatusRecord(AsyncTask *waitingTask, SerialExecutorRef executor) :
363363
TaskStatusRecord(TaskStatusRecordKind::TaskDependency),
364364
DependencyKind(EnqueuedOnExecutor), WaitingTask(waitingTask) {
365365
DependentOn.Executor = executor;
@@ -369,7 +369,7 @@ class TaskDependencyStatusRecord : public TaskStatusRecord {
369369
return record->getKind() == TaskStatusRecordKind::TaskDependency;
370370
}
371371

372-
void updateDependencyToEnqueuedOn(ExecutorRef executor) {
372+
void updateDependencyToEnqueuedOn(SerialExecutorRef executor) {
373373
DependencyKind = EnqueuedOnExecutor;
374374
DependentOn.Executor = executor;
375375
}

include/swift/AST/Builtins.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ BUILTIN_MISC_OPERATION_WITH_SILGEN(Alignof, "alignof", "n", Special)
874874

875875
// getCurrentExecutor: () async -> Builtin.Executor?
876876
//
877-
// Retrieve the ExecutorRef on which the current asynchronous
877+
// Retrieve the SerialExecutorRef on which the current asynchronous
878878
// function is executing, or nil if the function isn't running
879879
// anywhere in particular.
880880
BUILTIN_MISC_OPERATION_WITH_SILGEN(GetCurrentExecutor, "getCurrentExecutor", "", Special)

include/swift/AST/Types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ class BuiltinRawUnsafeContinuationType : public BuiltinType {
16931693
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinRawUnsafeContinuationType, BuiltinType)
16941694

16951695
/// BuiltinExecutorType - The builtin executor-ref type. In C, this
1696-
/// is the ExecutorRef struct type.
1696+
/// is the SerialExecutorRef struct type.
16971697
class BuiltinExecutorType : public BuiltinType {
16981698
friend class ASTContext;
16991699
BuiltinExecutorType(const ASTContext &C)

include/swift/Runtime/Concurrency.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ void swift_task_localsCopyTo(AsyncTask* target);
660660
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swiftasync)
661661
void swift_task_switch(SWIFT_ASYNC_CONTEXT AsyncContext *resumeToContext,
662662
TaskContinuationFunction *resumeFunction,
663-
ExecutorRef newExecutor);
663+
SerialExecutorRef newExecutor);
664664

665665
/// Mark a task for enqueue on a new executor and then enqueue it.
666666
///
@@ -671,7 +671,7 @@ void swift_task_switch(SWIFT_ASYNC_CONTEXT AsyncContext *resumeToContext,
671671
/// synchronously when possible.
672672
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
673673
void
674-
swift_task_enqueueTaskOnExecutor(AsyncTask *task, ExecutorRef executor);
674+
swift_task_enqueueTaskOnExecutor(AsyncTask *task, SerialExecutorRef executor);
675675

676676
/// Enqueue the given job to run asynchronously on the given executor.
677677
///
@@ -681,7 +681,7 @@ swift_task_enqueueTaskOnExecutor(AsyncTask *task, ExecutorRef executor);
681681
/// Generally you should call swift_task_switch to switch execution
682682
/// synchronously when possible.
683683
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
684-
void swift_task_enqueue(Job *job, ExecutorRef executor);
684+
void swift_task_enqueue(Job *job, SerialExecutorRef executor);
685685

686686
/// Enqueue the given job to run asynchronously on the global
687687
/// execution pool.
@@ -716,7 +716,7 @@ bool swift_task_isOnExecutor(
716716
const SerialExecutorWitnessTable *wtable);
717717

718718
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
719-
bool swift_executor_isComplexEquality(ExecutorRef ref);
719+
bool swift_executor_isComplexEquality(SerialExecutorRef ref);
720720

721721
/// Return the 64bit TaskID (if the job is an AsyncTask),
722722
/// or the 32bits of the job Id otherwise.
@@ -886,27 +886,27 @@ void swift_task_asyncMainDrainQueue [[noreturn]]();
886886
/// Establish that the current thread is running as the given
887887
/// executor, then run a job.
888888
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
889-
void swift_job_run(Job *job, ExecutorRef executor);
889+
void swift_job_run(Job *job, SerialExecutorRef executor);
890890

891891
/// Return the current thread's active task reference.
892892
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
893893
AsyncTask *swift_task_getCurrent(void);
894894

895895
/// Return the current thread's active executor reference.
896896
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
897-
ExecutorRef swift_task_getCurrentExecutor(void);
897+
SerialExecutorRef swift_task_getCurrentExecutor(void);
898898

899899
/// Return the main-actor executor reference.
900900
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
901-
ExecutorRef swift_task_getMainExecutor(void);
901+
SerialExecutorRef swift_task_getMainExecutor(void);
902902

903903
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
904-
bool swift_task_isCurrentExecutor(ExecutorRef executor);
904+
bool swift_task_isCurrentExecutor(SerialExecutorRef executor);
905905

906906
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
907907
void swift_task_reportUnexpectedExecutor(
908908
const unsigned char *file, uintptr_t fileLength, bool fileIsASCII,
909-
uintptr_t line, ExecutorRef executor);
909+
uintptr_t line, SerialExecutorRef executor);
910910

911911
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
912912
JobPriority swift_task_getCurrentThreadPriority(void);

include/swift/Runtime/RuntimeFunctions.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,7 +2310,7 @@ FUNCTION(TaskCreate,
23102310

23112311
// void swift_task_switch(AsyncContext *resumeContext,
23122312
// TaskContinuationFunction *resumeFunction,
2313-
// ExecutorRef newExecutor);
2313+
// SerialExecutorRef newExecutor);
23142314
FUNCTION(TaskSwitchFunc,
23152315
swift_task_switch, SwiftAsyncCC,
23162316
ConcurrencyAvailability,
@@ -2372,7 +2372,7 @@ FUNCTION(ContinuationThrowingResumeWithError,
23722372
EFFECT(Concurrency),
23732373
UNKNOWN_MEMEFFECTS)
23742374

2375-
// ExecutorRef swift_task_getCurrentExecutor();
2375+
// SerialExecutorRef swift_task_getCurrentExecutor();
23762376
FUNCTION(TaskGetCurrentExecutor,
23772377
swift_task_getCurrentExecutor, SwiftCC,
23782378
ConcurrencyAvailability,
@@ -2382,7 +2382,7 @@ FUNCTION(TaskGetCurrentExecutor,
23822382
EFFECT(Concurrency),
23832383
MEMEFFECTS(ArgMemOnly))
23842384

2385-
// ExecutorRef swift_task_getMainExecutor();
2385+
// SerialExecutorRef swift_task_getMainExecutor();
23862386
FUNCTION(TaskGetMainExecutor,
23872387
swift_task_getMainExecutor, SwiftCC,
23882388
ConcurrencyAvailability,

include/swift/Strings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_UNSAFEVALUEBUFFER =
149149
/// The name of the Builtin type for Job
150150
constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_JOB = {
151151
"Builtin.Job"};
152-
/// The name of the Builtin type for ExecutorRef
152+
/// The name of the Builtin type for SerialExecutorRef
153153
constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_EXECUTOR = {
154154
"Builtin.Executor"};
155155
/// The name of the Builtin type for DefaultActorStorage

lib/IRGen/GenCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1925,7 +1925,7 @@ llvm::Type *SignatureExpansion::getErrorRegisterType() {
19251925

19261926
void SignatureExpansion::expandAsyncReturnType() {
19271927
// Build up the signature of the return continuation function.
1928-
// void (AsyncTask *, ExecutorRef, AsyncContext *, DirectResult0, ...,
1928+
// void (AsyncTask *, SerialExecutorRef, AsyncContext *, DirectResult0, ...,
19291929
// DirectResultN, Error*);
19301930
ResultIRType = IGM.VoidTy;
19311931
addAsyncParameters();

0 commit comments

Comments
 (0)