@@ -75,7 +75,7 @@ class DistributedAccessor {
75
75
IRGenFunction &IGF;
76
76
77
77
// / Underlying distributed method for this accessor.
78
- SILFunction *Method ;
78
+ SILFunction *Target ;
79
79
80
80
// / The interface type of this accessor function.
81
81
CanSILFunctionType AccessorType;
@@ -86,25 +86,25 @@ class DistributedAccessor {
86
86
SmallVector<AllocationInfo, 4 > AllocatedArguments;
87
87
88
88
public:
89
- DistributedAccessor (IRGenFunction &IGF, SILFunction *method ,
89
+ DistributedAccessor (IRGenFunction &IGF, SILFunction *target ,
90
90
CanSILFunctionType accessorTy);
91
91
92
92
void emit ();
93
93
94
94
private:
95
95
void computeArguments (llvm::Value *argumentBuffer, Explosion &arguments);
96
96
97
- FunctionPointer getPointerToMethod () const ;
97
+ FunctionPointer getPointerToTarget () const ;
98
98
99
- Callee getCalleeForDistributedMethod (llvm::Value *self) const ;
99
+ Callee getCalleeForDistributedTarget (llvm::Value *self) const ;
100
100
};
101
101
102
102
} // end namespace
103
103
104
104
// / Compute a type of a distributed method accessor function based
105
105
// / on the provided distributed method.
106
106
static CanSILFunctionType getAccessorType (IRGenModule &IGM,
107
- SILFunction *DistMethod ) {
107
+ SILFunction *Target ) {
108
108
auto &Context = IGM.Context ;
109
109
110
110
auto getRawPointerParmeter = [&]() {
@@ -120,10 +120,10 @@ static CanSILFunctionType getAccessorType(IRGenModule &IGM,
120
120
.withAsync ()
121
121
.build ();
122
122
123
- auto methodTy = DistMethod ->getLoweredFunctionType ();
123
+ auto targetTy = Target ->getLoweredFunctionType ();
124
124
125
- assert (methodTy ->isAsync ());
126
- assert (methodTy ->hasErrorResult ());
125
+ assert (targetTy ->isAsync ());
126
+ assert (targetTy ->hasErrorResult ());
127
127
128
128
// Accessor gets argument value buffer and a reference to `self` of
129
129
// the actor and produces a call to the distributed thunk forwarding
@@ -133,18 +133,18 @@ static CanSILFunctionType getAccessorType(IRGenModule &IGM,
133
133
ParameterConvention::Direct_Guaranteed,
134
134
{/* argumentBuffer=*/ getRawPointerParmeter (),
135
135
/* resultBuffer=*/ getRawPointerParmeter (),
136
- /* actor=*/ methodTy ->getParameters ().back ()},
136
+ /* actor=*/ targetTy ->getParameters ().back ()},
137
137
/* Yields=*/ {},
138
138
/* Results=*/ {},
139
- /* ErrorResult=*/ methodTy ->getErrorResult (),
139
+ /* ErrorResult=*/ targetTy ->getErrorResult (),
140
140
/* patternSubs=*/ SubstitutionMap (),
141
141
/* invocationSubs=*/ SubstitutionMap (), Context);
142
142
}
143
143
144
144
llvm::Function *
145
- IRGenModule::getAddrOfDistributedMethodAccessor (SILFunction *F,
145
+ IRGenModule::getAddrOfDistributedTargetAccessor (SILFunction *F,
146
146
ForDefinition_t forDefinition) {
147
- auto entity = LinkEntity::forDistributedMethodAccessor (F);
147
+ auto entity = LinkEntity::forDistributedTargetAccessor (F);
148
148
149
149
llvm::Function *&entry = GlobalFuncs[entity];
150
150
if (entry) {
@@ -159,21 +159,21 @@ IRGenModule::getAddrOfDistributedMethodAccessor(SILFunction *F,
159
159
return createFunction (*this , link, signature);
160
160
}
161
161
162
- void IRGenModule::emitDistributedMethodAccessor (SILFunction *method ) {
163
- assert (method ->isDistributed ());
162
+ void IRGenModule::emitDistributedTargetAccessor (SILFunction *target ) {
163
+ assert (target ->isDistributed ());
164
164
165
- auto *f = getAddrOfDistributedMethodAccessor (method , ForDefinition);
165
+ auto *f = getAddrOfDistributedTargetAccessor (target , ForDefinition);
166
166
if (!f->isDeclaration ())
167
167
return ;
168
168
169
169
IRGenFunction IGF (*this , f);
170
- DistributedAccessor (IGF, method , getAccessorType (*this , method )).emit ();
170
+ DistributedAccessor (IGF, target , getAccessorType (*this , target )).emit ();
171
171
}
172
172
173
173
DistributedAccessor::DistributedAccessor (IRGenFunction &IGF,
174
- SILFunction *method ,
174
+ SILFunction *target ,
175
175
CanSILFunctionType accessorTy)
176
- : IGM(IGF.IGM), IGF(IGF), Method(method ), AccessorType(accessorTy),
176
+ : IGM(IGF.IGM), IGF(IGF), Target(target ), AccessorType(accessorTy),
177
177
AsyncLayout(getAsyncContextLayout(
178
178
IGM, AccessorType, AccessorType, SubstitutionMap(),
179
179
/* suppress generics*/ true,
@@ -182,7 +182,7 @@ DistributedAccessor::DistributedAccessor(IRGenFunction &IGF,
182
182
183
183
void DistributedAccessor::computeArguments (llvm::Value *argumentBuffer,
184
184
Explosion &arguments) {
185
- auto fnType = Method ->getLoweredFunctionType ();
185
+ auto fnType = Target ->getLoweredFunctionType ();
186
186
187
187
// Cover all of the arguments except to `self` of the actor.
188
188
auto parameters = fnType->getParameters ().drop_back ();
@@ -283,8 +283,8 @@ void DistributedAccessor::computeArguments(llvm::Value *argumentBuffer,
283
283
}
284
284
285
285
void DistributedAccessor::emit () {
286
- auto methodTy = Method ->getLoweredFunctionType ();
287
- SILFunctionConventions targetConv (methodTy , IGF.getSILModule ());
286
+ auto targetTy = Target ->getLoweredFunctionType ();
287
+ SILFunctionConventions targetConv (targetTy , IGF.getSILModule ());
288
288
SILFunctionConventions accessorConv (AccessorType, IGF.getSILModule ());
289
289
TypeExpansionContext expansionContext = IGM.getMaximalTypeExpansionContext ();
290
290
@@ -306,7 +306,7 @@ void DistributedAccessor::emit() {
306
306
// Reference to a `self` of the actor to be called.
307
307
auto *actorSelf = params.claimNext ();
308
308
309
- GenericContextScope scope (IGM, methodTy ->getInvocationGenericSignature ());
309
+ GenericContextScope scope (IGM, targetTy ->getInvocationGenericSignature ());
310
310
311
311
// Preliminary: Setup async context for this accessor.
312
312
{
@@ -315,7 +315,7 @@ void DistributedAccessor::emit() {
315
315
/* useSpecialConvention*/ false )
316
316
.getAsyncContextIndex ();
317
317
318
- auto entity = LinkEntity::forDistributedMethodAccessor (Method );
318
+ auto entity = LinkEntity::forDistributedTargetAccessor (Target );
319
319
emitAsyncFunctionEntry (IGF, AsyncLayout, entity, asyncContextIdx);
320
320
emitAsyncFunctionPointer (IGM, IGF.CurFn , entity, AsyncLayout.getSize ());
321
321
}
@@ -341,7 +341,7 @@ void DistributedAccessor::emit() {
341
341
Explosion result;
342
342
Explosion error;
343
343
344
- auto callee = getCalleeForDistributedMethod (actorSelf);
344
+ auto callee = getCalleeForDistributedTarget (actorSelf);
345
345
auto emission =
346
346
getCallEmission (IGF, callee.getSwiftContext (), std::move (callee));
347
347
@@ -363,7 +363,7 @@ void DistributedAccessor::emit() {
363
363
// Both accessor and distributed method are always `async throws`
364
364
// so we need to load error value (if any) from the slot.
365
365
{
366
- assert (methodTy ->hasErrorResult ());
366
+ assert (targetTy ->hasErrorResult ());
367
367
368
368
SILType errorType = accessorConv.getSILErrorType (expansionContext);
369
369
Address calleeErrorSlot =
@@ -386,23 +386,23 @@ void DistributedAccessor::emit() {
386
386
}
387
387
}
388
388
389
- FunctionPointer DistributedAccessor::getPointerToMethod () const {
390
- auto fnType = Method ->getLoweredFunctionType ();
391
- auto fpKind = classifyFunctionPointerKind (Method );
389
+ FunctionPointer DistributedAccessor::getPointerToTarget () const {
390
+ auto fnType = Target ->getLoweredFunctionType ();
391
+ auto fpKind = classifyFunctionPointerKind (Target );
392
392
auto signature = IGM.getSignature (fnType, fpKind.useSpecialConvention ());
393
393
394
394
auto *fnPtr =
395
- llvm::ConstantExpr::getBitCast (IGM.getAddrOfAsyncFunctionPointer (Method ),
395
+ llvm::ConstantExpr::getBitCast (IGM.getAddrOfAsyncFunctionPointer (Target ),
396
396
signature.getType ()->getPointerTo ());
397
397
398
398
return FunctionPointer::forDirect (
399
399
FunctionPointer::Kind (fnType), fnPtr,
400
- IGM.getAddrOfSILFunction (Method , NotForDefinition), signature);
400
+ IGM.getAddrOfSILFunction (Target , NotForDefinition), signature);
401
401
}
402
402
403
403
Callee
404
- DistributedAccessor::getCalleeForDistributedMethod (llvm::Value *self) const {
405
- auto fnType = Method ->getLoweredFunctionType ();
404
+ DistributedAccessor::getCalleeForDistributedTarget (llvm::Value *self) const {
405
+ auto fnType = Target ->getLoweredFunctionType ();
406
406
CalleeInfo info{fnType, fnType, SubstitutionMap ()};
407
- return {std::move (info), getPointerToMethod (), self};
407
+ return {std::move (info), getPointerToTarget (), self};
408
408
}
0 commit comments