Skip to content

Commit 7bbafc5

Browse files
committed
Merge branch 'main' into mchiu/freebsd
2 parents 8738e72 + e1e9f04 commit 7bbafc5

File tree

314 files changed

+3878
-971
lines changed

Some content is hidden

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

314 files changed

+3878
-971
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286

287287
# utils
288288
/utils/*windows* @compnerd
289+
/utils/build.ps1 @compnerd
289290
/utils/build_swift/ @etcwilde @justice-adams-apple @shahmishal
290291
/utils/generate-xcode @hamishknight
291292
/utils/gyb_sourcekit_support/ @bnbarham @hamishknight @rintaro

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ set(SWIFT_COMPILER_VERSION "" CACHE STRING
336336
"The internal version of the Swift compiler")
337337
set(CLANG_COMPILER_VERSION "" CACHE STRING
338338
"The internal version of the Clang compiler")
339+
set(SWIFT_TOOLCHAIN_VERSION "" CACHE STRING
340+
"The Swift compiler tag")
339341

340342
option(SWIFT_DISABLE_DEAD_STRIPPING
341343
"Turn off Darwin-specific dead stripping for Swift host tools." FALSE)

Runtimes/Supplemental/Synchronization/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,20 @@ add_compile_options(
6363
$<$<COMPILE_LANGUAGE:Swift>:-nostdlibimport>
6464
$<$<COMPILE_LANGUAGE:Swift>:-enable-builtin-module>
6565
$<$<COMPILE_LANGUAGE:Swift>:-strict-memory-safety>
66+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature NoncopyableGenerics2>"
67+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature SuppressedAssociatedTypes>"
68+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature SE427NoInferenceOnExtension>"
69+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature NonescapableTypes>"
70+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature LifetimeDependence>"
71+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature InoutLifetimeDependence>"
72+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature LifetimeDependenceMutableAccessors>"
73+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-upcoming-feature MemberImportVisibility>"
6674
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature RawLayout>"
6775
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature StaticExclusiveOnly>"
6876
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature Extern>"
77+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enforce-exclusivity=unchecked>"
78+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>"
79+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-lexical-lifetimes=false>"
6980
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
7081
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")
7182

SwiftCompilerSources/Sources/AST/Declarations.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public class NominalTypeDecl: GenericTypeDecl {
5858
}
5959
}
6060

61-
final public class EnumDecl: NominalTypeDecl {}
61+
final public class EnumDecl: NominalTypeDecl {
62+
public var hasRawType: Bool { bridged.Enum_hasRawType() }
63+
}
6264

6365
final public class StructDecl: NominalTypeDecl {
6466
public var hasUnreferenceableStorage: Bool { bridged.Struct_hasUnreferenceableStorage() }
@@ -122,6 +124,8 @@ final public class TopLevelCodeDecl: Decl {}
122124

123125
final public class ImportDecl: Decl {}
124126

127+
final public class UsingDecl: Decl {}
128+
125129
final public class PrecedenceGroupDecl: Decl {}
126130

127131
final public class MissingDecl: Decl {}

SwiftCompilerSources/Sources/AST/Registration.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public func registerAST() {
3636
registerDecl(ExtensionDecl.self)
3737
registerDecl(TopLevelCodeDecl.self)
3838
registerDecl(ImportDecl.self)
39+
registerDecl(UsingDecl.self)
3940
registerDecl(PrecedenceGroupDecl.self)
4041
registerDecl(MissingDecl.self)
4142
registerDecl(MissingMemberDecl.self)

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceInsertion.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,11 @@ struct VariableIntroducerUseDefWalker : LifetimeDependenceUseDefValueWalker, Lif
413413
}
414414

415415
mutating func introducer(_ value: Value, _ owner: Value?) -> WalkResult {
416+
if let addrToPtr = value as? AddressToPointerInst {
417+
// AddressToPointer introduces the value dependence. To handle Builtin.addressOfBorrow, follow the address that
418+
// the pointer is derived from.
419+
return walkUp(address: addrToPtr.address)
420+
}
416421
return visitorClosure(value)
417422
}
418423

SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyApply.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ private func tryOptimizeEnumComparison(apply: ApplyInst, _ context: SimplifyCont
135135
let lhs = apply.arguments[0]
136136
let rhs = apply.arguments[1]
137137
guard let enumDecl = lhs.type.nominal as? EnumDecl,
138+
enumDecl.hasRawType,
138139
!enumDecl.isResilient(in: apply.parentFunction),
139140
!enumDecl.hasClangNode,
140141
lhs.type.isAddress,

SwiftCompilerSources/Sources/SIL/Argument.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,15 @@ public struct ArgumentConventions : Collection, CustomStringConvertible {
285285
if let paramIdx = parameterIndex(for: argumentIndex) {
286286
return convention.parameters[paramIdx].convention
287287
}
288-
let resultInfo = convention.indirectSILResults[argumentIndex]
288+
let resultInfo = convention.indirectSILResult(at: argumentIndex)
289289
return ArgumentConvention(result: resultInfo.convention)
290290
}
291291

292292
public subscript(result argumentIndex: Int) -> ResultInfo? {
293293
if parameterIndex(for: argumentIndex) != nil {
294294
return nil
295295
}
296-
return convention.indirectSILResults[argumentIndex]
296+
return convention.indirectSILResult(at: argumentIndex)
297297
}
298298

299299
public subscript(parameter argumentIndex: Int) -> ParameterInfo? {

SwiftCompilerSources/Sources/SIL/FunctionConvention.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,15 @@ public struct FunctionConvention : CustomStringConvertible {
5757
: SILFunctionType_getNumPackResults(functionType.bridged)
5858
}
5959

60-
/// Indirect results including the error.
61-
public var indirectSILResults: LazyFilterSequence<Results> {
62-
hasLoweredAddresses
63-
? results.lazy.filter { $0.isSILIndirect }
64-
: results.lazy.filter { $0.convention == .pack }
60+
/// Returns the indirect result - including the error - at `index`.
61+
public func indirectSILResult(at index: Int) -> ResultInfo {
62+
let indirectResults = results.lazy.filter {
63+
hasLoweredAddresses ? $0.isSILIndirect : $0.convention == .pack
64+
}
65+
// Note that subscripting a LazyFilterCollection (with the base index, e.g. `Int`) does not work
66+
// as expected, because it returns the nth element of the base collection!
67+
// Therefore we need to implement the subscript "manually".
68+
return indirectResults.enumerated().first{ $0.offset == index }!.element
6569
}
6670

6771
public var parameters: Parameters {

include/swift/ABI/Metadata.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2787,11 +2787,22 @@ using ResilientWitnessesHeader = TargetResilientWitnessesHeader<InProcess>;
27872787
/// global actor protocol.
27882788
template<typename Runtime>
27892789
struct TargetGlobalActorReference {
2790+
private:
2791+
using SignedDescriptorPointer =
2792+
const TargetProtocolConformanceDescriptor<Runtime>
2793+
*__ptrauth_swift_protocol_conformance_descriptor;
2794+
2795+
public:
27902796
/// The type of the global actor.
27912797
RelativeDirectPointer<const char, /*nullable*/ false> type;
27922798

27932799
/// The conformance of the global actor to the GlobalActor protocol.
2794-
TargetRelativeProtocolConformanceDescriptorPointer<Runtime> conformance;
2800+
RelativeIndirectablePointer<
2801+
const TargetProtocolConformanceDescriptor<Runtime>,
2802+
/*nullable*/ false,
2803+
/*offset*/ int32_t,
2804+
/*indirect type*/ SignedDescriptorPointer>
2805+
conformance;
27952806
};
27962807

27972808
/// Describes the context of a protocol conformance that is relevant when

0 commit comments

Comments
 (0)