Skip to content

Commit 5873934

Browse files
committed
Merge branch 'release/5.4' of github.com:apple/swift into swiftwasm-release/5.4
# Conflicts: # stdlib/private/CMakeLists.txt # test/CMakeLists.txt
2 parents 7a04fb3 + a1a79f0 commit 5873934

File tree

759 files changed

+25147
-7830
lines changed

Some content is hidden

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

759 files changed

+25147
-7830
lines changed

.mailmap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Adrian-Constantin Popescu <[email protected]> <[email protected]>
22
33
4-
4+
55
Alexis Beingessner <[email protected]> <[email protected]>
66
77
@@ -79,6 +79,7 @@ Joe Shajrawi <[email protected]> <[email protected]>
7979
8080
8181
82+
8283
8384
8485
Kevin Saldaña <[email protected]>

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1989,7 +1989,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
19891989
doSomething(x: 0, y: 0) // argument labels are required
19901990
```
19911991

1992-
Unapplied references to functions or initializers no longer carry argument labels. For example:
1992+
Unapplied references to functions or initializers no longer carry argument labels. For example:
19931993

19941994
```swift
19951995
let f = doSomething(x:y:) // inferred type is now (Int, Int) -> Void

CMakeLists.txt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,24 @@ option(SWIFT_BUILD_ONLY_SYNTAXPARSERLIB "Only build the Swift Syntax Parser libr
440440
option(SWIFT_BUILD_SOURCEKIT "Build SourceKit" TRUE)
441441
option(SWIFT_ENABLE_SOURCEKIT_TESTS "Enable running SourceKit tests" ${SWIFT_BUILD_SOURCEKIT})
442442

443+
# Use dispatch as the system scheduler by default.
444+
# For convenience, we set this to false when concurrency is disabled.
445+
set(SWIFT_CONCURRENCY_USES_DISPATCH FALSE)
446+
if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY AND NOT SWIFT_STDLIB_SINGLE_THREADED_RUNTIME)
447+
set(SWIFT_CONCURRENCY_USES_DISPATCH TRUE)
448+
endif()
449+
450+
set(SWIFT_BUILD_HOST_DISPATCH FALSE)
443451
if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
452+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
453+
set(SWIFT_BUILD_HOST_DISPATCH TRUE)
454+
endif()
455+
endif()
456+
457+
if(SWIFT_BUILD_HOST_DISPATCH OR SWIFT_CONCURRENCY_USES_DISPATCH)
444458
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
445459
if(NOT EXISTS "${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}")
446-
message(SEND_ERROR "SyntaxParserLib and SourceKit require libdispatch on non-Darwin hosts. Please specify SWIFT_PATH_TO_LIBDISPATCH_SOURCE")
460+
message(SEND_ERROR "SyntaxParserLib, SourceKit, and concurrency require libdispatch on non-Darwin hosts. Please specify SWIFT_PATH_TO_LIBDISPATCH_SOURCE")
447461
endif()
448462
endif()
449463
endif()
@@ -976,7 +990,7 @@ if (LLVM_ENABLE_DOXYGEN)
976990
message(STATUS "Doxygen: enabled")
977991
endif()
978992

