Skip to content

Commit 3db2940

Browse files
authored
Merge pull request #2988 from swiftwasm/main
[pull] swiftwasm from main
2 parents ec58843 + f53f80f commit 3db2940

File tree

136 files changed

+1575
-457
lines changed

Some content is hidden

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

136 files changed

+1575
-457
lines changed

cmake/modules/Libdispatch.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ foreach(sdk ${DISPATCH_SDKS})
102102
# ensure that we strip out the DESTDIR environment
103103
# from the sub-build
104104
${CMAKE_COMMAND} -E env --unset=DESTDIR ${CMAKE_COMMAND} --build . --target install
105+
COMMAND
106+
${CMAKE_COMMAND} -E copy
107+
<INSTALL_DIR>/${LIBDISPATCH_RUNTIME_DIR}/${SWIFT_SDK_${sdk}_SHARED_LIBRARY_PREFIX}dispatch${SWIFT_SDK_${sdk}_SHARED_LIBRARY_SUFFIX}
108+
${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${arch}/${SWIFT_SDK_${sdk}_SHARED_LIBRARY_PREFIX}dispatch${SWIFT_SDK_${sdk}_SHARED_LIBRARY_SUFFIX}
109+
COMMAND
110+
${CMAKE_COMMAND} -E copy
111+
<INSTALL_DIR>/${LIBDISPATCH_RUNTIME_DIR}/${SWIFT_SDK_${sdk}_SHARED_LIBRARY_PREFIX}BlocksRuntime${SWIFT_SDK_${sdk}_SHARED_LIBRARY_SUFFIX}
112+
${SWIFTLIB_DIR}/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${arch}/${SWIFT_SDK_${sdk}_SHARED_LIBRARY_PREFIX}BlocksRuntime${SWIFT_SDK_${sdk}_SHARED_LIBRARY_SUFFIX}
105113
STEP_TARGETS
106114
install
107115
BUILD_BYPRODUCTS

include/swift/ABI/Task.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,18 @@ class alignas(2 * alignof(void*)) Job : public HeapObject {
4646
/// The next waiting task link, an AsyncTask that is waiting on a future.
4747
NextWaitingTaskIndex = 0,
4848

49+
// The Dispatch object header is one pointer and two ints, which is
50+
// equvialent to three pointers on 32-bit and two pointers 64-bit. Set the
51+
// indexes accordingly so that DispatchLinkageIndex points to where Dispatch
52+
// expects.
53+
DispatchHasLongObjectHeader = sizeof(void *) == sizeof(int),
54+
4955
/// An opaque field used by Dispatch when enqueueing Jobs directly.
50-
DispatchLinkageIndex = 0,
56+
DispatchLinkageIndex = DispatchHasLongObjectHeader ? 1 : 0,
5157

5258
/// The dispatch queue being used when enqueueing a Job directly with
5359
/// Dispatch.
54-
DispatchQueueIndex = 1,
60+
DispatchQueueIndex = DispatchHasLongObjectHeader ? 0 : 1,
5561
};
5662

5763
// Reserved for the use of the scheduler.

include/swift/AST/Decl.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6769,15 +6769,18 @@ class ConstructorDecl : public AbstractFunctionDecl {
67696769
public:
67706770
ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc,
67716771
bool Failable, SourceLoc FailabilityLoc,
6772+
bool Async, SourceLoc AsyncLoc,
67726773
bool Throws, SourceLoc ThrowsLoc,
67736774
ParameterList *BodyParams,
67746775
GenericParamList *GenericParams,
67756776
DeclContext *Parent);
67766777

67776778
static ConstructorDecl *
67786779
createImported(ASTContext &ctx, ClangNode clangNode, DeclName name,
6779-
SourceLoc constructorLoc, bool failable,
6780-
SourceLoc failabilityLoc, bool throws, SourceLoc throwsLoc,
6780+
SourceLoc constructorLoc,
6781+
bool failable, SourceLoc failabilityLoc,
6782+
bool async, SourceLoc asyncLoc,
6783+
bool throws, SourceLoc throwsLoc,
67816784
ParameterList *bodyParams, GenericParamList *genericParams,
67826785
DeclContext *parent);
67836786

include/swift/AST/DiagnosticsParse.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,6 @@ ERROR(expected_dynamic_func_attr,none,
762762
ERROR(async_after_throws,none,
763763
"%select{'async'|'reasync'}0 must precede %select{'throws'|'rethrows'}1",
764764
(bool, bool))
765-
ERROR(async_init,none, "initializer cannot be marked 'async'", ())
766765
ERROR(duplicate_effects_specifier,none,
767766
"'%0' has already been specified", (StringRef))
768767

include/swift/AST/DiagnosticsSema.def

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,10 @@ ERROR(module_interface_build_failed,Fatal,
728728
"the textual interface may be broken by project issues"
729729
"%select{, differences between compilers (the producer '%3' and this compiler '%4')|}2 or a compiler bug",
730730
(bool, StringRef, bool, StringRef, StringRef))
731+
ERROR(module_interface_build_failed_mismatching_compiler,Fatal,
732+
"failed to build module '%0'; this SDK is not supported by the compiler "
733+
"(the SDK is built with '%1', while this compiler is '%2'). Please select a toolchain which matches the SDK.",
734+
(StringRef, StringRef, StringRef))
731735
ERROR(serialization_malformed_module,Fatal,
732736
"malformed compiled module: %0", (StringRef))
733737
ERROR(serialization_module_too_new,Fatal,
@@ -2605,12 +2609,8 @@ ERROR(override_dynamic_self_mismatch,none,
26052609
ERROR(override_class_declaration_in_extension,none,
26062610
"cannot override a non-dynamic class declaration from an extension",
26072611
())
2608-
ERROR(override_throws,none,
2609-
"cannot override non-throwing %select{method|initializer}0 with "
2610-
"throwing %select{method|initializer}0", (bool))
2611-
// TODO: this really could be merged with the above.
26122612
ERROR(override_with_more_effects,none,
2613-
"cannot override non-'%1' %0 with '%1' %0",
2613+
"cannot override non-%1 %0 with %1 %0",
26142614
(DescriptiveDeclKind, StringRef))
26152615
ERROR(override_throws_objc,none,
26162616
"overriding a throwing @objc %select{method|initializer}0 with "
@@ -3903,6 +3903,11 @@ ERROR(return_init_non_nil,none,
39033903
"'nil' is the only return value permitted in an initializer",
39043904
())
39053905

3906+
ERROR(implicit_async_super_init,none,
3907+
"missing call to superclass's initializer; "
3908+
"'super.init' is 'async' and requires an explicit call",
3909+
())
3910+
39063911
WARNING(if_always_true,none,
39073912
"'if' condition is always true", ())
39083913
WARNING(while_always_true,none,
@@ -4285,7 +4290,7 @@ NOTE(note_add_globalactor_to_function,none,
42854290
(StringRef, DescriptiveDeclKind, DeclName, Type))
42864291
FIXIT(insert_globalactor_attr, "@%0 ", (Type))
42874292
ERROR(not_objc_function_async,none,
4288-
"'async' function cannot be represented in Objective-C", ())
4293+
"'async' %0 cannot be represented in Objective-C", (DescriptiveDeclKind))
42894294
NOTE(not_objc_function_type_async,none,
42904295
"'async' function types cannot be represented in Objective-C", ())
42914296
ERROR(actor_isolated_objc,none,

include/swift/AST/RawComment.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ struct SingleRawComment {
3434
StringRef RawText;
3535

3636
unsigned Kind : 8;
37-
unsigned StartColumn : 16;
38-
unsigned StartLine;
39-
unsigned EndLine;
37+
unsigned ColumnIndent : 16;
4038

4139
SingleRawComment(CharSourceRange Range, const SourceManager &SourceMgr);
42-
SingleRawComment(StringRef RawText, unsigned StartColumn);
40+
SingleRawComment(StringRef RawText, unsigned ColumnIndent);
4341

4442
SingleRawComment(const SingleRawComment &) = default;
4543
SingleRawComment &operator=(const SingleRawComment &) = default;

include/swift/Basic/SourceManager.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ class SourceManager {
290290
bool isLocInVirtualFile(SourceLoc Loc) const {
291291
return getVirtualFile(Loc) != nullptr;
292292
}
293+
294+
/// Return a SourceLoc in \c this corresponding to \p otherLoc, which must be
295+
/// owned by \p otherManager. Returns an invalid SourceLoc if it cannot be
296+
/// translated.
297+
SourceLoc getLocForForeignLoc(SourceLoc otherLoc, SourceManager &otherMgr);
293298
};
294299

295300
} // end namespace swift

include/swift/SIL/SILNodes.def

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,9 @@ ABSTRACT_VALUE_AND_INST(SingleValueInstruction, ValueBase, SILInstruction)
725725
GetAsyncContinuationInstBase, MayHaveSideEffects, MayRelease)
726726
SINGLE_VALUE_INST_RANGE(GetAsyncContinuationInstBase, GetAsyncContinuationInst, GetAsyncContinuationAddrInst)
727727

728+
SINGLE_VALUE_INST(ExtractExecutorInst, extract_executor,
729+
SingleValueInstruction, MayRead, DoesNotRelease)
730+
728731
// Key paths
729732
// TODO: The only "side effect" is potentially retaining the returned key path
730733
// object; is there a more specific effect?
@@ -835,8 +838,6 @@ NON_VALUE_INST(FixLifetimeInst, fix_lifetime,
835838

836839
NON_VALUE_INST(HopToExecutorInst, hop_to_executor,
837840
SILInstruction, MayHaveSideEffects, DoesNotRelease)
838-
SINGLE_VALUE_INST(ExtractExecutorInst, extract_executor,
839-
SILInstruction, MayRead, DoesNotRelease)
840841

841842
NON_VALUE_INST(DestroyValueInst, destroy_value,
842843
SILInstruction, MayHaveSideEffects, MayRelease)

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ class PrintAST : public ASTVisitor<PrintAST> {
641641
Lines.clear();
642642

643643
StringRef RawText = SRC.RawText.rtrim("\n\r");
644-
unsigned WhitespaceToTrim = SRC.StartColumn - 1;
644+
unsigned WhitespaceToTrim = SRC.ColumnIndent - 1;
645645
trimLeadingWhitespaceFromLines(RawText, WhitespaceToTrim, Lines);
646646

647647
for (auto Line : Lines) {

lib/AST/Decl.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7672,13 +7672,13 @@ bool FuncDecl::isMainTypeMainMethod() const {
76727672

76737673
ConstructorDecl::ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc,
76747674
bool Failable, SourceLoc FailabilityLoc,
7675-
bool Throws,
7676-
SourceLoc ThrowsLoc,
7675+
bool Async, SourceLoc AsyncLoc,
7676+
bool Throws, SourceLoc ThrowsLoc,
76777677
ParameterList *BodyParams,
76787678
GenericParamList *GenericParams,
76797679
DeclContext *Parent)
76807680
: AbstractFunctionDecl(DeclKind::Constructor, Parent, Name, ConstructorLoc,
7681-
/*Async=*/false, SourceLoc(), Throws, ThrowsLoc,
7681+
Async, AsyncLoc, Throws, ThrowsLoc,
76827682
/*HasImplicitSelfDecl=*/true,
76837683
GenericParams),
76847684
FailabilityLoc(FailabilityLoc),
@@ -7696,13 +7696,17 @@ ConstructorDecl::ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc,
76967696
ConstructorDecl *ConstructorDecl::createImported(
76977697
ASTContext &ctx, ClangNode clangNode, DeclName name,
76987698
SourceLoc constructorLoc, bool failable, SourceLoc failabilityLoc,
7699+
bool async, SourceLoc asyncLoc,
76997700
bool throws, SourceLoc throwsLoc, ParameterList *bodyParams,
77007701
GenericParamList *genericParams, DeclContext *parent) {
77017702
void *declPtr = allocateMemoryForDecl<ConstructorDecl>(
77027703
ctx, sizeof(ConstructorDecl), true);
77037704
auto ctor = ::new (declPtr)
7704-
ConstructorDecl(name, constructorLoc, failable, failabilityLoc, throws,
7705-
throwsLoc, bodyParams, genericParams, parent);
7705+
ConstructorDecl(name, constructorLoc,
7706+
failable, failabilityLoc,
7707+
async, asyncLoc,
7708+
throws, throwsLoc,
7709+
bodyParams, genericParams, parent);
77067710
ctor->setClangNode(clangNode);
77077711
return ctor;
77087712
}

0 commit comments

Comments
 (0)