Skip to content

Commit 59fe523

Browse files
committed
Merge remote-tracking branch 'origin/master' into fortify-benchmarks
2 parents 03e4f5f + 41958f9 commit 59fe523

File tree

1,365 files changed

+55036
-11977
lines changed

Some content is hidden

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

1,365 files changed

+55036
-11977
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#==============================================================================#
2323
# Explicit files to ignore (only matches one).
2424
#==============================================================================#
25+
Brewfile.lock.json
2526
cscope.files
2627
cscope.out
2728
.vimrc

Brewfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
brew "cmake"
2+
brew "ninja"

CHANGELOG.md

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ CHANGELOG
66

77
| Version | Released | Toolchain |
88
| :--------------------- | :--------- | :---------- |
9-
| [Swift 5.2](#swift-52) | | |
9+
| [Swift 5.3](#swift-53) | | |
10+
| [Swift 5.2](#swift-52) | 2020-03-24 | Xcode 11.4 |
1011
| [Swift 5.1](#swift-51) | 2019-09-20 | Xcode 11.0 |
1112
| [Swift 5.0](#swift-50) | 2019-03-25 | Xcode 10.2 |
1213
| [Swift 4.2](#swift-42) | 2018-09-17 | Xcode 10.0 |
@@ -23,9 +24,57 @@ CHANGELOG
2324

2425
</details>
2526

26-
Swift Next
27+
Swift 5.3
2728
----------
2829

30+
* [SE-0268][]:
31+
32+
A `didSet` observer which does not refer to the `oldValue` in its body or does not explicitly request it by placing it in the parameter list (i.e. `didSet(oldValue)`) will no longer trigger a call to the property getter to fetch the `oldValue`.
33+
34+
```swift
35+
class C {
36+
var value: Int = 0 {
37+
didSet { print("didSet called!") }
38+
}
39+
}
40+
41+
let c = C()
42+
// This does not trigger a call to the getter for 'value'
43+
// because the 'didSet' observer on 'value' does not
44+
// refer to the 'oldValue' in its body, which means
45+
// the 'oldValue' does not need to be fetched.
46+
c.value = 1
47+
```
48+
49+
* [SE-0276][]:
50+
51+
Catch clauses in a `do`-`catch` statement can now include multiple patterns in a comma-separated list. The body of a `catch` clause will be executed if a thrown error matches any of its patterns.
52+
53+
```swift
54+
do {
55+
try performTask()
56+
} catch TaskError.someFailure(let msg),
57+
TaskError.anotherFailure(let msg) {
58+
showMessage(msg)
59+
}
60+
```
61+
62+
* [SE-0280][]:
63+
64+
Enum cases can now satisfy static protocol requirements. A static get-only property of type `Self` can be witnessed by an enum case with no associated values and a static function with arguments and returning `Self` can be witnessed by an enum case with associated values.
65+
66+
```swift
67+
protocol P {
68+
static var foo: Self { get }
69+
static func bar(value: Int) -> Self
70+
}
71+
72+
enum E: P {
73+
case foo // matches 'static var foo'
74+
case bar(value: Int) // matches 'static func bar(value:)'
75+
}
76+
```
77+
2978
* [SE-0267][]:
3079

3180
Non-generic members that support a generic parameter list, including nested type declarations, are now allowed to carry a contextual `where` clause against outer generic parameters. Previously, such declarations could only be expressed by placing the member inside a dedicated constrained extension.
@@ -97,9 +146,13 @@ Swift Next
97146
closure's capture list in addition to the existing 'use `self.` explicitly'
98147
fix-it.
99148

149+
**Add new entries to the top of this section, not here!**
150+
100151
Swift 5.2
101152
---------
102153

154+
### 2020-03-24 (Xcode 11.4)
155+
103156
* [SR-11841][]:
104157

105158
When chaining calls to `filter(_:)` on a lazy sequence or collection, the
@@ -292,8 +345,6 @@ Swift 5.2
292345
print(s[0])
293346
```
294347

295-
**Add new entries to the top of this section, not here!**
296-
297348
Swift 5.1
298349
---------
299350

@@ -7950,7 +8001,10 @@ Swift 1.0
79508001
[SE-0254]: <https://github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>
79518002
[SE-0266]: <https://github.com/apple/swift-evolution/blob/master/proposals/0266-synthesized-comparable-for-enumerations.md>
79528003
[SE-0267]: <https://github.com/apple/swift-evolution/blob/master/proposals/0267-where-on-contextually-generic.md>
8004+
[SE-0268]: <https://github.com/apple/swift-evolution/blob/master/proposals/0268-didset-semantics.md>
79538005
[SE-0269]: <https://github.com/apple/swift-evolution/blob/master/proposals/0269-implicit-self-explicit-capture.md>
8006+
[SE-0276]: <https://github.com/apple/swift-evolution/blob/master/proposals/0276-multi-pattern-catch-clauses.md>
8007+
[SE-0280]: <https://github.com/apple/swift-evolution/blob/master/proposals/0280-enum-cases-as-protocol-witnesses.md>
79548008

79558009
[SR-75]: <https://bugs.swift.org/browse/SR-75>
79568010
[SR-106]: <https://bugs.swift.org/browse/SR-106>

CMakeLists.txt

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.4.3)
1+
cmake_minimum_required(VERSION 3.12.4)
22

33
# TODO: Fix RPATH usage to be CMP0068 compliant
44
# Disable Policy CMP0068 for CMake 3.9
@@ -570,6 +570,8 @@ else()
570570
set(SWIFT_HOST_VARIANT_SDK_default "LINUX")
571571
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
572572
set(SWIFT_HOST_VARIANT_SDK_default "FREEBSD")
573+
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
574+
set(SWIFT_HOST_VARIANT_SDK_default "OPENBSD")
573575
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
574576
set(SWIFT_HOST_VARIANT_SDK_default "CYGWIN")
575577
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
@@ -673,6 +675,15 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "FREEBSD")
673675
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
674676
set(SWIFT_PRIMARY_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")
675677

678+
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "OPENBSD")
679+
680+
set(SWIFT_HOST_VARIANT "openbsd" CACHE STRING
681+
"Deployment OS for Swift host tools (the compiler) [openbsd].")
682+
683+
configure_sdk_unix("OpenBSD" "${SWIFT_HOST_VARIANT_ARCH}")
684+
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
685+
set(SWIFT_PRIMARY_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")
686+
676687
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "CYGWIN")
677688

678689
set(SWIFT_HOST_VARIANT "cygwin" CACHE STRING
@@ -881,7 +892,8 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
881892
endif()
882893
endif()
883894

884-
find_package(PythonInterp REQUIRED)
895+
find_package(Python2 COMPONENTS Interpreter REQUIRED)
896+
find_package(Python3 COMPONENTS Interpreter REQUIRED)
885897

886898
#
887899
# Find optional dependencies.
@@ -1027,13 +1039,11 @@ if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
10271039
set(SOURCEKIT_RUNTIME_DIR lib)
10281040
endif()
10291041
add_dependencies(sourcekit-inproc BlocksRuntime dispatch)
1030-
if("${SWIFT_HOST_VARIANT_SDK}" MATCHES "OSX|WINDOWS")
1031-
swift_install_in_component(FILES
1032-
$<TARGET_FILE:dispatch>
1033-
$<TARGET_FILE:BlocksRuntime>
1034-
DESTINATION ${SOURCEKIT_RUNTIME_DIR}
1035-
COMPONENT sourcekit-inproc)
1036-
endif()
1042+
swift_install_in_component(FILES
1043+
$<TARGET_FILE:dispatch>
1044+
$<TARGET_FILE:BlocksRuntime>
1045+
DESTINATION ${SOURCEKIT_RUNTIME_DIR}
1046+
COMPONENT sourcekit-inproc)
10371047
if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
10381048
swift_install_in_component(FILES
10391049
$<TARGET_LINKER_FILE:dispatch>

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | ARMv7 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|
2020
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64)|
2121
|**[Windows 2019 (VS 2017)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_windows_2019.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-windows-x86_64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-windows-x86_64)|
22-
|**[Windows 2019 (VS 2019)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_windows_2019_VS2019.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/ooss-swift-windows-x86_64-vs2019)|
22+
|**[Windows 2019 (VS 2019)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_windows_2019_VS2019.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019)|
2323

2424
**Swift TensorFlow Community-Hosted CI Platforms**
2525

@@ -91,7 +91,7 @@ Please make sure you use Python 2.x. Python 3.x is not supported currently.
9191

9292
#### macOS
9393

94-
To build for macOS, you need [Xcode 11.3](https://developer.apple.com/xcode/downloads/).
94+
To build for macOS, you need [Xcode 11.4](https://developer.apple.com/xcode/resources/).
9595
The required version of Xcode changes frequently, and is often a beta release.
9696
Check this document or the host information on <https://ci.swift.org> for the
9797
current required version.
@@ -102,6 +102,12 @@ which can be installed via a package manager:
102102
**[Homebrew](https://brew.sh/)**
103103

104104
brew install cmake ninja
105+
106+
You can also use [homebrew-bundle](https://github.com/Homebrew/homebrew-bundle)
107+
from the root of this repository's working directory to install all of these
108+
dependencies:
109+
110+
brew bundle
105111

106112
**[MacPorts](https://macports.org)**
107113

@@ -359,7 +365,7 @@ expressed today.
359365

360366
### CMake
361367
[CMake](https://cmake.org) is the core infrastructure used to configure builds of
362-
Swift and its companion projects; at least version 3.4.3 is required.
368+
Swift and its companion projects; at least version 3.16.5 is required.
363369

364370
On macOS, you can download the [CMake Binary Distribution](https://cmake.org/download),
365371
bundled as an application, copy it to `/Applications`, and add the embedded

benchmark/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ endif()
227227
set(SWIFT_BENCHMARK_EXTRA_FLAGS "" CACHE STRING
228228
"Extra options to pass to swiftc when building the benchmarks")
229229

230+
set(SWIFT_BENCHMARK_UNOPTIMIZED_DRIVER NO CACHE BOOL
231+
"Build the benchmark driver utilites without optimization (default: no)")
232+
230233
if (SWIFT_BENCHMARK_BUILT_STANDALONE)
231234
# This option's value must match the value of the same option used when
232235
# building the swift runtime.

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ macro(configure_sdks)
166166
endif()
167167
endmacro()
168168

169-
function (add_swift_benchmark_library objfile_out sibfile_out)
169+
function (add_swift_benchmark_library objfile_out sibfile_out swiftmodule_out)
170170
cmake_parse_arguments(BENCHLIB "" "MODULE_PATH;SOURCE_DIR;OBJECT_DIR" "SOURCES;LIBRARY_FLAGS;DEPENDS" ${ARGN})
171171

172172
precondition(BENCHLIB_MODULE_PATH)
@@ -197,6 +197,7 @@ function (add_swift_benchmark_library objfile_out sibfile_out)
197197
"-o" "${objfile}"
198198
${sources})
199199
set(${objfile_out} "${objfile}" PARENT_SCOPE)
200+
set(${swiftmodule_out} "${swiftmodule}" PARENT_SCOPE)
200201

201202
if(SWIFT_BENCHMARK_EMIT_SIB)
202203
precondition(sibfile_out)
@@ -378,10 +379,13 @@ function (swift_benchmark_compile_archopts)
378379

379380
set(common_swift4_options ${common_options} "-swift-version" "4")
380381

381-
# Always optimize the driver modules.
382-
# Note that we compile the driver for Osize also with -Osize
383-
# (and not with -O), because of <rdar://problem/19614516>.
384-
string(REPLACE "Onone" "O" driver_opt "${optflag}")
382+
# Always optimize the driver modules, unless we're building benchmarks for
383+
# debugger testing.
384+
if(NOT SWIFT_BENCHMARK_UNOPTIMIZED_DRIVER)
385+
# Note that we compile the driver for Osize also with -Osize
386+
# (and not with -O), because of <rdar://problem/19614516>.
387+
string(REPLACE "Onone" "O" driver_opt "${optflag}")
388+
endif()
385389

386390
set(common_options_driver
387391
"-c"
@@ -401,19 +405,21 @@ function (swift_benchmark_compile_archopts)
401405
endif()
402406
set(bench_library_objects)
403407
set(bench_library_sibfiles)
408+
set(bench_library_swiftmodules)
404409
set(opt_view_dirs)
405410
# Build libraries used by the driver and benchmarks.
406411
foreach(module_name_path ${BENCH_LIBRARY_MODULES})
407412
set(sources "${srcdir}/${module_name_path}.swift")
408413

409-
add_swift_benchmark_library(objfile_out sibfile_out
414+
add_swift_benchmark_library(objfile_out sibfile_out swiftmodule_out
410415
MODULE_PATH "${module_name_path}"
411416
SOURCE_DIR "${srcdir}"
412417
OBJECT_DIR "${objdir}"
413418
SOURCES ${sources}
414419
LIBRARY_FLAGS ${common_swift4_options})
415420
precondition(objfile_out)
416421
list(APPEND bench_library_objects "${objfile_out}")
422+
list(APPEND bench_library_swiftmodules "${swiftmodule_out}")
417423
if (SWIFT_BENCHMARK_EMIT_SIB)
418424
precondition(sibfile_out)
419425
list(APPEND bench_library_sibfiles "${sibfile_out}")
@@ -433,7 +439,7 @@ function (swift_benchmark_compile_archopts)
433439

434440
set(objfile_out)
435441
set(sibfile_out)
436-
add_swift_benchmark_library(objfile_out sibfile_out
442+
add_swift_benchmark_library(objfile_out sibfile_out swiftmodule_out
437443
MODULE_PATH "${module_name_path}"
438444
SOURCE_DIR "${srcdir}"
439445
OBJECT_DIR "${objdir}"
@@ -442,6 +448,7 @@ function (swift_benchmark_compile_archopts)
442448
DEPENDS ${bench_library_objects})
443449
precondition(objfile_out)
444450
list(APPEND bench_driver_objects "${objfile_out}")
451+
list(APPEND bench_library_swiftmodules "${swiftmodule_out}")
445452
if (SWIFT_BENCHMARK_EMIT_SIB)
446453
precondition(sibfile_out)
447454
list(APPEND bench_driver_sibfiles "${sibfile_out}")
@@ -464,6 +471,7 @@ function (swift_benchmark_compile_archopts)
464471
set(swiftmodule "${objdir}/${module_name}.swiftmodule")
465472
set(source "${srcdir}/${module_name_path}.swift")
466473
list(APPEND SWIFT_BENCH_OBJFILES "${objfile}")
474+
list(APPEND bench_library_swiftmodules "${swiftmodule}")
467475

468476
if ("${bench_flags}" MATCHES "-whole-module.*")
469477
set(output_option "-o" "${objfile}")
@@ -622,6 +630,15 @@ function (swift_benchmark_compile_archopts)
622630
else()
623631
set(SWIFT_LINK_RPATH "${SWIFT_RPATH_BASE}/${BENCH_COMPILE_ARCHOPTS_PLATFORM}")
624632
endif()
633+
634+
# On Darwin, we pass the *.swiftmodule paths transitively referenced by the
635+
# driver executable to ld64. ld64 inserts N_AST references to these modules
636+
# into the program, for later use by lldb.
637+
set(ld64_add_ast_path_opts)
638+
foreach(ast_path ${bench_library_swiftmodules})
639+
list(APPEND ld64_add_ast_path_opts "-Wl,-add_ast_path,${ast_path}")
640+
endforeach()
641+
625642
add_custom_command(
626643
OUTPUT "${OUTPUT_EXEC}"
627644
DEPENDS
@@ -647,6 +664,7 @@ function (swift_benchmark_compile_archopts)
647664
"-Xlinker" "${SWIFT_LINK_RPATH}"
648665
${bench_library_objects}
649666
${bench_driver_objects}
667+
${ld64_add_ast_path_opts}
650668
${SWIFT_BENCH_OBJFILES}
651669
${objcfile}
652670
"-o" "${OUTPUT_EXEC}"

benchmark/scripts/Benchmark_DTrace.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class DTraceBenchmarkDriver(perf_test_driver.BenchmarkDriver):
103103
stdout=subprocess.PIPE,
104104
stderr=open("/dev/null", "w"),
105105
env=e,
106+
universal_newlines=True,
106107
)
107108
results = [x for x in p.communicate()[0].split("\n") if len(x) > 0]
108109
return [
@@ -136,7 +137,9 @@ class DTraceBenchmarkDriver(perf_test_driver.BenchmarkDriver):
136137
results.append(result_3)
137138
results.append(single_iter)
138139

139-
return DTraceResult(test_name, int(not foundInstability), results)
140+
return DTraceResult(
141+
test_name, int(not foundInstability), results, self.csv_output
142+
)
140143

141144

142145
SWIFT_BIN_DIR = os.path.dirname(os.path.abspath(__file__))

0 commit comments

Comments
 (0)