Skip to content

Commit 1470d5e

Browse files
Merge pull request #3016 from swiftwasm/katei/merge-main-2021-04-22
Merge main 2021-04-22
2 parents 9bc5b83 + 7005230 commit 1470d5e

File tree

208 files changed

+2828
-1303
lines changed

Some content is hidden

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

208 files changed

+2828
-1303
lines changed

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ macro(configure_sdks_darwin)
108108
set(macosx_arch "x86_64" "arm64")
109109
set(iphoneos_arch "arm64" "arm64e" "armv7")
110110
set(appletvos_arch "arm64")
111-
set(watchos_arch "armv7k")
111+
set(watchos_arch "armv7k" "arm64_32")
112112

113113
set(macosx_ver "10.9")
114114
set(iphoneos_ver "8.0")

cmake/modules/DarwinSDKs.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ endif()
1212

1313
set(SUPPORTED_TVOS_ARCHS "arm64")
1414
set(SUPPORTED_TVOS_SIMULATOR_ARCHS "x86_64;arm64")
15-
set(SUPPORTED_WATCHOS_ARCHS "armv7k")
15+
set(SUPPORTED_WATCHOS_ARCHS "armv7k;arm64_32")
1616
set(SUPPORTED_WATCHOS_SIMULATOR_ARCHS "i386;arm64")
1717
set(SUPPORTED_OSX_ARCHS "x86_64;arm64;arm64e")
1818

cmake/modules/SwiftSetIfArchBitness.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function(set_if_arch_bitness var_name)
1212
"${SIA_ARCH}" STREQUAL "armv6" OR
1313
"${SIA_ARCH}" STREQUAL "armv7" OR
1414
"${SIA_ARCH}" STREQUAL "armv7k" OR
15+
"${SIA_ARCH}" STREQUAL "arm64_32" OR
1516
"${SIA_ARCH}" STREQUAL "armv7s" OR
1617
"${SIA_ARCH}" STREQUAL "wasm32")
1718
set("${var_name}" "${SIA_CASE_32_BIT}" PARENT_SCOPE)

include/swift/ABI/Task.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,13 +582,13 @@ class FutureAsyncContext : public AsyncContext {
582582
/// This matches the ABI of a closure `() async throws -> ()`
583583
using AsyncVoidClosureEntryPoint =
584584
SWIFT_CC(swiftasync)
585-
void (SWIFT_ASYNC_CONTEXT AsyncContext *, SWIFT_CONTEXT HeapObject *);
585+
void (SWIFT_ASYNC_CONTEXT AsyncContext *, SWIFT_CONTEXT void *);
586586

587587
/// This matches the ABI of a closure `<T>() async throws -> T`
588588
using AsyncGenericClosureEntryPoint =
589589
SWIFT_CC(swiftasync)
590590
void(OpaqueValue *,
591-
SWIFT_ASYNC_CONTEXT AsyncContext *, SWIFT_CONTEXT HeapObject *);
591+
SWIFT_ASYNC_CONTEXT AsyncContext *, SWIFT_CONTEXT void *);
592592

593593
/// This matches the ABI of the resume function of a closure
594594
/// `() async throws -> ()`.
@@ -602,7 +602,7 @@ class AsyncContextPrefix {
602602
// passing the closure context instead of via the async context)
603603
AsyncVoidClosureEntryPoint *__ptrauth_swift_task_resume_function
604604
asyncEntryPoint;
605-
HeapObject *closureContext;
605+
void *closureContext;
606606
SwiftError *errorResult;
607607
};
608608

@@ -615,7 +615,7 @@ class FutureAsyncContextPrefix {
615615
// passing the closure context instead of via the async context)
616616
AsyncGenericClosureEntryPoint *__ptrauth_swift_task_resume_function
617617
asyncEntryPoint;
618-
HeapObject *closureContext;
618+
void *closureContext;
619619
SwiftError *errorResult;
620620
};
621621