979-
if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
993+
if(SWIFT_BUILD_HOST_DISPATCH)
980994
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
981995
if(CMAKE_C_COMPILER_ID STREQUAL Clang AND
982996
CMAKE_C_COMPILER_VERSION VERSION_GREATER 3.8

benchmark/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ set(SWIFT_BENCH_MODULES
8080
single-source/DictionaryRemove
8181
single-source/DictionarySubscriptDefault
8282
single-source/DictionarySwap
83+
single-source/Differentiation
8384
single-source/Diffing
8485
single-source/DiffingMyers
8586
single-source/DropFirst
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
//===--- Differentiation.swift -------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#if canImport(_Differentiation)
14+
15+
import TestsUtils
16+
import _Differentiation
17+
18+
public let Differentiation = [
19+
BenchmarkInfo(
20+
name: "DifferentiationIdentity",
21+
runFunction: run_DifferentiationIdentity,
22+
tags: [.regression, .differentiation]
23+
),
24+
BenchmarkInfo(
25+
name: "DifferentiationSquare",
26+
runFunction: run_DifferentiationSquare,
27+
tags: [.regression, .differentiation]
28+
),
29+
BenchmarkInfo(
30+
name: "DifferentiationArraySum",
31+
runFunction: run_DifferentiationArraySum,
32+
tags: [.regression, .differentiation],
33+
setUpFunction: { blackHole(onesArray) }
34+
),
35+
]
36+
37+
@inline(never)
38+
public func run_DifferentiationIdentity(N: Int) {
39+
func f(_ x: Float) -> Float {
40+
x
41+
}
42+
for _ in 0..<1000*N {
43+
blackHole(valueWithGradient(at: 1, in: f))
44+
}
45+
}
46+
47+
@inline(never)
48+
public func run_DifferentiationSquare(N: Int) {
49+
func f(_ x: Float) -> Float {
50+
x * x
51+
}
52+
for _ in 0..<1000*N {
53+
blackHole(valueWithGradient(at: 1, in: f))
54+
}
55+
}
56+
57+
let onesArray: [Float] = Array(repeating: 1, count: 50)
58+
59+
@inline(never)
60+
public func run_DifferentiationArraySum(N: Int) {
61+
func sum(_ array: [Float]) -> Float {
62+
var result: Float = 0
63+
for i in withoutDerivative(at: 0..<array.count) {
64+
result += array[i]
65+
}
66+
return result
67+
}
68+
for _ in 0..<N {
69+
blackHole(valueWithGradient(at: onesArray, in: sum))
70+
}
71+
}
72+
73+
#endif

benchmark/utils/TestsUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public enum BenchmarkCategory : String {
2828
case runtime, refcount, metadata
2929
// Other general areas of compiled code validation.
3030
case abstraction, safetychecks, exceptions, bridging, concurrency, existential
31-
case exclusivity
31+
case exclusivity, differentiation
3232

3333
// Algorithms are "micro" that test some well-known algorithm in isolation:
3434
// sorting, searching, hashing, fibonaci, crypto, etc.

benchmark/utils/main.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ import DictionaryOfAnyHashableStrings
6969
import DictionaryRemove
7070
import DictionarySubscriptDefault
7171
import DictionarySwap
72+
#if canImport(_Differentiation)
73+
import Differentiation
74+
#endif
7275
import Diffing
7376
import DiffingMyers
7477
import DropFirst
@@ -258,6 +261,9 @@ registerBenchmark(DictionaryOfAnyHashableStrings)
258261
registerBenchmark(DictionaryRemove)
259262
registerBenchmark(DictionarySubscriptDefault)
260263
registerBenchmark(DictionarySwap)
264+
#if canImport(_Differentiation)
265+
registerBenchmark(Differentiation)
266+
#endif
261267
registerBenchmark(Diffing)
262268
registerBenchmark(DiffingMyers)
263269
registerBenchmark(DropFirst)

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ macro(configure_sdk_unix name architectures)
297297
else()
298298
message(SEND_ERROR "Couldn't find SWIFT_SDK_ANDROID_ARCH_armv7_PATH")
299299
endif()
300-
set(SWIFT_SDK_ANDROID_ARCH_${arch}_TRIPLE "armv7-none-linux-androideabi")
300+
set(SWIFT_SDK_ANDROID_ARCH_${arch}_TRIPLE "armv7-unknown-linux-androideabi")
301301
# The Android ABI isn't part of the module triple.
302-
set(SWIFT_SDK_ANDROID_ARCH_${arch}_MODULE "armv7-none-linux-android")
302+
set(SWIFT_SDK_ANDROID_ARCH_${arch}_MODULE "armv7-unknown-linux-android")
303303
elseif("${arch}" STREQUAL "aarch64")
304304
set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE "aarch64-linux-android")
305305
set(SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING "aarch64")

cmake/modules/SwiftManpage.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ function(manpage)
3939
ALL)
4040

4141
add_dependencies(${MP_INSTALL_IN_COMPONENT} ${manpage_target})
42+
set(MANPAGE_DEST "share/")
43+
if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "OPENBSD")
44+
set(MANPAGE_DEST "")
45+
endif()
4246
swift_install_in_component(FILES "${output_file_name}"
43-
DESTINATION "share/man/man${MP_MAN_SECTION}"
47+
DESTINATION "${MANPAGE_DEST}man/man${MP_MAN_SECTION}"
4448
COMPONENT "${MP_INSTALL_IN_COMPONENT}")
4549
endfunction()
4650

docs/ABI/Mangling.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,11 @@ Types
492492

493493
type ::= 'Bb' // Builtin.BridgeObject
494494
type ::= 'BB' // Builtin.UnsafeValueBuffer
495+
type ::= 'Bc' // Builtin.RawUnsafeContinuation
495496
type ::= 'Bf' NATURAL '_' // Builtin.Float<n>
496497
type ::= 'Bi' NATURAL '_' // Builtin.Int<n>
497498
type ::= 'BI' // Builtin.IntLiteral
499+
type ::= 'Bj' // Builtin.Job
498500
type ::= 'BO' // Builtin.UnknownObject (no longer a distinct type, but still used for AnyObject)
499501
type ::= 'Bo' // Builtin.NativeObject
500502
type ::= 'Bp' // Builtin.RawPointer
@@ -1006,6 +1008,8 @@ Function Specializations
10061008
::
10071009

10081010
specialization ::= type '_' type* 'Tg' SPEC-INFO // Generic re-abstracted specialization
1011+
specialization ::= type '_' type* 'TB' SPEC-INFO // Alternative mangling for generic re-abstracted specializations,
1012+
// used for functions with re-abstracted resilient parameter types.
10091013
specialization ::= type '_' type* 'Ts' SPEC-INFO // Generic re-abstracted prespecialization
10101014
specialization ::= type '_' type* 'TG' SPEC-INFO // Generic not re-abstracted specialization
10111015
specialization ::= type '_' type* 'Ti' SPEC-INFO // Inlined function with generic substitutions.

0 commit comments

Comments
 (0)