Skip to content

Commit 989ec93

Browse files
authored
Merge branch 'main' into wip-deprecate-extractisolation
2 parents 1ea746e + 17ae36e commit 989ec93

File tree

714 files changed

+9789
-7630
lines changed

Some content is hidden

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

714 files changed

+9789
-7630
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
/lib/SIL/IR/SILLocation* @adrian-prantl
167167
/lib/SIL/IR/SILProfiler.cpp @bnbarham @hamishknight @rintaro
168168
/lib/SILGen/ @jckarter
169+
/lib/SILGen/*Availability* @tshortli
169170
/lib/SILGen/*Distributed* @ktoso
170171
/lib/SILOptimizer/ @eeckstein
171172
/lib/SILOptimizer/**/*DebugInfo* @adrian-prantl
@@ -213,6 +214,7 @@
213214

214215
# test
215216
/test/*Demangl*/ @rjmccall
217+
/test/Availability/ @tshortli
216218
/test/ASTGen/ @bnbarham @CodaFi @hamishknight @rintaro
217219
/test/Concurrency/ @ktoso
218220
/test/Constraints/ @hborla @xedin
@@ -298,6 +300,8 @@
298300
/utils/swift_build_support/products/sourcekitlsp.py @bnbarham @hamishknight @rintaro
299301
/utils/swift_build_support/products/swiftformat.py @allevato @bnbarham @hamishknight @rintaro
300302
/utils/swift_build_support/products/swiftsyntax.py @bnbarham @hamishknight @rintaro
303+
/utils/swift_build_support/products/wasm* @bnbarham @MaxDesiatov @kateinoigakukun
304+
/utils/swift_build_support/products/wasi* @bnbarham @MaxDesiatov @kateinoigakukun
301305
/utils/update-checkout* @etcwilde @justice-adams-apple @shahmishal
302306
/utils/update_checkout/ @etcwilde @justice-adams-apple @shahmishal
303307
/utils/update_checkout/update-checkout-config.json @shahmishal

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
10711071
set(SWIFT_USE_LINKER_default "")
10721072
elseif(DISTRO_NAME STREQUAL "Amazon Linux 2023")
10731073
set(SWIFT_USE_LINKER_default "lld")
1074+
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
1075+
set(SWIFT_USE_LINKER_default "lld")
10741076
else()
10751077
get_gold_version(gold_version)
10761078
if(NOT gold_version)

Runtimes/Overlay/Android/clang/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ install(FILES
3232
android.modulemap
3333
SwiftAndroidNDK.h
3434
SwiftBionic.h
35-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/${SwiftOverlay_PLATFORM_SUBDIR}/${SwiftOverlay_ARCH_SUBDIR})
35+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/swift/${SwiftOverlay_PLATFORM_SUBDIR}/${SwiftOverlay_ARCH_SUBDIR})
3636

