Skip to content

Commit 1c992c7

Browse files
authored
Merge pull request #2965 from swiftwasm/maxd/main-merge
Resolve conflicts with the `main` branch
2 parents 28da4b5 + a1879cc commit 1c992c7

File tree

110 files changed

+1289
-1261
lines changed

Some content is hidden

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

110 files changed

+1289
-1261
lines changed

include/swift/AST/ASTContext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,8 +1170,8 @@ class ASTContext final {
11701170

11711171
private:
11721172
friend Decl;
1173-
Optional<RawComment> getRawComment(const Decl *D);
1174-
void setRawComment(const Decl *D, RawComment RC);
1173+
Optional<std::pair<RawComment, bool>> getRawComment(const Decl *D);
1174+
void setRawComment(const Decl *D, RawComment RC, bool FromSerialized);
11751175

11761176
Optional<StringRef> getBriefComment(const Decl *D);
11771177
void setBriefComment(const Decl *D, StringRef Comment);

include/swift/AST/Builtins.def

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,14 @@ BUILTIN_MISC_OPERATION(ResumeThrowingContinuationThrowing,
740740
BUILTIN_MISC_OPERATION(BuildSerialExecutorRef,
741741
"buildSerialExecutorRef", "", Special)
742742

743+
/// Create a task group.
744+
BUILTIN_MISC_OPERATION(CreateTaskGroup,
745+
"createTaskGroup", "", Special)
746+
747+
/// Destroy a task group.
748+
BUILTIN_MISC_OPERATION(DestroyTaskGroup,
749+
"destroyTaskGroup", "", Special)
750+
743751
// BUILTIN_MISC_OPERATION_WITH_SILGEN - Miscellaneous operations that are
744752
// specially emitted during SIL generation.
745753
//

include/swift/Basic/Features.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ LANGUAGE_FEATURE(GlobalActors, 0, "Global actors", langOpts.EnableExperimentalCo
4444
LANGUAGE_FEATURE(BuiltinJob, 0, "Builtin.Job type", true)
4545
LANGUAGE_FEATURE(Sendable, 0, "Sendable and @Sendable", true)
4646
LANGUAGE_FEATURE(BuiltinContinuation, 0, "Continuation builtins", true)
47+
LANGUAGE_FEATURE(BuiltinTaskGroup, 0, "TaskGroup builtins", true)
4748

4849
#undef LANGUAGE_FEATURE

include/swift/Runtime/Concurrency.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -178,17 +178,6 @@ void swift_taskGroup_wait_next_throwing(
178178
OpaqueValue *resultPointer, SWIFT_ASYNC_CONTEXT AsyncContext *rawContext,
179179
TaskGroup *group, const Metadata *successType);
180180

181-
/// Create a new `TaskGroup`.
182-
/// The caller is responsible for retaining and managing the group's lifecycle.
183-
///
184-
/// Its Swift signature is
185-
///
186-
/// \code
187-
/// func swift_taskGroup_create() -> Builtin.RawPointer
188-
/// \endcode
189-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
190-
TaskGroup* swift_taskGroup_create(); // TODO: probably remove this call, and just use the initialize always
191-
192181
/// Initialize a `TaskGroup` in the passed `group` memory location.
193182
/// The caller is responsible for retaining and managing the group's lifecycle.
194183
///

include/swift/Runtime/RuntimeFunctions.def

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,21 +1672,21 @@ FUNCTION(DefaultActorDeallocateResilient,
16721672
ARGS(RefCountedPtrTy),
16731673
ATTRS(NoUnwind))
16741674

1675-
//// void swift_taskGroup_initialize(AsyncTask *task, TaskGroup *group);
1676-
//FUNCTION(TaskGroupInitialize,
1677-
// swift_taskGroup_initialize, SwiftCC,
1678-
// ConcurrencyAvailability,
1679-
// RETURNS(VoidTy),
1680-
// ARGS(RefCountedPtrTy, RefCountedPtrTy),
1681-
// ATTRS(NoUnwind))
1682-
//
1683-
//// void swift_taskGroup_destroy(AsyncTask *task, TaskGroup *group);
1684-
//FUNCTION(TaskGroupDestroy,
1685-
// swift_taskGroup_destroy, SwiftCC,
1686-
// ConcurrencyAvailability,
1687-
// RETURNS(VoidTy),
1688-
// ARGS(RefCountedPtrTy, RefCountedPtrTy),
1689-
// ATTRS(NoUnwind))
1675+
// void swift_taskGroup_initialize(TaskGroup *group);
1676+
FUNCTION(TaskGroupInitialize,
1677+
swift_taskGroup_initialize, SwiftCC,
1678+
ConcurrencyAvailability,
1679+
RETURNS(VoidTy),
1680+
ARGS(Int8PtrTy),
1681+
ATTRS(NoUnwind))
1682+
1683+
// void swift_taskGroup_destroy(TaskGroup *group);
1684+
FUNCTION(TaskGroupDestroy,
1685+
swift_taskGroup_destroy, SwiftCC,
1686+
ConcurrencyAvailability,
1687+
RETURNS(VoidTy),
1688+
ARGS(Int8PtrTy),
1689+
ATTRS(NoUnwind))
16901690

16911691
// AutoDiffLinearMapContext *swift_autoDiffCreateLinearMapContext(size_t);
16921692
FUNCTION(AutoDiffCreateLinearMapContext,

lib/AST/ASTContext.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ struct ASTContext::Implementation {
285285
ClangModuleLoader *TheDWARFModuleLoader = nullptr;
286286

287287
/// Map from Swift declarations to raw comments.
288-
llvm::DenseMap<const Decl *, RawComment> RawComments;
288+
llvm::DenseMap<const Decl *, std::pair<RawComment, bool>> RawComments;
289289

290290
/// Map from Swift declarations to brief comments.
291291
llvm::DenseMap<const Decl *, StringRef> BriefComments;
@@ -2020,16 +2020,16 @@ ModuleDecl *ASTContext::getStdlibModule(bool loadIfAbsent) {
20202020
return TheStdlibModule;
20212021
}
20222022

2023-
Optional<RawComment> ASTContext::getRawComment(const Decl *D) {
2023+
Optional<std::pair<RawComment, bool>> ASTContext::getRawComment(const Decl *D) {
20242024
auto Known = getImpl().RawComments.find(D);
20252025
if (Known == getImpl().RawComments.end())
20262026
return None;
20272027

20282028
return Known->second;
20292029
}
20302030

2031-
void ASTContext::setRawComment(const Decl *D, RawComment RC) {
2032-
getImpl().RawComments[D] = RC;
2031+
void ASTContext::setRawComment(const Decl *D, RawComment RC, bool FromSerialized) {
2032+
getImpl().RawComments[D] = std::make_pair(RC, FromSerialized);
20332033
}
20342034

20352035
Optional<StringRef> ASTContext::getBriefComment(const Decl *D) {

lib/AST/ASTPrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,6 +2724,10 @@ static bool usesFeatureBuiltinContinuation(Decl *decl) {
27242724
return false;
27252725
}
27262726

2727+
static bool usesFeatureBuiltinTaskGroup(Decl *decl) {
2728+
return false;
2729+
}
2730+
27272731
/// Determine the set of "new" features used on a given declaration.
27282732
///
27292733
/// Note: right now, all features we check for are "new". At some point, we'll

lib/AST/Builtins.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,18 @@ static ValueDecl *getResumeContinuationThrowing(ASTContext &ctx,
14811481
_void);
14821482
}
14831483

1484+
static ValueDecl *getCreateTaskGroup(ASTContext &ctx, Identifier id) {
1485+
return getBuiltinFunction(ctx, id, _thin,
1486+
_parameters(),
1487+
_rawPointer);
1488+
}
1489+
1490+
static ValueDecl *getDestroyTaskGroup(ASTContext &ctx, Identifier id) {
1491+
return getBuiltinFunction(ctx, id, _thin,
1492+
_parameters(_rawPointer),
1493+
_void);
1494+
}
1495+
14841496
static ValueDecl *getBuildSerialExecutorRef(ASTContext &ctx, Identifier id) {
14851497
// TODO: restrict the generic parameter to the SerialExecutor protocol
14861498
return getBuiltinFunction(ctx, id, _thin,
@@ -2728,6 +2740,12 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
27282740
case BuiltinValueKind::DestroyDefaultActor:
27292741
return getDefaultActorInitDestroy(Context, Id);
27302742

2743+
case BuiltinValueKind::CreateTaskGroup:
2744+
return getCreateTaskGroup(Context, Id);
2745+
2746+
case BuiltinValueKind::DestroyTaskGroup:
2747+
return getDestroyTaskGroup(Context, Id);
2748+
27312749
case BuiltinValueKind::ResumeNonThrowingContinuationReturning:
27322750
case BuiltinValueKind::ResumeThrowingContinuationReturning:
27332751
return getResumeContinuationReturning(Context, Id);

lib/AST/RawComment.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,16 @@ RawComment Decl::getRawComment(bool SerializedOK) const {
137137

138138
// Check the cache in ASTContext.
139139
auto &Context = getASTContext();
140-
if (Optional<RawComment> RC = Context.getRawComment(this))
141-
return RC.getValue();
140+
if (Optional<std::pair<RawComment, bool>> RC = Context.getRawComment(this)) {
141+
auto P = RC.getValue();
142+
if (!SerializedOK || P.second)
143+
return P.first;
144+
}
142145

143146
// Check the declaration itself.
144147
if (auto *Attr = getAttrs().getAttribute<RawDocCommentAttr>()) {
145148
RawComment Result = toRawComment(Context, Attr->getCommentRange());
146-
Context.setRawComment(this, Result);
149+
Context.setRawComment(this, Result, true);
147150
return Result;
148151
}
149152

@@ -172,15 +175,15 @@ RawComment Decl::getRawComment(bool SerializedOK) const {
172175
auto RC = RawComment(Context.AllocateCopy(llvm::makeArrayRef(SRCs)));
173176

174177
if (!RC.isEmpty()) {
175-
Context.setRawComment(this, RC);
178+
Context.setRawComment(this, RC, true);
176179
return RC;
177180
}
178181
}
179182
}
180183
}
181184

182185
if (Optional<CommentInfo> C = Unit->getCommentForDecl(this)) {
183-
Context.setRawComment(this, C->Raw);
186+
Context.setRawComment(this, C->Raw, false);
184187
return C->Raw;
185188
}
186189

lib/Frontend/Frontend.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,8 @@ CompilerInstance::openModuleDoc(const InputFile &input) {
754754
}
755755

756756
bool CompilerInvocation::shouldImportSwiftConcurrency() const {
757-
return !getLangOptions().DisableImplicitConcurrencyModuleImport &&
757+
return getLangOptions().EnableExperimentalConcurrency
758+
&& !getLangOptions().DisableImplicitConcurrencyModuleImport &&
758759
getFrontendOptions().InputMode !=
759760
FrontendOptions::ParseInputMode::SwiftModuleInterface;
760761
}

0 commit comments

Comments
 (0)