Skip to content

Commit b2c6635

Browse files
xedinktoso
authored andcommitted
[Distributed] SILGen: Remove isDistributed flags from accessor code
1 parent fde104d commit b2c6635

File tree

3 files changed

+21
-46
lines changed

3 files changed

+21
-46
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: 14 additions & 35 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

@@ -2655,8 +2647,6 @@ namespace {
26552647
AccessKind(accessKind) {}
26562648

26572649
void emitUsingStrategy(AccessStrategy strategy) {
2658-
bool isDistributed = var && var->isDistributed();
2659-
26602650
switch (strategy.getKind()) {
26612651
case AccessStrategy::Storage: {
26622652
auto typeData =
@@ -2668,13 +2658,11 @@ namespace {
26682658
case AccessStrategy::DirectToAccessor:
26692659
return asImpl()
26702660
.emitUsingAccessor(strategy.getAccessor(),
2671-
/*isDirect=*/true,
2672-
isDistributed);
2661+
/*isDirect=*/true);
26732662

26742663
case AccessStrategy::DispatchToAccessor:
26752664
return asImpl().emitUsingAccessor(strategy.getAccessor(),
2676-
/*isDirect=*/false,
2677-
isDistributed);
2665+
/*isDirect=*/false);
26782666

26792667
case AccessStrategy::MaterializeToTemporary: {
26802668
auto typeData = getLogicalStorageTypeData(
@@ -2691,25 +2679,22 @@ namespace {
26912679
}
26922680

26932681
void emitUsingAccessor(AccessorKind accessorKind,
2694-
bool isDirect,
2695-
bool isDistributed) {
2682+
bool isDirect) {
26962683
auto accessor =
26972684
SGF.SGM.getAccessorDeclRef(Storage->getOpaqueAccessor(accessorKind));
26982685

26992686
switch (accessorKind) {
27002687
case AccessorKind::Set: {
2701-
assert(!isDistributed && "setters must not be 'distributed'");
27022688
LLVM_FALLTHROUGH;
27032689
}
27042690
case AccessorKind::Get: {
27052691
auto typeData = getLogicalStorageTypeData(
27062692
SGF.getTypeExpansionContext(), SGF.SGM, AccessKind, FormalRValueType);
2707-
return asImpl().emitUsingGetterSetter(accessor, isDirect, isDistributed, typeData);
2693+
return asImpl().emitUsingGetterSetter(accessor, isDirect, typeData);
27082694
}
27092695

27102696
case AccessorKind::Address:
27112697
case AccessorKind::MutableAddress: {
2712-
assert(!isDistributed);
27132698
auto typeData =
27142699
getPhysicalStorageTypeData(SGF.getTypeExpansionContext(), SGF.SGM,
27152700
AccessKind, Storage, FormalRValueType);
@@ -2718,7 +2703,6 @@ namespace {
27182703

27192704
case AccessorKind::Read:
27202705
case AccessorKind::Modify: {
2721-
assert(!isDistributed);
27222706
auto typeData =
27232707
getPhysicalStorageTypeData(SGF.getTypeExpansionContext(), SGF.SGM,
27242708
AccessKind, Storage, FormalRValueType);
@@ -2813,8 +2797,7 @@ void LValue::addNonMemberVarComponent(SILGenFunction &SGF, SILLocation loc,
28132797
SILType storageType =
28142798
SGF.getLoweredType(Storage->getType()).getAddressType();
28152799
LV.add<AddressorComponent>(Storage, addressor,
2816-
/*isSuper=*/false, isDirect,
2817-
/*isDistributed=*/false, Subs,
2800+
/*isSuper=*/false, isDirect, Subs,
28182801
CanType(), typeData, storageType, nullptr,
28192802
PreparedArguments(),
28202803
/* isOnSelfParameter */ false);
@@ -2831,11 +2814,10 @@ void LValue::addNonMemberVarComponent(SILGenFunction &SGF, SILLocation loc,
28312814

28322815
void emitUsingGetterSetter(SILDeclRef accessor,
28332816
bool isDirect,
2834-
bool isDistributed,
28352817
LValueTypeData typeData) {
28362818
LV.add<GetterSetterComponent>(
28372819
Storage, accessor,
2838-
/*isSuper=*/false, isDirect, isDistributed, Subs, CanType(), typeData,
2820+
/*isSuper=*/false, isDirect, Subs, CanType(), typeData,
28392821
nullptr, PreparedArguments(),
28402822
/*isOnSelfParameter=*/false,
28412823
ActorIso);
@@ -3316,8 +3298,7 @@ struct MemberStorageAccessEmitter : AccessEmitter<Impl, StorageType> {
33163298
SILType varStorageType = SGF.SGM.Types.getSubstitutedStorageType(
33173299
SGF.getTypeExpansionContext(), Storage, FormalRValueType);
33183300

3319-
LV.add<AddressorComponent>(Storage, addressor, IsSuper, isDirect,
3320-
/*isDistributed=*/false, Subs,
3301+
LV.add<AddressorComponent>(Storage, addressor, IsSuper, isDirect, Subs,
33213302
BaseFormalType, typeData, varStorageType,
33223303
ArgListForDiagnostics, std::move(Indices),
33233304
IsOnSelfParameter);
@@ -3333,10 +3314,9 @@ struct MemberStorageAccessEmitter : AccessEmitter<Impl, StorageType> {
33333314

33343315
void emitUsingGetterSetter(SILDeclRef accessor,
33353316
bool isDirect,
3336-
bool isDistributed,
33373317
LValueTypeData typeData) {
33383318
LV.add<GetterSetterComponent>(
3339-
Storage, accessor, IsSuper, isDirect, isDistributed, Subs,
3319+
Storage, accessor, IsSuper, isDirect, Subs,
33403320
BaseFormalType, typeData, ArgListForDiagnostics, std::move(Indices),
33413321
IsOnSelfParameter, ActorIso);
33423322
}
@@ -3412,8 +3392,7 @@ void LValue::addMemberVarComponent(SILGenFunction &SGF, SILLocation loc,
34123392
auto typeData = getLogicalStorageTypeData(
34133393
SGF.getTypeExpansionContext(), SGF.SGM, AccessKind, FormalRValueType);
34143394

3415-
asImpl().emitUsingGetterSetter(accessor, /*isDirect=*/false,
3416-
/*isDistributed=*/true, typeData);
3395+
asImpl().emitUsingGetterSetter(accessor, /*isDirect=*/false, typeData);
34173396
}
34183397

34193398
} emitter(SGF, loc, var, subs, isSuper, accessKind,

0 commit comments

Comments
 (0)