include/swift/AST/ASTContext.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,10 @@ class ASTContext final {
482482

483483
#define KNOWN_STDLIB_TYPE_DECL(NAME, DECL_CLASS, NUM_GENERIC_PARAMS) \
484484
/** Retrieve the declaration of Swift.NAME. */ \
485-
DECL_CLASS *get##NAME##Decl() const;
485+
DECL_CLASS *get##NAME##Decl() const; \
486+
\
487+
/** Retrieve the type of Swift.NAME. */ \
488+
Type get##NAME##Type() const;
486489
#include "swift/AST/KnownStdlibTypes.def"
487490

488491
/// Retrieve the declaration of Swift.Optional<T>.Some.
@@ -491,15 +494,18 @@ class ASTContext final {
491494
/// Retrieve the declaration of Swift.Optional<T>.None.
492495
EnumElementDecl *getOptionalNoneDecl() const;
493496

497+
/// Retrieve the declaration of Swift.Void.
498+
TypeAliasDecl *getVoidDecl() const;
499+
500+
/// Retrieve the type of Swift.Void.
501+
Type getVoidType() const;
502+
494503
/// Retrieve the declaration of the "pointee" property of a pointer type.
495504
VarDecl *getPointerPointeePropertyDecl(PointerTypeKind ptrKind) const;
496505

497506
/// Retrieve the type Swift.AnyObject.
498507
CanType getAnyObjectType() const;
499508

500-
/// Retrieve the type Swift.Never.
501-
CanType getNeverType() const;
502-
503509
#define KNOWN_SDK_TYPE_DECL(MODULE, NAME, DECL_CLASS, NUM_GENERIC_PARAMS) \
504510
/** Retrieve the declaration of MODULE.NAME. */ \
505511
DECL_CLASS *get##NAME##Decl() const; \

include/swift/AST/Attr.def

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,16 @@ CONTEXTUAL_SIMPLE_DECL_ATTR(_unsafeMainActor, UnsafeMainActor,
647647
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIBreakingToRemove,
648648
114)
649649

650+
SIMPLE_DECL_ATTR(_implicitSelfCapture, ImplicitSelfCapture,
651+
OnParam | UserInaccessible |
652+
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIBreakingToRemove,
653+
115)
654+
655+
SIMPLE_DECL_ATTR(_inheritActorContext, InheritActorContext,
656+
OnParam | UserInaccessible |
657+
ABIStableToAdd | ABIStableToRemove | APIBreakingToAdd | APIBreakingToRemove,
658+
116)
659+
650660
#undef TYPE_ATTR
651661
#undef DECL_ATTR_ALIAS
652662
#undef CONTEXTUAL_DECL_ATTR_ALIAS

include/swift/AST/Builtins.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,9 @@ BUILTIN_MISC_OPERATION(StartAsyncLet, "startAsyncLet", "", Special)
793793
/// asyncLetEnd(): (Builtin.RawPointer) -> Void
794794
///
795795
/// Ends and destroys an async-let.
796+
/// The ClosureLifetimeFixup pass adds a second operand to the builtin to
797+
/// ensure that optimizations keep the stack-allocated closure arguments alive
798+
/// until the endAsyncLet.
796799
BUILTIN_MISC_OPERATION_WITH_SILGEN(EndAsyncLet, "endAsyncLet", "", Special)
797800

798801
/// createAsyncTaskFuture(): (

include/swift/AST/Expr.h

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,18 @@ class alignas(8) Expr {
292292
Kind : 2
293293
);
294294

295-
SWIFT_INLINE_BITFIELD(ClosureExpr, AbstractClosureExpr, 1,
295+
SWIFT_INLINE_BITFIELD(ClosureExpr, AbstractClosureExpr, 1+1+1,
296296
/// True if closure parameters were synthesized from anonymous closure
297297
/// variables.
298-
HasAnonymousClosureVars : 1
298+
HasAnonymousClosureVars : 1,
299+
300+
/// True if "self" can be captured implicitly without requiring "self."
301+
/// on each member reference.
302+
ImplicitSelfCapture : 1,
303+
304+
/// True if this @Sendable async closure parameter should implicitly
305+
/// inherit the actor context from where it was formed.
306+
InheritActorContext : 1
299307
);
300308

301309
SWIFT_INLINE_BITFIELD_FULL(BindOptionalExpr, Expr, 16,
@@ -3871,6 +3879,8 @@ class ClosureExpr : public AbstractClosureExpr {
38713879
Body(nullptr) {
38723880
setParameterList(params);
38733881
Bits.ClosureExpr.HasAnonymousClosureVars = false;
3882+
Bits.ClosureExpr.ImplicitSelfCapture = false;
3883+
Bits.ClosureExpr.InheritActorContext = false;
38743884
}
38753885

38763886
SourceRange getSourceRange() const;
@@ -3898,7 +3908,27 @@ class ClosureExpr : public AbstractClosureExpr {
38983908
void setHasAnonymousClosureVars() {
38993909
Bits.ClosureExpr.HasAnonymousClosureVars = true;
39003910
}
3901-
3911+
3912+
/// Whether this closure allows "self" to be implicitly captured without
3913+
/// required "self." on each reference.
3914+
bool allowsImplicitSelfCapture() const {
3915+
return Bits.ClosureExpr.ImplicitSelfCapture;
3916+
}
3917+
3918+
void setAllowsImplicitSelfCapture(bool value = true) {
3919+
Bits.ClosureExpr.ImplicitSelfCapture = value;
3920+
}
3921+
3922+
/// Whether this closure should implicitly inherit the actor context from
3923+
/// where it was formed. This only affects @Sendable async closures.
3924+
bool inheritsActorContext() const {
3925+
return Bits.ClosureExpr.InheritActorContext;
3926+
}
3927+
3928+
void setInheritsActorContext(bool value = true) {
3929+
Bits.ClosureExpr.InheritActorContext = value;
3930+
}
3931+
39023932
/// Determine whether this closure expression has an
39033933
/// explicitly-specified result type.
39043934
bool hasExplicitResultType() const { return ArrowLoc.isValid(); }

include/swift/AST/KnownProtocols.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ PROTOCOL(OptionSet)
7171
PROTOCOL(CaseIterable)
7272
PROTOCOL(SIMDScalar)
7373
PROTOCOL(BinaryInteger)
74+
PROTOCOL(RangeReplaceableCollection)
7475

7576
PROTOCOL_(BridgedNSError)
7677
PROTOCOL_(BridgedStoredNSError)

include/swift/AST/KnownStdlibTypes.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
#define KNOWN_STDLIB_TYPE_DECL(NAME, DECL_CLASS, NUM_GENERIC_PARAMS)
2626
#endif
2727

28-
KNOWN_STDLIB_TYPE_DECL(Void, TypeAliasDecl, 0)
29-
3028
KNOWN_STDLIB_TYPE_DECL(Bool, NominalTypeDecl, 0)
3129

3230
KNOWN_STDLIB_TYPE_DECL(Int, NominalTypeDecl, 0)
@@ -89,7 +87,6 @@ KNOWN_STDLIB_TYPE_DECL(Encoder, ProtocolDecl, 1)
8987
KNOWN_STDLIB_TYPE_DECL(Decoder, ProtocolDecl, 1)
9088
KNOWN_STDLIB_TYPE_DECL(KeyedEncodingContainer, NominalTypeDecl, 1)
9189
KNOWN_STDLIB_TYPE_DECL(KeyedDecodingContainer, NominalTypeDecl, 1)
92-
KNOWN_STDLIB_TYPE_DECL(RangeReplaceableCollection, ProtocolDecl, 1)
9390
KNOWN_STDLIB_TYPE_DECL(EncodingError, NominalTypeDecl, 0)
9491
KNOWN_STDLIB_TYPE_DECL(DecodingError, NominalTypeDecl, 0)
9592

0 commit comments

Comments
 (0)