Skip to content

Commit b429191

Browse files
committed
Merge branch 'main' into rebranch
Conflicts: include/swift/SIL/SILBuilder.h
2 parents 5c49c67 + feece9d commit b429191

File tree

57 files changed

+871
-223
lines changed

Some content is hidden

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

57 files changed

+871
-223
lines changed

benchmark/single-source/SetTests.swift

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ let setAB = Set(0 ..< size) // 0 ..< 400
2525
let setCD = Set(size ..< 2 * size) // 400 ..< 800
2626
let setBC = Set(size - quarter ..< 2 * size - quarter) // 300 ..< 700
2727
let setB = Set(size - quarter ..< size) // 300 ..< 400
28+
let setCDS = Set(size ..< (size + (size/4))) // 400 ..< 500
2829

2930
let setOAB = Set(setAB.map(Box.init))
3031
let setOCD = Set(setCD.map(Box.init))
3132
let setOBC = Set(setBC.map(Box.init))
3233
let setOB = Set(setB.map(Box.init))
34+
let setOCDS = Set(setCDS.map(Box.init))
3335

3436
let countA = size - quarter // 300
3537
let countB = quarter // 100
@@ -368,6 +370,16 @@ public let SetTests = [
368370
runFunction: { n in run_SetIsDisjointBox(setOAB, setOCD, true, 50 * n) },
369371
tags: [.validation, .api, .Set],
370372
setUpFunction: { blackHole([setOAB, setOCD]) }),
373+
BenchmarkInfo(
374+
name: "Set.isDisjoint.Smaller.Int0",
375+
runFunction: { n in run_SetIsDisjointIntCommutative(setAB, setCDS, true, 50 * n) },
376+
tags: [.validation, .api, .Set],
377+
setUpFunction: { blackHole([setAB, setCDS]) }),
378+
BenchmarkInfo(
379+
name: "Set.isDisjoint.Smaller.Box0",
380+
runFunction: { n in run_SetIsDisjointBoxCommutative(setOAB, setOCDS, true, 50 * n) },
381+
tags: [.validation, .api, .Set],
382+
setUpFunction: { blackHole([setOAB, setOCDS]) }),
371383
BenchmarkInfo(
372384
name: "Set.isDisjoint.Int25",
373385
runFunction: { n in run_SetIsDisjointInt(setB, setAB, false, 5000 * n) },
@@ -891,6 +903,22 @@ public func run_SetIsDisjointInt(
891903
}
892904
}
893905

906+
// Run isDisjoint Int switching the order of the two sets.
907+
@inline(never)
908+
public func run_SetIsDisjointIntCommutative(
909+
_ a: Set<Int>,
910+
_ b: Set<Int>,
911+
_ r: Bool,
912+
_ n: Int) {
913+
for _ in 0 ..< n {
914+
let isDisjointA = a.isDisjoint(with: identity(b))
915+
CheckResults(isDisjointA == r)
916+
917+
let isDisjointB = b.isDisjoint(with: identity(a))
918+
CheckResults(isDisjointB == r)
919+
}
920+
}
921+
894922
@inline(never)
895923
public func run_SetIsDisjointSeqInt(
896924
_ a: Set<Int>,
@@ -1091,6 +1119,22 @@ func run_SetIsDisjointBox(
10911119
}
10921120
}
10931121

