Skip to content

Commit 5b23c7d

Browse files
committed
[Distributed] SILGen: Remove isDistributed flags from accessor code
1 parent 63b3c2b commit 5b23c7d

File tree

3 files changed

+21
-45
lines changed

3 files changed

+21
-45
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5375,7 +5375,6 @@ static Callee getBaseAccessorFunctionRef(SILGenFunction &SGF,
53755375
ArgumentSource &selfValue,
53765376
bool isSuper,
53775377
bool isDirectUse,
5378-
bool isDistributed,
53795378
SubstitutionMap subs,
53805379
bool isOnSelfParameter) {
53815380
auto *decl = cast<AbstractFunctionDecl>(constant.getDecl());
@@ -5455,13 +5454,12 @@ emitSpecializedAccessorFunctionRef(SILGenFunction &SGF,
54555454
ArgumentSource &selfValue,
54565455
bool isSuper,
54575456
bool isDirectUse,
5458-
bool isDistributed,
54595457
bool isOnSelfParameter)
54605458
{
54615459
// Get the accessor function. The type will be a polymorphic function if
54625460
// the Self type is generic.
54635461
Callee callee = getBaseAccessorFunctionRef(SGF, loc, constant, selfValue,
5464-
isSuper, isDirectUse, isDistributed,
5462+
isSuper, isDirectUse,
54655463
substitutions, isOnSelfParameter);
54665464

54675465
// Collect captures if the accessor has them.
@@ -5773,7 +5771,7 @@ SILDeclRef SILGenModule::getAccessorDeclRef(AccessorDecl *accessor) {
57735771
RValue SILGenFunction::emitGetAccessor(SILLocation loc, SILDeclRef get,
57745772
SubstitutionMap substitutions,
57755773
ArgumentSource &&selfValue, bool isSuper,
5776-
bool isDirectUse, bool isDistributed,
5774+
bool isDirectUse,
57775775
PreparedArguments &&subscriptIndices,
57785776
SGFContext c,
57795777
bool isOnSelfParameter) {
@@ -5782,7 +5780,7 @@ RValue SILGenFunction::emitGetAccessor(SILLocation loc, SILDeclRef get,
57825780

57835781
Callee getter = emitSpecializedAccessorFunctionRef(
57845782
*this, loc, get, substitutions, selfValue, isSuper, isDirectUse,
5785-
isDistributed, isOnSelfParameter);
5783+
isOnSelfParameter);
57865784
bool hasSelf = (bool)selfValue;
57875785
CanAnyFunctionType accessType = getter.getSubstFormalType();
57885786

@@ -5815,7 +5813,7 @@ void SILGenFunction::emitSetAccessor(SILLocation loc, SILDeclRef set,
58155813

58165814
Callee setter = emitSpecializedAccessorFunctionRef(
58175815
*this, loc, set, substitutions, selfValue, isSuper, isDirectUse,
5818-
/*isDistributed=*/false, isOnSelfParameter);
5816+
isOnSelfParameter);
58195817
bool hasSelf = (bool)selfValue;
58205818
CanAnyFunctionType accessType = setter.getSubstFormalType();
58215819

@@ -5850,14 +5848,14 @@ void SILGenFunction::emitSetAccessor(SILLocation loc, SILDeclRef set,
58505848
ManagedValue SILGenFunction::emitAddressorAccessor(
58515849
SILLocation loc, SILDeclRef addressor, SubstitutionMap substitutions,
58525850
ArgumentSource &&selfValue, bool isSuper, bool isDirectUse,
5853-
bool isDistributed, PreparedArguments &&subscriptIndices,
5851+
PreparedArguments &&subscriptIndices,
58545852
SILType addressType, bool isOnSelfParameter) {
58555853
// Scope any further writeback just within this operation.
58565854
FormalEvaluationScope writebackScope(*this);
58575855

58585856
Callee callee = emitSpecializedAccessorFunctionRef(
58595857
*this, loc, addressor, substitutions, selfValue, isSuper, isDirectUse,
5860-
isDistributed, isOnSelfParameter);
5858+
isOnSelfParameter);
58615859
bool hasSelf = (bool)selfValue;
58625860
CanAnyFunctionType accessType = callee.getSubstFormalType();
58635861

@@ -5913,7 +5911,6 @@ SILGenFunction::emitCoroutineAccessor(SILLocation loc, SILDeclRef accessor,
59135911
emitSpecializedAccessorFunctionRef(*this, loc, accessor,
59145912
substitutions, selfValue,
59155913
isSuper, isDirectUse,
5916-
/*isDistributed=*/false,
59175914
isOnSelfParameter);
59185915

59195916
// 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 & 34 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(
@@ -2692,25 +2681,22 @@ namespace {
26922681
}
26932682

26942683
void emitUsingAccessor(AccessorKind accessorKind,
2695-
bool isDirect,
2696-
bool isDistributed) {
2684+
bool isDirect) {
26972685
auto accessor =
26982686
SGF.SGM.getAccessorDeclRef(Storage->getOpaqueAccessor(accessorKind));
26992687

27002688
switch (accessorKind) {
27012689
case AccessorKind::Set: {
2702-
assert(!isDistributed && "setters must not be 'distributed'");
27032690
LLVM_FALLTHROUGH;
27042691
}
27052692
case AccessorKind::Get: {
27062693
auto typeData = getLogicalStorageTypeData(
27072694
SGF.getTypeExpansionContext(), SGF.SGM, AccessKind, FormalRValueType);
2708-
return asImpl().emitUsingGetterSetter(accessor, isDirect, isDistributed, typeData);
2695+
return asImpl().emitUsingGetterSetter(accessor, isDirect, typeData);
27092696
}
27102697

27112698
case AccessorKind::Address:
27122699
case AccessorKind::MutableAddress: {
2713-
assert(!isDistributed);
27142700
auto typeData =
27152701
getPhysicalStorageTypeData(SGF.getTypeExpansionContext(), SGF.SGM,
27162702
AccessKind, Storage, FormalRValueType);
@@ -2719,7 +2705,6 @@ namespace {
27192705

27202706
case AccessorKind::Read:
27212707
case AccessorKind::Modify: {
2722-
assert(!isDistributed);
27232708
auto typeData =
27242709
getPhysicalStorageTypeData(SGF.getTypeExpansionContext(), SGF.SGM,
27252710
AccessKind, Storage, FormalRValueType);
@@ -2814,8 +2799,7 @@ void LValue::addNonMemberVarComponent(SILGenFunction &SGF, SILLocation loc,
28142799
SILType storageType =
28152800
SGF.getLoweredType(Storage->getType()).getAddressType();
28162801
LV.add<AddressorComponent>(Storage, addressor,
2817-
/*isSuper=*/false, isDirect,
2818-
/*isDistributed=*/false, Subs,
2802+
/*isSuper=*/false, isDirect, Subs,
28192803
CanType(), typeData, storageType, nullptr,
28202804
PreparedArguments(),
28212805
/* isOnSelfParameter */ false);
@@ -2832,11 +2816,10 @@ void LValue::addNonMemberVarComponent(SILGenFunction &SGF, SILLocation loc,
28322816

28332817
void emitUsingGetterSetter(SILDeclRef accessor,
28342818
bool isDirect,
2835-
bool isDistributed,
28362819
LValueTypeData typeData) {
28372820
LV.add<GetterSetterComponent>(
28382821
Storage, accessor,
2839-
/*isSuper=*/false, isDirect, isDistributed, Subs, CanType(), typeData,
2822+
/*isSuper=*/false, isDirect, Subs, CanType(), typeData,
28402823
nullptr, PreparedArguments(),
28412824
/*isOnSelfParameter=*/false,
28422825
ActorIso);
@@ -3317,8 +3300,7 @@ struct MemberStorageAccessEmitter : AccessEmitter<Impl, StorageType> {
33173300
SILType varStorageType = SGF.SGM.Types.getSubstitutedStorageType(
33183301
SGF.getTypeExpansionContext(), Storage, FormalRValueType);
33193302

3320-
LV.add<AddressorComponent>(Storage, addressor, IsSuper, isDirect,
3321-
/*isDistributed=*/false, Subs,
3303+
LV.add<AddressorComponent>(Storage, addressor, IsSuper, isDirect, Subs,
33223304
BaseFormalType, typeData, varStorageType,
33233305
ArgListForDiagnostics, std::move(Indices),
33243306
IsOnSelfParameter);
@@ -3334,10 +3316,9 @@ struct MemberStorageAccessEmitter : AccessEmitter<Impl, StorageType> {
33343316

33353317
void emitUsingGetterSetter(SILDeclRef accessor,
33363318
bool isDirect,
3337-
bool isDistributed,
33383319
LValueTypeData typeData) {
33393320
LV.add<GetterSetterComponent>(
3340-
Storage, accessor, IsSuper, isDirect, isDistributed, Subs,
3321+
Storage, accessor, IsSuper, isDirect, Subs,
33413322
BaseFormalType, typeData, ArgListForDiagnostics, std::move(Indices),
33423323
IsOnSelfParameter, ActorIso);
33433324
}
@@ -3413,8 +3394,7 @@ void LValue::addMemberVarComponent(SILGenFunction &SGF, SILLocation loc,
34133394
auto typeData = getLogicalStorageTypeData(
34143395
SGF.getTypeExpansionContext(), SGF.SGM, AccessKind, FormalRValueType);
34153396

3416-
asImpl().emitUsingGetterSetter(accessor, /*isDirect=*/false,
3417-
/*isDistributed=*/true, typeData);
3397+
asImpl().emitUsingGetterSetter(accessor, /*isDirect=*/false, typeData);
34183398
}
34193399

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

0 commit comments

Comments
 (0)