Skip to content

Commit bf37ba6

Browse files
committed
[Distributed] Don't duplicate hasUserDefinedInit entry, less guards
1 parent 0ec4251 commit bf37ba6

File tree

6 files changed

+5
-24
lines changed

6 files changed

+5
-24
lines changed

include/swift/AST/Decl.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3370,12 +3370,6 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
33703370
/// for types that are not global actors.
33713371
VarDecl *getGlobalActorInstance() const;
33723372

3373-
/// Check if the declaration has an user-defined initializer.
3374-
/// If so, we may want to e.g. not generate a default initializer etc.
3375-
///
3376-
/// \returns true if the decl has an user-defined designated initializer.
3377-
bool hasUserDefinedDesignatedInit() const;
3378-
33793373
/// Whether this type is a global actor, which can be used as an
33803374
/// attribute to decorate declarations for inclusion in the actor-isolated
33813375
/// state denoted by this type.

lib/AST/Decl.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4208,18 +4208,6 @@ ConstructorDecl *NominalTypeDecl::getDefaultInitializer() const {
42084208
SynthesizeDefaultInitRequest{mutableThis}, nullptr);
42094209
}
42104210

4211-
bool NominalTypeDecl::hasUserDefinedDesignatedInit() const {
4212-
// Imported decls don't have a designated initializer defined by the user.
4213-
if (hasClangNode())
4214-
return false;
4215-
4216-
auto &ctx = getASTContext();
4217-
auto *mutableThis = const_cast<NominalTypeDecl *>(this);
4218-
return evaluateOrDefault(ctx.evaluator,
4219-
HasUserDefinedDesignatedInitRequest{mutableThis},
4220-
false);
4221-
}
4222-
42234211
void NominalTypeDecl::synthesizeSemanticMembersIfNeeded(DeclName member) {
42244212
// Silently break cycles here because we can't be sure when and where a
42254213
// request to synthesize will come from yet.

lib/Sema/CodeSynthesis.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,8 +996,6 @@ HasUserDefinedDesignatedInitRequest::evaluate(Evaluator &evaluator,
996996
return false;
997997
}
998998

999-
// TODO(distributed): duplicated of NominalTypeDecl::hasUserDefinedDesignatedInit,
1000-
// remove this static version?
1001999
static bool hasUserDefinedDesignatedInit(Evaluator &eval,
10021000
NominalTypeDecl *decl) {
10031001
// Imported decls don't have a designated initializer defined by the user.

lib/Sema/TypeCheckDistributed.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ void swift::checkDistributedActorConstructor(const ClassDecl *decl, ConstructorD
173173
if (!ctor->isDesignatedInit())
174174
return;
175175

176-
if (!swift::ensureDistributedModuleLoaded(ctor))
177-
return;
178-
179176
// === Designated initializers must accept exactly one ActorTransport
180177
auto &C = ctor->getASTContext();
181178
auto module = ctor->getParentModule();

stdlib/public/Concurrency/Actor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,10 @@ swift::swift_distributedActor_remote_initialize(const Metadata *actorType) {
19711971
classMetadata->getInstanceSize(),
19721972
classMetadata->getInstanceAlignMask());
19731973

1974+
// TODO: remove this memset eventually, today we only do this to not have
1975+
// to modify the destructor logic, as releasing zeroes is no-op
1976+
memset(alloc + 1, 0, classMetadata->getInstanceSize() - sizeof(HeapObject));
1977+
19741978
// TODO(distributed): a remote one does not have to have the "real"
19751979
// default actor body, e.g. we don't need an executor at all; so
19761980
// we can allocate more efficiently and only share the flags/status field

test/SIL/Distributed/distributed_actor_default_deinit_sil.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -O -primary-file %s -emit-sil -enable-experimental-distributed | %FileCheck %s --dump-input=always
1+
// RUN: %target-swift-frontend -O -primary-file %s -emit-sil -enable-experimental-distributed | %FileCheck %s
22

33
import _Distributed
44

0 commit comments

Comments
 (0)