3737
install(FILES
3838
posix_filesystem.apinotes

SwiftCompilerSources/Sources/AST/Declarations.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,9 @@ extension OptionalBridgedDeclObj {
157157
public var decl: Decl? { obj.getAs(Decl.self) }
158158
public func getAs<T: Decl>(_ declType: T.Type) -> T? { obj.getAs(T.self) }
159159
}
160+
161+
extension Optional where Wrapped == Decl {
162+
public var bridged: OptionalBridgedDeclObj {
163+
OptionalBridgedDeclObj(self?.bridged.obj)
164+
}
165+
}

SwiftCompilerSources/Sources/AST/DiagnosticEngine.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2022 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2022 - 2025 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -11,10 +11,9 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import ASTBridging
14-
1514
import Basic
1615

17-
public typealias DiagID = BridgedDiagID
16+
public typealias DiagID = swift.DiagID
1817

1918
public protocol DiagnosticArgument {
2019
func _withBridgedDiagnosticArgument(_ fn: (BridgedDiagnosticArgument) -> Void)
@@ -130,6 +129,17 @@ public struct DiagnosticEngine {
130129
closure()
131130
}
132131

132+
// FIXME: Remove this overload once https://github.com/swiftlang/swift/issues/82318 is fixed.
133+
public func diagnose(
134+
_ id: DiagID,
135+
arguments args: [DiagnosticArgument],
136+
at position: SourceLoc?,
137+
highlight: CharSourceRange? = nil,
138+
fixIts: [DiagnosticFixIt] = []
139+
) {
140+
diagnose(id, args, at: position, highlight: highlight, fixIts: fixIts)
141+
}
142+
133143
public func diagnose(_ id: DiagID,
134144
_ args: DiagnosticArgument...,
135145
at position: SourceLoc?,

SwiftCompilerSources/Sources/AST/Type.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ extension TypeProperties {
141141
public var isMetatype: Bool { rawType.bridged.isMetatypeType() }
142142
public var isExistentialMetatype: Bool { rawType.bridged.isExistentialMetatypeType() }
143143
public var isDynamicSelf: Bool { rawType.bridged.isDynamicSelf()}
144+
public var isBox: Bool { rawType.bridged.isBox() }
144145

145146
/// True if this is the type which represents an integer literal used in a type position.
146147
/// For example `N` in `struct T<let N: Int> {}`

SwiftCompilerSources/Sources/Optimizer/DataStructures/BasicBlockRange.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,29 @@ struct BasicBlockRange : CustomStringConvertible, NoReflectionChildren {
7777
}
7878

7979
/// Insert a potential end block.
80-
mutating func insert(_ block: BasicBlock) {
80+
///
81+
/// Returns true if the begin-block is reached during backward propagation.
82+
/// Usually this is not relevant, but InstructionRange needs this information.
83+
@discardableResult
84+
mutating func insert(_ block: BasicBlock) -> Bool {
8185
if wasInserted.insert(block) {
8286
inserted.append(block)
8387
}
8488
worklist.pushIfNotVisited(block)
89+
var visitedBeginBlock = false
8590
while let b = worklist.pop() {
8691
inclusiveRange.append(b)
8792
if b != begin {
8893
for pred in b.predecessors {
94+
if pred == begin {
95+
visitedBeginBlock = true
96+
}
8997
worklist.pushIfNotVisited(pred)
9098
inExclusiveRange.insert(pred)
9199
}
92100
}
93101
}
102+
return visitedBeginBlock
94103
}
95104

96105
/// Insert a sequence of potential end blocks.

SwiftCompilerSources/Sources/Optimizer/DataStructures/InstructionRange.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ struct InstructionRange : CustomStringConvertible, NoReflectionChildren {
8080
mutating func insert(_ inst: Instruction) {
8181
insertedInsts.insert(inst)
8282
insertIntoRange(instructions: ReverseInstructionList(first: inst.previous))
83-
blockRange.insert(inst.parentBlock)
84-
if inst.parentBlock != blockRange.begin {
83+
if blockRange.insert(inst.parentBlock) {
8584
// The first time an instruction is inserted in another block than the begin-block we need to insert
8685
// instructions from the begin instruction to the end of the begin block.
8786
// For subsequent insertions this is a no-op: `insertIntoRange` will return immediately because those

SwiftCompilerSources/Sources/Optimizer/DataStructures/Worklist.swift

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,63 @@ extension InstructionWorklist {
110110
}
111111
}
112112

113+
/// A worklist for `Function`s.
114+
struct FunctionWorklist {
115+
116+
// The current functions in the worklist.
117+
private(set) var functions = Array<Function>()
118+
119+
// All functions which were ever pushed to the worklist.
120+
private var pushedFunctions = Set<Function>()
121+
122+
mutating func pushIfNotVisited(_ function: Function) {
123+
if pushedFunctions.insert(function).inserted {
124+
functions.append(function)
125+
}
126+
}
127+
128+
mutating func pushIfNotVisited(contentsOf functions: [Function]) {
129+
for f in functions {
130+
pushIfNotVisited(f)
131+
}
132+
}
133+
134+
mutating func pop() -> Function? {
135+
return functions.popLast()
136+
}
137+
}
138+
139+
/// Like `ValueWorklist`, but allows pushing `Value`s from different functions -
140+
/// at the cost of a less efficient implementation.
141+
struct CrossFunctionValueWorklist {
142+
143+
// The current values in the worklist.
144+
private(set) var values = Array<Value>()
145+
146+
// All values which were ever pushed to the worklist.
147+
private var pushedValues = Set<ObjectIdentifier>(minimumCapacity: 8)
148+
149+
init() {
150+
values.reserveCapacity(8)
151+
}
152+
153+
mutating func pop() -> Value? {
154+
return values.popLast()
155+
}
156+
157+
mutating func pushIfNotVisited(_ value: Value) {
158+
if pushedValues.insert(ObjectIdentifier(value)).inserted {
159+
values.append(value)
160+
}
161+
}
162+
163+
mutating func pushIfNotVisited<S: Sequence>(contentsOf values: S) where S.Element == Value {
164+
for value in values {
165+
pushIfNotVisited(value)
166+
}
167+
}
168+
169+
func hasBeenPushed(_ value: Value) -> Bool {
170+
return pushedValues.contains(ObjectIdentifier(value))
171+
}
172+
}

0 commit comments

Comments
 (0)