Skip to content

Commit 1098054

Browse files
authored
Merge branch 'main' into tbkka-assertions2
2 parents 1d961ba + e3de3da commit 1098054

File tree

741 files changed

+12838
-4468
lines changed

Some content is hidden

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

741 files changed

+12838
-4468
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,10 @@ option(SWIFT_ENABLE_SYNCHRONIZATION
712712
"Enable build of the Swift Synchronization module"
713713
FALSE)
714714

715+
option(SWIFT_ENABLE_VOLATILE
716+
"Enable build of the Swift Volatile module"
717+
FALSE)
718+
715719
option(SWIFT_ENABLE_DISPATCH
716720
"Enable use of libdispatch"
717721
TRUE)
@@ -1359,6 +1363,7 @@ if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
13591363
message(STATUS "Unicode Support: ${SWIFT_STDLIB_ENABLE_UNICODE_DATA}")
13601364
message(STATUS "Observation Support: ${SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION}")
13611365
message(STATUS "Synchronization Support: ${SWIFT_ENABLE_SYNCHRONIZATION}")
1366+
message(STATUS "Volatile Support: ${SWIFT_ENABLE_VOLATILE}")
13621367
message(STATUS "")
13631368
else()
13641369
message(STATUS "Not building Swift standard library, SDK overlays, and runtime")

SwiftCompilerSources/Sources/Optimizer/Utilities/Devirtualization.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ private func devirtualize(destroy: some DevirtualizableDestroy, _ context: some
3333
if !type.isMoveOnly {
3434
return true
3535
}
36-
precondition(type.isNominal, "non-copyable non-nominal types not supported, yet")
36+
37+
if !type.isNominal {
38+
// E.g. a non-copyable generic function parameter
39+
return true
40+
}
3741

3842
let result: Bool
3943
if type.nominal.hasValueDeinit && !destroy.shouldDropDeinit {

SwiftCompilerSources/Sources/Optimizer/Utilities/OwnershipLiveness.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ func computeLinearLiveness(for definingValue: Value, _ context: Context)
6464
var range = InstructionRange(for: definingValue, context)
6565

6666
// Compute liveness.
67-
definingValue.lookThroughBorrowedFromUser.uses.endingLifetime.forEach {
68-
range.insert($0.instruction)
67+
for use in definingValue.lookThroughBorrowedFromUser.uses {
68+
let instruction = use.instruction
69+
if use.endsLifetime || instruction is ExtendLifetimeInst {
70+
range.insert(instruction)
71+
}
6972
}
7073
return range
7174
}

SwiftCompilerSources/Sources/SIL/Argument.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ final public class FunctionArgument : Argument {
6060
return index < parentFunction.numIndirectResultArguments
6161
}
6262

63-
public var hasResultDependsOn : Bool {
64-
return bridged.hasResultDependsOn()
65-
}
66-
6763
/// If the function's result depends on this argument, return the
6864
/// kind of dependence.
6965
public var resultDependence: LifetimeDependenceConvention? {

SwiftCompilerSources/Sources/SIL/Function.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ final public class Function : CustomStringConvertible, HasShortDescription, Hash
147147
case .IsNotSerialized: return .notSerialized
148148
case .IsSerialized: return .serialized
149149
case .IsSerializedForPackage: return .serializedForPackage
150-
default: fatalError()
150+
@unknown default: fatalError()
151151
}
152152
}
153153

@@ -156,7 +156,6 @@ final public class Function : CustomStringConvertible, HasShortDescription, Hash
156156
case .notSerialized: return .IsNotSerialized
157157
case .serialized: return .IsSerialized
158158
case .serializedForPackage: return .IsSerializedForPackage
159-
default: fatalError()
160159
}
161160
}
162161

@@ -290,10 +289,6 @@ extension Function {
290289
public var hasResultDependence: Bool {
291290
convention.resultDependencies != nil
292291
}
293-
294-
public var hasResultDependsOnSelf: Bool {
295-
return bridged.hasResultDependsOnSelf()
296-
}
297292
}
298293

