Skip to content

Commit 7418c1b

Browse files
authored
Merge pull request swiftlang#35908 from slavapestov/silgen-actor-cleanup
SILGen: Clean up emitLoadActorExecutorForCallee()
2 parents 2d37b84 + 4128211 commit 7418c1b

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4285,8 +4285,7 @@ bool SILGenModule::isNonMutatingSelfIndirect(SILDeclRef methodRef) {
42854285
return self.isFormalIndirect();
42864286
}
42874287

4288-
Optional<SILValue> SILGenFunction::EmitLoadActorExecutorForCallee(
4289-
SILGenFunction *SGF,
4288+
Optional<SILValue> SILGenFunction::emitLoadActorExecutorForCallee(
42904289
ValueDecl *calleeVD,
42914290
ArrayRef<ManagedValue> args) {
42924291
if (auto *funcDecl = dyn_cast_or_null<AbstractFunctionDecl>(calleeVD)) {
@@ -4300,11 +4299,11 @@ Optional<SILValue> SILGenFunction::EmitLoadActorExecutorForCallee(
43004299
case ActorIsolation::ActorInstance: {
43014300
assert(args.size() > 0 && "no self argument for actor-instance call?");
43024301
auto calleeSelf = args.back();
4303-
return calleeSelf.borrow(*SGF, SGF->F.getLocation()).getValue();
4302+
return calleeSelf.borrow(*this, F.getLocation()).getValue();
43044303
}
43054304

43064305
case ActorIsolation::GlobalActor:
4307-
return SGF->emitLoadGlobalActorExecutor(actorIso.getGlobalActor());
4306+
return emitLoadGlobalActorExecutor(actorIso.getGlobalActor());
43084307
}
43094308
}
43104309
return None;
@@ -4418,7 +4417,7 @@ RValue SILGenFunction::emitApply(ResultPlanPtr &&resultPlan,
44184417
assert(F.isAsync() && "cannot hop_to_executor in a non-async func!");
44194418

44204419
auto calleeVD = implicitlyAsyncApply.getValue();
4421-
auto maybeExecutor = EmitLoadActorExecutorForCallee(this, calleeVD, args);
4420+
auto maybeExecutor = emitLoadActorExecutorForCallee(calleeVD, args);
44224421

44234422
assert(maybeExecutor.hasValue());
44244423
B.createHopToExecutor(loc, maybeExecutor.getValue());

lib/SILGen/SILGenFunction.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -856,21 +856,20 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction
856856
// Concurrency
857857
//===--------------------------------------------------------------------===//
858858

859-
/// Generates code into the given SGF that obtains the callee function's
860-
/// executor, if the function is actor-isolated.
861-
/// @returns a SILValue representing the executor, if an executor exists.
862-
static Optional<SILValue> EmitLoadActorExecutorForCallee(
863-
SILGenFunction *SGF,
864-
ValueDecl *calleeVD,
865-
ArrayRef<ManagedValue> args);
859+
/// Generates code to obtain the callee function's executor, if the function
860+
/// is actor-isolated.
861+
///
862+
/// \returns a SILValue representing the executor, if an executor exists.
863+
Optional<SILValue> emitLoadActorExecutorForCallee(ValueDecl *calleeVD,
864+
ArrayRef<ManagedValue> args);
866865

867866
/// Generates code to obtain the executor given the actor's decl.
868-
/// @returns a SILValue representing the executor.
867+
/// \returns a SILValue representing the executor.
869868
SILValue emitLoadActorExecutor(VarDecl *actorDecl);
870869

871870
/// Generates the code to obtain the executor for the shared instance
872871
/// of the \p globalActor based on the type.
873-
/// @returns a SILValue representing the executor.
872+
/// \returns a SILValue representing the executor.
874873
SILValue emitLoadGlobalActorExecutor(Type globalActor);
875874

876875
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)