Skip to content

Commit aff7e30

Browse files
xedinktoso
authored andcommitted
[Distributed] SILGen: Remove isDistributed flags from accessor code
1 parent 35aec69 commit aff7e30

File tree

3 files changed

+20
-43
lines changed

3 files changed

+20
-43
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5366,7 +5366,6 @@ static Callee getBaseAccessorFunctionRef(SILGenFunction &SGF,
53665366
ArgumentSource &selfValue,
53675367
bool isSuper,
53685368
bool isDirectUse,
5369-
bool isDistributed,
53705369
SubstitutionMap subs,
53715370
bool isOnSelfParameter) {
53725371
auto *decl = cast<AbstractFunctionDecl>(constant.getDecl());
@@ -5446,13 +5445,12 @@ emitSpecializedAccessorFunctionRef(SILGenFunction &SGF,
54465445
ArgumentSource &selfValue,
54475446
bool isSuper,
54485447
bool isDirectUse,
5449-
bool isDistributed,
54505448
bool isOnSelfParameter)
54515449
{
54525450
// Get the accessor function. The type will be a polymorphic function if
54535451
// the Self type is generic.
54545452
Callee callee = getBaseAccessorFunctionRef(SGF, loc, constant, selfValue,
5455-
isSuper, isDirectUse, isDistributed,
5453+
isSuper, isDirectUse,
54565454
substitutions, isOnSelfParameter);
54575455

54585456
// Collect captures if the accessor has them.
@@ -5764,7 +5762,7 @@ SILDeclRef SILGenModule::getAccessorDeclRef(AccessorDecl *accessor) {
57645762
RValue SILGenFunction::emitGetAccessor(SILLocation loc, SILDeclRef get,
57655763
SubstitutionMap substitutions,
57665764
ArgumentSource &&selfValue, bool isSuper,
5767-
bool isDirectUse, bool isDistributed,
5765+
bool isDirectUse,
57685766
PreparedArguments &&subscriptIndices,
57695767
SGFContext c,
57705768
bool isOnSelfParameter) {
@@ -5773,7 +5771,7 @@ RValue SILGenFunction::emitGetAccessor(SILLocation loc, SILDeclRef get,
57735771

57745772
Callee getter = emitSpecializedAccessorFunctionRef(
57755773
*this, loc, get, substitutions, selfValue, isSuper, isDirectUse,
5776-
isDistributed, isOnSelfParameter);
5774+
isOnSelfParameter);
57775775
bool hasSelf = (bool)selfValue;
57785776
CanAnyFunctionType accessType = getter.getSubstFormalType();
57795777

@@ -5806,7 +5804,7 @@ void SILGenFunction::emitSetAccessor(SILLocation loc, SILDeclRef set,
58065804

58075805
Callee setter = emitSpecializedAccessorFunctionRef(
58085806
*this, loc, set, substitutions, selfValue, isSuper, isDirectUse,
5809-
/*isDistributed=*/false, isOnSelfParameter);
5807+
isOnSelfParameter);
58105808
bool hasSelf = (bool)selfValue;
58115809
CanAnyFunctionType accessType = setter.getSubstFormalType();
58125810

@@ -5841,14 +5839,14 @@ void SILGenFunction::emitSetAccessor(SILLocation loc, SILDeclRef set,
58415839
ManagedValue SILGenFunction::emitAddressorAccessor(
58425840
SILLocation loc, SILDeclRef addressor, SubstitutionMap substitutions,
58435841
ArgumentSource &&selfValue, bool isSuper, bool isDirectUse,
5844-
bool isDistributed, PreparedArguments &&subscriptIndices,
5842+
PreparedArguments &&subscriptIndices,
58455843
SILType addressType, bool isOnSelfParameter) {
58465844
// Scope any further writeback just within this operation.
58475845
FormalEvaluationScope writebackScope(*this);
58485846

58495847
Callee callee = emitSpecializedAccessorFunctionRef(
58505848
*this, loc, addressor, substitutions, selfValue, isSuper, isDirectUse,
5851-
isDistributed, isOnSelfParameter);
5849+
isOnSelfParameter);
58525850
bool hasSelf = (bool)selfValue;
58535851
CanAnyFunctionType accessType = callee.getSubstFormalType();
58545852

@@ -5904,7 +5902,6 @@ SILGenFunction::emitCoroutineAccessor(SILLocation loc, SILDeclRef accessor,
59045902
emitSpecializedAccessorFunctionRef(*this, loc, accessor,
59055903
substitutions, selfValue,
59065904
isSuper, isDirectUse,
5907-
/*isDistributed=*/false,
59085905
isOnSelfParameter);
59095906

59105907
// We're already in a full formal-evaluation scope.

lib/SILGen/SILGenFunction.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,6 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction
14441444
SubstitutionMap substitutions,
14451445
ArgumentSource &&optionalSelfValue, bool isSuper,
14461446
bool isDirectAccessorUse,
1447-
bool isDistributed,
14481447
PreparedArguments &&optionalSubscripts, SGFContext C,
14491448
bool isOnSelfParameter);
14501449

@@ -1478,7 +1477,7 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction
14781477
ManagedValue emitAddressorAccessor(
14791478
SILLocation loc, SILDeclRef addressor, SubstitutionMap substitutions,
14801479
ArgumentSource &&optionalSelfValue, bool isSuper,
1481-
bool isDirectAccessorUse, bool isDistributed,
1480+
bool isDirectAccessorUse,
14821481
PreparedArguments &&optionalSubscripts,
14831482
SILType addressType, bool isOnSelfParameter);
14841483

lib/SILGen/SILGenLValue.cpp

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,6 @@ namespace {
12911291
SILDeclRef Accessor;
12921292
bool IsSuper;
12931293
bool IsDirectAccessorUse;
1294-
bool IsDistributedAccessor;
12951294
bool IsOnSelfParameter;
12961295
SubstitutionMap Substitutions;
12971296
Optional<ActorIsolation> ActorIso;
@@ -1301,7 +1300,6 @@ namespace {
13011300
AbstractStorageDecl *decl, SILDeclRef accessor,
13021301
bool isSuper,
13031302
bool isDirectAccessorUse,
1304-
bool isDistributedAccessor,
13051303
SubstitutionMap substitutions,
13061304
CanType baseFormalType, LValueTypeData typeData,
13071305
ArgumentList *argListForDiagnostics,
@@ -1312,7 +1310,6 @@ namespace {
13121310
std::move(indices)),
13131311
Accessor(accessor), IsSuper(isSuper),
13141312
IsDirectAccessorUse(isDirectAccessorUse),
1315-
IsDistributedAccessor(isDistributedAccessor),
13161313
IsOnSelfParameter(isOnSelfParameter),
13171314
Substitutions(substitutions),
13181315
ActorIso(actorIso) {}
@@ -1324,7 +1321,6 @@ namespace {
13241321
Accessor(copied.Accessor),
13251322
IsSuper(copied.IsSuper),
13261323
IsDirectAccessorUse(copied.IsDirectAccessorUse),
1327-
IsDistributedAccessor(copied.IsDistributedAccessor),
13281324
IsOnSelfParameter(copied.IsOnSelfParameter),
13291325
Substitutions(copied.Substitutions),
13301326
ActorIso(copied.ActorIso) {}
@@ -1342,7 +1338,6 @@ namespace {
13421338
SILDeclRef accessor,
13431339
bool isSuper,
13441340
bool isDirectAccessorUse,
1345-
bool isDistributedAccessor,
13461341
SubstitutionMap substitutions,
13471342
CanType baseFormalType,
13481343
LValueTypeData typeData,
@@ -1351,8 +1346,7 @@ namespace {
13511346
bool isOnSelfParameter,
13521347
Optional<ActorIsolation> actorIso)
13531348
: AccessorBasedComponent(GetterSetterKind, decl, accessor, isSuper,
1354-
isDirectAccessorUse, isDistributedAccessor,
1355-
substitutions,
1349+
isDirectAccessorUse, substitutions,
13561350
baseFormalType, typeData, subscriptArgList,
13571351
std::move(indices), isOnSelfParameter,
13581352
actorIso)
@@ -1467,7 +1461,6 @@ namespace {
14671461
ArgumentSource &&value, ManagedValue base) && override {
14681462
assert(getAccessorDecl()->isSetter());
14691463
assert(!ActorIso && "no support for cross-actor set operations");
1470-
assert(!IsDistributedAccessor && "setters cannot be 'distributed'");
14711464
SILDeclRef setter = Accessor;
14721465

14731466
if (canRewriteSetAsPropertyWrapperInit(SGF) &&
@@ -1661,7 +1654,7 @@ namespace {
16611654

16621655
rvalue = SGF.emitGetAccessor(
16631656
loc, getter, Substitutions, std::move(args.base), IsSuper,
1664-
IsDirectAccessorUse, IsDistributedAccessor, std::move(args.Indices), c,
1657+
IsDirectAccessorUse, std::move(args.Indices), c,
16651658
IsOnSelfParameter);
16661659

16671660
} // End the evaluation scope before any hop back to the current executor.
@@ -1806,14 +1799,13 @@ namespace {
18061799
AddressorComponent(AbstractStorageDecl *decl, SILDeclRef accessor,
18071800
bool isSuper,
18081801
bool isDirectAccessorUse,
1809-
bool isDistributed,
18101802
SubstitutionMap substitutions,
18111803
CanType baseFormalType, LValueTypeData typeData,
18121804
SILType substFieldType,
18131805
ArgumentList *argListForDiagnostics,
18141806
PreparedArguments &&indices, bool isOnSelfParameter)
18151807
: AccessorBasedComponent(AddressorKind, decl, accessor, isSuper,
1816-
isDirectAccessorUse, isDistributed,
1808+
isDirectAccessorUse,
18171809
substitutions,
18181810
baseFormalType, typeData,
18191811
argListForDiagnostics, std::move(indices),
@@ -1836,7 +1828,7 @@ namespace {
18361828
std::move(*this).prepareAccessorArgs(SGF, loc, base, Accessor);
18371829
addr = SGF.emitAddressorAccessor(
18381830
loc, Accessor, Substitutions, std::move(args.base), IsSuper,
1839-
IsDirectAccessorUse, IsDistributedAccessor, std::move(args.Indices),
1831+
IsDirectAccessorUse, std::move(args.Indices),
18401832
SubstFieldType, IsOnSelfParameter);
18411833
}
18421834

@@ -1929,7 +1921,7 @@ namespace {
19291921
bool isOnSelfParameter)
19301922
: AccessorBasedComponent(
19311923
CoroutineAccessorKind, decl, accessor, isSuper,
1932-
isDirectAccessorUse, /*isDistributed=*/false,
1924+
isDirectAccessorUse,
19331925
substitutions, baseFormalType, typeData,
19341926
argListForDiagnostics, std::move(indices), isOnSelfParameter) {}
19351927

@@ -2656,7 +2648,6 @@ namespace {
26562648

26572649
void emitUsingStrategy(AccessStrategy strategy) {
26582650
auto var = dyn_cast<VarDecl>(Storage);
2659-
bool isDistributed = var && var->isDistributed();
26602651

26612652
switch (strategy.getKind()) {
26622653
case AccessStrategy::Storage: {
@@ -2669,13 +2660,11 @@ namespace {
26692660
case AccessStrategy::DirectToAccessor:
26702661
return asImpl()
26712662
.emitUsingAccessor(strategy.getAccessor(),
2672-
/*isDirect=*/true,
2673-
isDistributed);
2663+
/*isDirect=*/true);
26742664

26752665
case AccessStrategy::DispatchToAccessor:
26762666
return asImpl().emitUsingAccessor(strategy.getAccessor(),
2677-
/*isDirect=*/false,
2678-
isDistributed);
2667+
/*isDirect=*/false);
26792668

26802669
case AccessStrategy::MaterializeToTemporary: {
26812670
auto typeData = getLogicalStorageTypeData(
@@ -2689,25 +2678,22 @@ namespace {
26892678
}
26902679

26912680
void emitUsingAccessor(AccessorKind accessorKind,
2692-
bool isDirect,
2693-
bool isDistributed) {
2681+
bool isDirect) {
26942682
auto accessor =
26952683
SGF.SGM.getAccessorDeclRef(Storage->getOpaqueAccessor(accessorKind));
26962684

26972685
switch (accessorKind) {
26982686
case AccessorKind::Set: {
2699-
assert(!isDistributed && "setters must not be 'distributed'");
27002687
LLVM_FALLTHROUGH;
27012688
}
27022689
case AccessorKind::Get: {
27032690
auto typeData = getLogicalStorageTypeData(
27042691
SGF.getTypeExpansionContext(), SGF.SGM, AccessKind, FormalRValueType);
2705-
return asImpl().emitUsingGetterSetter(accessor, isDirect, isDistributed, typeData);
2692+
return asImpl().emitUsingGetterSetter(accessor, isDirect, typeData);
27062693
}
27072694

27082695
case AccessorKind::Address:
27092696
case AccessorKind::MutableAddress: {
2710-
assert(!isDistributed);
27112697
auto typeData =
27122698
getPhysicalStorageTypeData(SGF.getTypeExpansionContext(), SGF.SGM,
27132699
AccessKind, Storage, FormalRValueType);
@@ -2716,7 +2702,6 @@ namespace {
27162702

27172703
case AccessorKind::Read:
27182704
case AccessorKind::Modify: {
2719-
assert(!isDistributed);
27202705
auto typeData =
27212706
getPhysicalStorageTypeData(SGF.getTypeExpansionContext(), SGF.SGM,
27222707
AccessKind, Storage, FormalRValueType);
@@ -2811,8 +2796,7 @@ void LValue::addNonMemberVarComponent(SILGenFunction &SGF, SILLocation loc,
28112796
SILType storageType =
28122797
SGF.getLoweredType(Storage->getType()).getAddressType();
28132798
LV.add<AddressorComponent>(Storage, addressor,
2814-
/*isSuper=*/false, isDirect,
2815-
/*isDistributed=*/false, Subs,
2799+
/*isSuper=*/false, isDirect, Subs,
28162800
CanType(), typeData, storageType, nullptr,
28172801
PreparedArguments(),
28182802
/* isOnSelfParameter */ false);
@@ -2829,11 +2813,10 @@ void LValue::addNonMemberVarComponent(SILGenFunction &SGF, SILLocation loc,
28292813

28302814
void emitUsingGetterSetter(SILDeclRef accessor,
28312815
bool isDirect,
2832-
bool isDistributed,
28332816
LValueTypeData typeData) {
28342817
LV.add<GetterSetterComponent>(
28352818
Storage, accessor,
2836-
/*isSuper=*/false, isDirect, isDistributed, Subs, CanType(), typeData,
2819+
/*isSuper=*/false, isDirect, Subs, CanType(), typeData,
28372820
nullptr, PreparedArguments(),
28382821
/*isOnSelfParameter=*/false,
28392822
ActorIso);
@@ -3309,8 +3292,7 @@ struct MemberStorageAccessEmitter : AccessEmitter<Impl, StorageType> {
33093292
SILType varStorageType = SGF.SGM.Types.getSubstitutedStorageType(
33103293
SGF.getTypeExpansionContext(), Storage, FormalRValueType);
33113294

3312-
LV.add<AddressorComponent>(Storage, addressor, IsSuper, isDirect,
3313-
/*isDistributed=*/false, Subs,
3295+
LV.add<AddressorComponent>(Storage, addressor, IsSuper, isDirect, Subs,
33143296
BaseFormalType, typeData, varStorageType,
33153297
ArgListForDiagnostics, std::move(Indices),
33163298
IsOnSelfParameter);
@@ -3326,10 +3308,9 @@ struct MemberStorageAccessEmitter : AccessEmitter<Impl, StorageType> {
33263308

33273309
void emitUsingGetterSetter(SILDeclRef accessor,
33283310
bool isDirect,
3329-
bool isDistributed,
33303311
LValueTypeData typeData) {
33313312
LV.add<GetterSetterComponent>(
3332-
Storage, accessor, IsSuper, isDirect, isDistributed, Subs,
3313+
Storage, accessor, IsSuper, isDirect, Subs,
33333314
BaseFormalType, typeData, ArgListForDiagnostics, std::move(Indices),
33343315
IsOnSelfParameter, ActorIso);
33353316
}

0 commit comments

Comments
 (0)