1122+
// Run isDisjoint Box switching the order of the two sets.
1123+
@inline(never)
1124+
func run_SetIsDisjointBoxCommutative(
1125+
_ a: Set<Box<Int>>,
1126+
_ b: Set<Box<Int>>,
1127+
_ r: Bool,
1128+
_ n: Int) {
1129+
for _ in 0 ..< n {
1130+
let isDisjointA = a.isDisjoint(with: identity(b))
1131+
CheckResults(isDisjointA == r)
1132+
1133+
let isDisjointB = b.isDisjoint(with: identity(a))
1134+
CheckResults(isDisjointB == r)
1135+
}
1136+
}
1137+
10941138
@inline(never)
10951139
func run_SetIsDisjointSeqBox(
10961140
_ a: Set<Box<Int>>,

cmake/modules/Libdispatch.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ endif()
4747
# Build any target libdispatch if needed.
4848
foreach(sdk ${SWIFT_SDKS})
4949
# Darwin targets have libdispatch available, do not build it.
50-
if(NOT "${sdk}" IN_LIST SWIFT_DARWIN_PLATFORMS)
50+
# Wasm/WASI doesn't support libdispatch yet. See https://bugs.swift.org/browse/SR-12097 for more details.
51+
if(NOT "${sdk}" IN_LIST SWIFT_DARWIN_PLATFORMS AND NOT "${sdk}" STREQUAL WASI)
5152
list(APPEND DISPATCH_SDKS "${sdk}")
5253
endif()
5354
endforeach()

docs/HowToGuides/GettingStarted.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ toolchain as a one-off, there are a couple of differences:
1616
- [Troubleshooting cloning issues](#troubleshooting-cloning-issues)
1717
- [Installing dependencies](#installing-dependencies)
1818
- [macOS](#macOS)
19-
- [Ubuntu Linux](#ubuntu-linux)
19+
- [Linux](#linux)
2020
- [Building the project for the first time](#building-the-project-for-the-first-time)
2121
- [Spot check dependencies](#spot-check-dependencies)
2222
- [The roles of different tools](#the-roles-of-different-tools)

docs/SIL.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3079,7 +3079,7 @@ alloc_stack
30793079
```````````
30803080
::
30813081

3082-
sil-instruction ::= 'alloc_stack' '[dynamic_lifetime]'? sil-type (',' debug-var-attr)*
3082+
sil-instruction ::= 'alloc_stack' '[dynamic_lifetime]'? '[lexical]'? sil-type (',' debug-var-attr)*
30833083

30843084
%1 = alloc_stack $T
30853085
// %1 has type $*T
@@ -3102,6 +3102,9 @@ The ``dynamic_lifetime`` attribute specifies that the initialization and
31023102
destruction of the stored value cannot be verified at compile time.
31033103
This is the case, e.g. for conditionally initialized objects.
31043104

3105+
The optional ``lexical`` attribute specifies that the operand corresponds to a
3106+
local variable in the Swift source.
3107+
31053108
The memory is not retainable. To allocate a retainable box for a value
31063109
type, use ``alloc_box``.
31073110

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,9 @@ ERROR(serialization_name_mismatch_repl,none,
782782
ERROR(serialization_target_incompatible,Fatal,
783783
"module %0 was created for incompatible target %1: %2",
784784
(Identifier, StringRef, StringRef))
785+
ERROR(serialization_sdk_mismatch,Fatal,
786+
"cannot load module %0 built with SDK '%1' when using SDK '%2': %3",
787+
(Identifier, StringRef, StringRef, StringRef))
785788
ERROR(serialization_target_incompatible_repl,none,
786789
"module %0 was created for incompatible target %1: %2",
787790
(Identifier, StringRef, StringRef))

include/swift/AST/IRGenOptions.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ enum class IRGenEmbedMode : unsigned {
8181
EmbedBitcode
8282
};
8383

84+
enum class SwiftAsyncFramePointerKind : unsigned {
85+
Auto, // Choose Swift async extended frame info based on deployment target.
86+
Always, // Unconditionally emit Swift async extended frame info.
87+
Never, // Don't emit Swift async extended frame info.
88+
};
89+
8490
using clang::PointerAuthSchema;
8591

8692
struct PointerAuthOptions : clang::PointerAuthOptions {
@@ -282,6 +288,8 @@ class IRGenOptions {
282288

283289
IRGenLLVMLTOKind LLVMLTOKind : 2;
284290

291+
SwiftAsyncFramePointerKind SwiftAsyncFramePointer : 2;
292+
285293
/// Add names to LLVM values.
286294
unsigned HasValueNamesSetting : 1;
287295
unsigned ValueNames : 1;
@@ -393,7 +401,9 @@ class IRGenOptions {
393401
Playground(false),
394402
EmitStackPromotionChecks(false), FunctionSections(false),
395403
PrintInlineTree(false), EmbedMode(IRGenEmbedMode::None),
396-
LLVMLTOKind(IRGenLLVMLTOKind::None), HasValueNamesSetting(false),
404+
LLVMLTOKind(IRGenLLVMLTOKind::None),
405+
SwiftAsyncFramePointer(SwiftAsyncFramePointerKind::Always),
406+
HasValueNamesSetting(false),
397407
ValueNames(false), EnableReflectionMetadata(true),
398408
EnableReflectionNames(true), EnableAnonymousContextMangledNames(false),
399409
ForcePublicLinkage(false), LazyInitializeClassMetadata(false),

include/swift/AST/SearchPathOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ class SearchPathOptions {
8282
/// would for a non-system header.
8383
bool DisableModulesValidateSystemDependencies = false;
8484

85+
/// Enforce loading only serialized modules built with the same SDK
86+
/// as the context loading it.
87+
bool EnableSameSDKCheck = true;
88+
8589
/// A set of compiled modules that may be ready to use.
8690
std::vector<std::string> CandidateCompiledModules;
8791

include/swift/Basic/LangOptions.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ namespace swift {
127127
/// The target variant SDK version, if known.
128128
Optional<llvm::VersionTuple> VariantSDKVersion;
129129

130+
/// The SDK canonical name, if known.
131+
std::string SDKName;
132+
130133
/// The alternate name to use for the entry point instead of main.
131134
std::string entryPointFunctionName = "main";
132135

@@ -301,6 +304,9 @@ namespace swift {
301304
/// Enable experimental concurrency model.
302305
bool EnableExperimentalConcurrency = false;
303306

307+
/// Enable experimental support for emitting defined borrow scopes.
308+
bool EnableExperimentalDefinedLifetimes = false;
309+
304310
/// Enable experimental support for named opaque result types, e.g.
305311
/// `func f() -> <T> T`.
306312
bool EnableExperimentalNamedOpaqueTypes = false;

include/swift/Option/FrontendOptions.td

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ def enable_experimental_concurrency :
247247
Flag<["-"], "enable-experimental-concurrency">,
248248
HelpText<"Enable experimental concurrency model">;
249249

250+
def enable_experimental_defined_lifetimes :
251+
Flag<["-"], "enable-experimental-defined-lifetimes">,
252+
HelpText<"Enable experimental defined lifetimes">;
253+
250254
def enable_experimental_distributed :
251255
Flag<["-"], "enable-experimental-distributed">,
252256
HelpText<"Enable experimental 'distributed' actors and functions">;
@@ -802,6 +806,10 @@ def type_info_dump_filter_EQ : Joined<["-"], "type-info-dump-filter=">,
802806
Flags<[FrontendOption]>,
803807
HelpText<"One of 'all', 'resilient' or 'fragile'">;
804808

809+
def swift_async_frame_pointer_EQ : Joined<["-"], "swift-async-frame-pointer=">,
810+
Flags<[FrontendOption]>,
811+
HelpText<"One of 'auto', 'always' or 'never'">;
812+
805813
def previous_module_installname_map_file
806814
: Separate<["-"], "previous-module-installname-map-file">, MetaVarName<"<path>">,
807815
HelpText<"Path to a Json file indicating module name to installname map for @_originallyDefinedIn">;
@@ -827,6 +835,9 @@ def target_sdk_version : Separate<["-"], "target-sdk-version">,
827835
def target_variant_sdk_version : Separate<["-"], "target-variant-sdk-version">,
828836
HelpText<"The version of target variant SDK used for compilation">;
829837

838+
def target_sdk_name : Separate<["-"], "target-sdk-name">,
839+
HelpText<"Canonical name of the target SDK used for compilation">;
840+
830841
def extra_clang_options_only : Flag<["-"], "only-use-extra-clang-opts">,
831842
HelpText<"Options passed via -Xcc are sufficient for Clang configuration">;
832843

include/swift/SIL/SILBuilder.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,16 @@ class SILBuilder {
381381

382382
AllocStackInst *createAllocStack(SILLocation Loc, SILType elementType,
383383
Optional<SILDebugVariable> Var = None,
384-
bool hasDynamicLifetime = false) {
384+
bool hasDynamicLifetime = false,
385+
bool isLexical = false) {
385386
llvm::SmallString<4> Name;
386387
Loc.markAsPrologue();
387388
assert((!dyn_cast_or_null<VarDecl>(Loc.getAsASTNode<Decl>()) || Var) &&
388389
"location is a VarDecl, but SILDebugVariable is empty");
389390
return insert(AllocStackInst::create(
390391
getSILDebugLocation(Loc), elementType, getFunction(),
391-
substituteAnonymousArgs(Name, Var, Loc), hasDynamicLifetime));
392+
substituteAnonymousArgs(Name, Var, Loc), hasDynamicLifetime,
393+
isLexical));
392394
}
393395

394396
AllocRefInst *createAllocRef(SILLocation Loc, SILType ObjectType,

0 commit comments

Comments
 (0)