299294
public struct ArgumentTypeArray : RandomAccessCollection, FormattedLikeArray {

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ final public class DestroyAddrInst : Instruction, UnaryInstruction {
514514

515515
final public class EndLifetimeInst : Instruction, UnaryInstruction {}
516516

517+
final public class ExtendLifetimeInst : Instruction, UnaryInstruction {}
518+
517519
final public class InjectEnumAddrInst : Instruction, UnaryInstruction, EnumInstruction {
518520
public var `enum`: Value { operand.value }
519521
public var caseIndex: Int { bridged.InjectEnumAddrInst_caseIndex() }

SwiftCompilerSources/Sources/SIL/Registration.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public func registerSILClasses() {
7878
register(DestroyValueInst.self)
7979
register(DestroyAddrInst.self)
8080
register(EndLifetimeInst.self)
81+
register(ExtendLifetimeInst.self)
8182
register(StrongCopyUnownedValueInst.self)
8283
register(StrongCopyUnmanagedValueInst.self)
8384
register(StrongCopyWeakValueInst.self)

benchmark/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,13 @@ set(SWIFT_BENCH_MODULES
209209
single-source/WordCount
210210
single-source/XorLoop
211211
cxx-source/CreateObjects
212-
cxx-source/CxxSetToCollection
212+
# Disabled for rdar://128520766
213+
# cxx-source/CxxSetToCollection
213214
cxx-source/CxxStringConversion
214-
cxx-source/CxxVectorSum
215-
cxx-source/ReadAccessor
215+
# Disabled for rdar://128520766
216+
# cxx-source/CxxVectorSum
217+
# TODO: rdar://92120528
218+
# cxx-source/ReadAccessor
216219
)
217220

218221
set(SWIFT_MULTISOURCE_SWIFT_BENCHES

benchmark/single-source/Breadcrumbs.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public let benchmarks: [BenchmarkInfo] = [
2929

3030
CopyUTF16CodeUnits(workload: asciiWorkload, count: 500).info,
3131
CopyUTF16CodeUnits(workload: mixedWorkload, count: 500).info,
32+
CopyUTF16CodeUnits(workload: longMixedWorkload, count: 50).info,
33+
34+
CopyAllUTF16CodeUnits(workload: asciiWorkload, count: 1_000).info,
35+
CopyAllUTF16CodeUnits(workload: mixedWorkload, count: 100).info,
36+
CopyAllUTF16CodeUnits(workload: longASCIIWorkload, count: 7).info,
37+
CopyAllUTF16CodeUnits(workload: longMixedWorkload, count: 1).info,
3238

3339
MutatedUTF16ToIdx(workload: asciiWorkload, count: 50).info,
3440
MutatedUTF16ToIdx(workload: mixedWorkload, count: 50).info,
@@ -364,6 +370,11 @@ class CopyUTF16CodeUnits: BenchmarkBase {
364370
self.count = count
365371
super.init(name: "Breadcrumbs.CopyUTF16CodeUnits", workload: workload)
366372
}
373+
374+
init(name: String, workload: Workload, count: Int) {
375+
self.count = count
376+
super.init(name: name, workload: workload)
377+
}
367378

368379
override func setUp() {
369380
super.setUp()
@@ -393,6 +404,21 @@ class CopyUTF16CodeUnits: BenchmarkBase {
393404
}
394405
}
395406

407+
class CopyAllUTF16CodeUnits : CopyUTF16CodeUnits {
408+
override init(workload: Workload, count: Int) {
409+
super.init(
410+
name: "Breadcrumbs.CopyAllUTF16CodeUnits",
411+
workload: workload,
412+
count: count
413+
)
414+
}
415+
416+
override func setUp() {
417+
super.setUp()
418+
inputIndices = Array(repeating: 0 ..< inputString.utf16.count, count: count)
419+
}
420+
}
421+
396422
/// This is like `UTF16ToIdx` but appends to the string after every index
397423
/// conversion. In effect, this tests breadcrumb creation performance.
398424
class MutatedUTF16ToIdx: BenchmarkBase {

benchmark/single-source/CharacterRecognizer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import TestsUtils
1414

1515
public var benchmarks: [BenchmarkInfo] {
16-
guard #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) else {
16+
guard #available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *) else {
1717
return []
1818
}
1919
return [
@@ -82,7 +82,7 @@ let _asciiString = #"""
8282
"""#
8383
let asciiString = String(repeating: _asciiString, count: 10)
8484

85-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
85+
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
8686
func run(string: String, n: Int) {
8787
var state = Unicode._CharacterRecognizer()
8888
var c = 0

0 commit comments

Comments
 (0)