Skip to content

Commit 0c75bd2

Browse files
authored
Revert Initial distributed, some issues to be fixed first (swiftlang#37556)
* Revert "[Distributed] disable tests until issue fixed" This reverts commit 0a04278. * Revert "[Distributed] Initial `distributed` actors and functions and new module (swiftlang#37109)" This reverts commit 814ede0.
1 parent 285cea4 commit 0c75bd2

File tree

120 files changed

+123
-4037
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+123
-4037
lines changed

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,6 @@ option(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
418418
"Enable experimental Swift concurrency model"
419419
FALSE)
420420

421-
option(SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED
422-
"Enable experimental distributed actors and functions"
423-
FALSE)
424-
425421
option(SWIFT_ENABLE_DISPATCH
426422
"Enable use of libdispatch"
427423
TRUE)
@@ -905,7 +901,6 @@ if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
905901

906902
message(STATUS "Differentiable Programming Support: ${SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING}")
907903
message(STATUS "Concurrency Support: ${SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY}")
908-
message(STATUS "Distributed Support: ${SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED}")
909904
message(STATUS "")
910905
else()
911906
message(STATUS "Not building Swift standard library, SDK overlays, and runtime")

include/swift/AST/ASTMangler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ class ASTMangler : public Mangler {
8888
DynamicThunk,
8989
SwiftAsObjCThunk,
9090
ObjCAsSwiftThunk,
91-
DistributedThunk,
9291
};
9392

9493
ASTMangler(bool DWARFMangling = false)

include/swift/AST/ActorIsolation.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ class ActorIsolation {
4848
/// For example, a mutable stored property or synchronous function within
4949
/// the actor is isolated to the instance of that actor.
5050
ActorInstance,
51-
/// The declaration is isolated to a (potentially) distributed actor.
52-
/// Distributed actors may access _their_ state (same as 'ActorInstance')
53-
/// however others may not access any properties on other distributed actors.
54-
DistributedActorInstance,
5551
/// The declaration is explicitly specified to be independent of any actor,
5652
/// meaning that it can be used from any actor but is also unable to
5753
/// refer to the isolated state of any given actor.
@@ -92,10 +88,6 @@ class ActorIsolation {
9288
return ActorIsolation(ActorInstance, actor);
9389
}
9490

95-
static ActorIsolation forDistributedActorInstance(NominalTypeDecl *actor) {
96-
return ActorIsolation(DistributedActorInstance, actor);
97-
}
98-
9991
static ActorIsolation forGlobalActor(Type globalActor, bool unsafe) {
10092
return ActorIsolation(
10193
unsafe ? GlobalActorUnsafe : GlobalActor, globalActor);
@@ -108,7 +100,7 @@ class ActorIsolation {
108100
bool isUnspecified() const { return kind == Unspecified; }
109101

110102
NominalTypeDecl *getActor() const {
111-
assert(getKind() == ActorInstance || getKind() == DistributedActorInstance);
103+
assert(getKind() == ActorInstance);
112104
return actor;
113105
}
114106

@@ -139,7 +131,6 @@ class ActorIsolation {
139131
return true;
140132

141133
case ActorInstance:
142-
case DistributedActorInstance:
143134
return lhs.actor == rhs.actor;
144135

145136
case GlobalActor:

include/swift/AST/Attr.def

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -655,21 +655,6 @@ CONTEXTUAL_SIMPLE_DECL_ATTR(spawn, Spawn,
655655
APIBreakingToAdd | APIBreakingToRemove,
656656
117)
657657

658-
CONTEXTUAL_SIMPLE_DECL_ATTR(distributed, DistributedActor,
659-
DeclModifier | OnClass | OnFunc |
660-
DistributedOnly |
661-
ABIBreakingToAdd | ABIBreakingToRemove |
662-
APIBreakingToAdd | APIBreakingToRemove,
663-
118)
664-
665-
SIMPLE_DECL_ATTR(_distributedActorIndependent, DistributedActorIndependent,
666-
OnFunc | OnVar |
667-
DistributedOnly | UserInaccessible |
668-
ABIStableToAdd | ABIStableToRemove |
669-
APIBreakingToAdd | APIBreakingToRemove,
670-
119)
671-
672-
673658
#undef TYPE_ATTR
674659
#undef DECL_ATTR_ALIAS
675660
#undef CONTEXTUAL_DECL_ATTR_ALIAS

include/swift/AST/Attr.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,6 @@ class DeclAttribute : public AttributeBase {
294294

295295
/// Whether this attribute is only valid when concurrency is enabled.
296296
ConcurrencyOnly = 1ull << (unsigned(DeclKindIndex::Last_Decl) + 16),
297-
298-
/// Whether this attribute is only valid when distributed is enabled.
299-
DistributedOnly = 1ull << (unsigned(DeclKindIndex::Last_Decl) + 17),
300297
};
301298

302299
LLVM_READNONE
@@ -391,10 +388,6 @@ class DeclAttribute : public AttributeBase {
391388
return getOptions(DK) & ConcurrencyOnly;
392389
}
393390

394-
static bool isDistributedOnly(DeclAttrKind DK) {
395-
return getOptions(DK) & DistributedOnly;
396-
}
397-
398391
static bool isUserInaccessible(DeclAttrKind DK) {
399392
return getOptions(DK) & UserInaccessible;
400393
}

include/swift/AST/Builtins.def

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -724,14 +724,6 @@ BUILTIN_MISC_OPERATION(InitializeDefaultActor, "initializeDefaultActor", "", Spe
724724
/// Destroy the default-actor instance in a default actor object.
725725
BUILTIN_MISC_OPERATION(DestroyDefaultActor, "destroyDefaultActor", "", Special)
726726

727-
/// Initialize a "proxy" for a distributed remote actor.
728-
BUILTIN_MISC_OPERATION(InitializeDistributedRemoteActor,
729-
"initializeDistributedRemoteActor", "", Special)
730-
731-
/// Destroy the distributed-actor instance in a "proxy" actor object.
732-
BUILTIN_MISC_OPERATION(DestroyDistributedActor,
733-
"destroyDistributedActor", "", Special)
734-
735727
/// Resume a non-throwing continuation normally with the given result.
736728
BUILTIN_MISC_OPERATION(ResumeNonThrowingContinuationReturning,
737729
"resumeNonThrowingContinuationReturning", "", Special)

include/swift/AST/Decl.h

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,8 +2346,6 @@ class ValueDecl : public Decl {
23462346
/// Is this declaration marked with 'dynamic'?
23472347
bool isDynamic() const;
23482348

2349-
bool isDistributedActorIndependent() const;
2350-
23512349
private:
23522350
bool isObjCDynamic() const {
23532351
return isObjC() && isDynamic();
@@ -3166,11 +3164,6 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
31663164
OptionSet<LookupDirectFlags> flags =
31673165
OptionSet<LookupDirectFlags>());
31683166

3169-
/// Find the '_remote_<...>' counterpart function to a 'distributed func'.
3170-
///
3171-
/// If the passed in function is not distributed this function returns null.
3172-
AbstractFunctionDecl* lookupDirectRemoteFunc(AbstractFunctionDecl *func);
3173-
31743167
/// Collect the set of protocols to which this type should implicitly
31753168
/// conform, such as AnyObject (for classes).
31763169
void getImplicitProtocols(SmallVectorImpl<ProtocolDecl *> &protocols);
@@ -3227,10 +3220,6 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
32273220
/// `Actor` protocol.
32283221
bool isActor() const;
32293222

3230-
/// Whether this nominal type qualifies as a distributed actor, meaning that
3231-
/// it is either a distributed actor.
3232-
bool isDistributedActor() const;
3233-
32343223
/// Return the range of semantics attributes attached to this NominalTypeDecl.
32353224
auto getSemanticsAttrs() const
32363225
-> decltype(getAttrs().getSemanticsAttrs()) {
@@ -3299,8 +3288,6 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
32993288
/// for types that are not global actors.
33003289
VarDecl *getGlobalActorInstance() const;
33013290

3302-
bool hasDistributedActorLocalInitializer() const;
3303-
33043291
/// Whether this type is a global actor, which can be used as an
33053292
/// attribute to decorate declarations for inclusion in the actor-isolated
33063293
/// state denoted by this type.
@@ -4016,7 +4003,6 @@ enum class KnownDerivableProtocolKind : uint8_t {
40164003
AdditiveArithmetic,
40174004
Differentiable,
40184005
Actor,
4019-
DistributedActor,
40204006
};
40214007

40224008
/// ProtocolDecl - A declaration of a protocol, for example:
@@ -4210,10 +4196,6 @@ class ProtocolDecl final : public NominalTypeDecl {
42104196
/// semantics but has no corresponding witness table.
42114197
bool isMarkerProtocol() const;
42124198

4213-
/// Is a protocol that can only be conformed by distributed actors.
4214-
/// Such protocols are allowed to contain distributed functions.
4215-
bool inheritsFromDistributedActor() const;
4216-
42174199
private:
42184200
void computeKnownProtocolKind() const;
42194201

@@ -4732,8 +4714,6 @@ class AbstractStorageDecl : public ValueDecl {
47324714

47334715
bool hasAnyNativeDynamicAccessors() const;
47344716

4735-
bool isDistributedActorIndependent() const;
4736-
47374717
// Implement isa/cast/dyncast/etc.
47384718
static bool classof(const Decl *D) {
47394719
return D->getKind() >= DeclKind::First_AbstractStorageDecl &&
@@ -5190,20 +5170,14 @@ class VarDecl : public AbstractStorageDecl {
51905170
return getAttrs().getAttributes<SemanticsAttr>();
51915171
}
51925172

5193-
/// Returns true if this VarDecl has the string \p attrValue as a semantics
5173+
/// Returns true if this VarDelc has the string \p attrValue as a semantics
51945174
/// attribute.
51955175
bool hasSemanticsAttr(StringRef attrValue) const {
51965176
return llvm::any_of(getSemanticsAttrs(), [&](const SemanticsAttr *attr) {
51975177
return attrValue.equals(attr->Value);
51985178
});
51995179
}
52005180

5201-
/// Whether the given name is actorAddress, which is used for distributed actors.
5202-
static bool isDistributedActorAddressName(ASTContext &ctx, DeclName name);
5203-
5204-
/// Whether the given name is actorTransport, which is used for distributed actors.
5205-
static bool isDistributedActorTransportName(ASTContext &ctx, DeclName name);
5206-
52075181
// Implement isa/cast/dyncast/etc.
52085182
static bool classof(const Decl *D) {
52095183
return D->getKind() == DeclKind::Var || D->getKind() == DeclKind::Param;
@@ -5881,9 +5855,6 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
58815855
/// Returns if the function is 'rethrows' or 'reasync'.
58825856
bool hasPolymorphicEffect(EffectKind kind) const;
58835857

5884-
/// Returns 'true' if the function is distributed.
5885-
bool isDistributed() const;
5886-
58875858
PolymorphicEffectKind getPolymorphicEffectKind(EffectKind kind) const;
58885859

58895860
// FIXME: Hack that provides names with keyword arguments for accessors.
@@ -6893,18 +6864,6 @@ class ConstructorDecl : public AbstractFunctionDecl {
68936864
/// \endcode
68946865
bool isObjCZeroParameterWithLongSelector() const;
68956866

6896-
/// Checks if the initializer is a distributed actor's 'local' initializer:
6897-
/// ```
6898-
/// init(transport: ActorTransport)
6899-
/// ```
6900-
bool isDistributedActorLocalInit() const;
6901-
6902-
/// Checks if the initializer is a distributed actor's 'resolve' initializer:
6903-
/// ```
6904-
/// init(resolve address: ActorAddress, using transport: ActorTransport)
6905-
/// ```
6906-
bool isDistributedActorResolveInit() const;
6907-
69086867
static bool classof(const Decl *D) {
69096868
return D->getKind() == DeclKind::Constructor;
69106869
}

include/swift/AST/DiagnosticsParse.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ ERROR(pound_available_package_description_not_allowed, none,
18221822
ERROR(availability_query_repeated_platform, none,
18231823
"version for '%0' already specified", (StringRef))
18241824

1825-
ERROR(attr_requires_concurrency, none,
1825+
ERROR(attr_requires_concurrency,none,
18261826
"'%0' %select{attribute|modifier}1 is only valid when experimental "
18271827
"concurrency is enabled",
18281828
(StringRef, bool))

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -4362,13 +4362,6 @@ ERROR(actor_isolated_non_self_reference,none,
43624362
"actor-isolated %0 %1 can only be %select{referenced|mutated|used 'inout'}3 "
43634363
"%select{from inside the actor|on 'self'}2",
43644364
(DescriptiveDeclKind, DeclName, bool, unsigned))
4365-
ERROR(distributed_actor_isolated_non_self_reference,none,
4366-
"distributed actor-isolated %0 %1 can only be referenced "
4367-
"inside the distributed actor",
4368-
(DescriptiveDeclKind, DeclName))
4369-
ERROR(distributed_actor_needs_explicit_distributed_import,none,
4370-
"'_Distributed' module not imported, required for 'distributed actor'",
4371-
())
43724365
ERROR(actor_isolated_self_independent_context,none,
43734366
"actor-isolated %0 %1 can not be %select{referenced|mutated|used 'inout'}2 from a "
43744367
"non-isolated context",
@@ -4418,8 +4411,8 @@ ERROR(actor_isolated_from_async_let,none,
44184411
"actor-isolated %0 %1 cannot be %select{referenced|mutated|used 'inout'}2 from 'async let' initializer",
44194412
(DescriptiveDeclKind, DeclName, unsigned))
44204413
ERROR(actor_isolated_keypath_component,none,
4421-
"cannot form key path to%select{| distributed}0 actor-isolated %1 %2",
4422-
(bool, DescriptiveDeclKind, DeclName))
4414+
"cannot form key path to actor-isolated %0 %1",
4415+
(DescriptiveDeclKind, DeclName))
44234416
ERROR(effectful_keypath_component,none,
44244417
"cannot form key path to %0 with 'throws' or 'async'",
44254418
(DescriptiveDeclKind))
@@ -4434,32 +4427,6 @@ NOTE(actor_isolated_sync_func,none,
44344427
"calls to %0 %1 from outside of its actor context are "
44354428
"implicitly asynchronous",
44364429
(DescriptiveDeclKind, DeclName))
4437-
NOTE(distributed_actor_isolated_method_note,none,
4438-
"only 'distributed' functions can be called from outside the distributed actor",
4439-
())
4440-
ERROR(distributed_actor_isolated_method,none,
4441-
"only 'distributed' functions can be called from outside the distributed actor", // TODO: more like 'non-distributed' ... defined here
4442-
())
4443-
ERROR(distributed_actor_func_param_not_codable,none,
4444-
"distributed function parameter '%0' of type %1 does not conform to 'Codable'",
4445-
(StringRef, Type))
4446-
ERROR(distributed_actor_func_result_not_codable,none,
4447-
"distributed function result type %0 does not conform to 'Codable'",
4448-
(Type))
4449-
ERROR(distributed_actor_func_missing_remote_func,none,
4450-
"distributed function is missing its remote static func implementation (%0). "
4451-
"You may want to use a distributed actor SwiftPM plugin to generate those, "
4452-
"or implement it manually.",
4453-
(Identifier))
4454-
ERROR(distributed_actor_remote_func_is_not_static,none,
4455-
"remote function %0 must be static.",
4456-
(DeclName))
4457-
ERROR(distributed_actor_remote_func_is_not_async_throws,none,
4458-
"remote function %0 must be 'async throws'.",
4459-
(DeclName))
4460-
ERROR(distributed_actor_remote_func_must_not_be_distributed,none,
4461-
"remote function %0 must be 'async throws'.",
4462-
(DeclName))
44634430
NOTE(actor_mutable_state,none,
44644431
"mutation of this %0 is only permitted within the actor",
44654432
(DescriptiveDeclKind))
@@ -4538,60 +4505,6 @@ ERROR(actor_instance_property_wrapper,none,
45384505
"the actor instance; consider 'nonisolated'",
45394506
(Identifier, Identifier))
45404507

4541-
ERROR(distributed_actor_func_defined_outside_of_distributed_actor,none,
4542-
"distributed function %0 is declared outside of an distributed actor",
4543-
(DeclName))
4544-
ERROR(distributed_actor_local_init_explicitly_defined,none,
4545-
"'distributed actor' local-initializer 'init(transport:)' "
4546-
"cannot be implemented explicitly.",
4547-
())
4548-
ERROR(distributed_actor_init_resolve_must_not_be_user_defined,none,
4549-
"'distributed actor' resolve-initializer 'init(resolve:using:)' "
4550-
"cannot be implemented explicitly.",
4551-
())
4552-
ERROR(distributed_actor_init_user_defined_must_be_convenience,none,
4553-
"'distributed actor' initializer %0 must be 'convenience' initializer. "
4554-
"Distributed actors have an implicitly synthesized designated "
4555-
"'init(transport:)' local-initializer, which other initializers must delegate to",
4556-
(DeclName))
4557-
ERROR(distributed_actor_init_must_delegate_to_local_init,none,
4558-
"'distributed actor' initializer %0 must (directly or indirectly) delegate "
4559-
"to 'init(transport:)'",
4560-
(DeclName))
4561-
ERROR(distributed_actor_init_must_not_delegate_to_resolve_init,none,
4562-
"'distributed actor' initializer %0 cannot delegate to resolve-initializer "
4563-
"'init(resolve:using:)', as it may result resolving a storageless proxy instance",
4564-
(DeclName))
4565-
ERROR(distributed_actor_local_var,none,
4566-
"'distributed' can not be applied to local variables",
4567-
())
4568-
ERROR(distributed_actor_property,none,
4569-
"'distributed' can not be applied to local properties",
4570-
())
4571-
ERROR(distributed_actor_storage,none,
4572-
"'distributed' can not be applied to actor properties; "
4573-
"Only functions can be 'distributed'",
4574-
())
4575-
ERROR(distributed_actor_not_actor,none,
4576-
"'distributed' can only be applied to 'actor' definitions, "
4577-
"and distributed actor-isolated async functions",
4578-
())
4579-
ERROR(distributed_actor_not_actor_func,none,
4580-
"'distributed' can only be applied to distributed actor async functions",
4581-
())
4582-
ERROR(distributed_actor_func_static,none,
4583-
"'distributed' functions cannot be 'static'",
4584-
())
4585-
ERROR(distributed_actor_func_not_in_distributed_actor,none,
4586-
"'distributed' function can only be declared within 'distributed actor'",
4587-
())
4588-
ERROR(distributed_actor_independent_property_must_be_let,none,
4589-
"_distributedActorIndependent can be applied to properties, however they must be 'let'",
4590-
())
4591-
NOTE(distributed_actor_isolated_property,none,
4592-
"distributed actor state is only available within the actor instance",
4593-
())
4594-
45954508
ERROR(concurrency_lib_missing,none,
45964509
"missing '%0' declaration, probably because the '_Concurrency' "
45974510
"module was not imported", (StringRef))

0 commit comments

Comments
 (0)