Skip to content

Commit dfe4d5f

Browse files
authored
Merge pull request #13 from apple/master
PR
2 parents a72b451 + 13d56eb commit dfe4d5f

File tree

2,638 files changed

+188857
-128786
lines changed

Some content is hidden

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

2,638 files changed

+188857
-128786
lines changed

Diff for: CHANGELOG.md

+29-7
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,14 @@ CHANGELOG
2424
Swift 5.0
2525
---------
2626

27-
- [SR-419][]
27+
* Notable bug fix: unowned and unowned(unsafe) variables now support optional
28+
types.
2829

29-
In Swift 5 mode, when setting a property from within its own `didSet` or `willSet` observer, the observer will now only avoid being recursively called if the property is set on `self` (either implicitly or explicitly).
30+
* [SR-419][]
31+
32+
In Swift 5 mode, when setting a property from within its own `didSet` or
33+
`willSet` observer, the observer will now only avoid being recursively called
34+
if the property is set on `self` (either implicitly or explicitly).
3035

3136
For example:
3237
```swift
@@ -57,6 +62,24 @@ Swift 5.0
5762
Swift 4.2
5863
---------
5964

65+
* [SE-0194][]
66+
67+
The new CaseIterable protocol describes types which have a static
68+
“allCases” property that is used to describe all of the cases of the
69+
type. Swift will synthesize this “allCases” property for enums that
70+
have no associated values. For example:
71+
72+
```swift
73+
enum Suit: CaseIterable {
74+
case heart
75+
case club
76+
case diamond
77+
case spade
78+
}
79+
80+
print(Suit.allCases) // prints [Suit.heart, Suit.club, Suit.diamond, Suit.spade]
81+
```
82+
6083
* [SE-0185][]
6184

6285
Protocol conformances are now able to be synthesized in extensions in the same
@@ -207,11 +230,10 @@ Swift 4.2
207230
* [SE-0143][]
208231

209232
The standard library types `Optional`, `Array`, `ArraySlice`,
210-
`ContiguousArray`, `Dictionary`, `DictionaryLiteral`, `Range`, and
211-
`ClosedRange` now conform to the `Hashable` protocol when their element or
212-
bound types (as the case may be) conform to `Hashable`. This makes
213-
synthesized `Hashable` implementations available for types that include stored
214-
properties of these types.
233+
`ContiguousArray`, `Dictionary`, `Range`, and `ClosedRange` now conform to the
234+
`Hashable` protocol when their element or bound types (as the case may be)
235+
conform to `Hashable`. This makes synthesized `Hashable` implementations
236+
available for types that include stored properties of these types.
215237

216238
* [SE-0196][]
217239

Diff for: README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
|**[Fedora 27](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_fedora_27.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27)|
1919
|**[Ubuntu 16.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04)|
2020
|**[Ubuntu 16.04 (TensorFlow)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_tensorflow.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow)|
21-
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le)|
21+
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le)|
22+
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_ubuntu_16.04.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64)|
23+
|**[Ubuntu 16.04 (Android)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | x86_64 |[![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)|
24+
2225

2326
**Welcome to Swift!**
2427

@@ -66,7 +69,7 @@ supported host development operating systems.
6669

6770
#### macOS
6871

69-
To build for macOS, you need [Xcode 10 beta](https://developer.apple.com/xcode/downloads/).
72+
To build for macOS, you need [Xcode 10 beta 5](https://developer.apple.com/xcode/downloads/).
7073
The required version of Xcode changes frequently, and is often a beta release.
7174
Check this document or the host information on <https://ci.swift.org> for the
7275
current required version.

Diff for: benchmark/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ set(SWIFT_BENCH_MODULES
6565
single-source/DictTest4
6666
single-source/DictTest4Legacy
6767
single-source/DictionaryBridge
68+
single-source/DictionaryBridgeToObjC
69+
single-source/DictionaryCompactMapValues
6870
single-source/DictionaryCopy
6971
single-source/DictionaryGroup
7072
single-source/DictionaryKeysContains
@@ -111,7 +113,6 @@ set(SWIFT_BENCH_MODULES
111113
single-source/ObserverUnappliedMethod
112114
single-source/OpaqueConsumingUsers
113115
single-source/OpenClose
114-
single-source/PartialApplyDynamicType
115116
single-source/Phonebook
116117
single-source/PointerArithmetics
117118
single-source/PolymorphicCalls
@@ -271,6 +272,7 @@ message("-- SWIFT_LIBRARY_PATH = ${SWIFT_LIBRARY_PATH}")
271272
message("-- CLANG_EXEC = ${CLANG_EXEC}")
272273
message("-- SWIFT_OPTIMIZATION_LEVELS = ${SWIFT_OPTIMIZATION_LEVELS}")
273274
message("-- ONLY_PLATFORMS = ${ONLY_PLATFORMS}")
275+
message("-- PAGE_ALIGNMENT_OPTION = ${PAGE_ALIGNMENT_OPTION}")
274276

275277
message("-- found platforms: ${platforms}")
276278
message("-- found sdks:")

Diff for: benchmark/README.md

+38-4
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,38 @@ Using the Benchmark Driver
8686
* `--num-samples`
8787
* Control the number of samples to take for each test
8888
* `--list`
89-
* Print a list of available tests
89+
* Print a list of available tests matching specified criteria
90+
* `--tags`
91+
* Run tests that are labeled with specified [tags](https://github.com/apple/swift/blob/master/benchmark/utils/TestsUtils.swift#L19)
92+
(comma separated list); multiple tags are interpreted as logical AND, i.e.
93+
run only test that are labeled with all the supplied tags
94+
* `--skip-tags`
95+
* Don't run tests that are labeled with any of the specified tags (comma
96+
separated list); default value: `skip,unstable`; to get complete list of
97+
tests, specify empty `--skip-tags=`
98+
9099

91100
### Examples
92101

93102
* `$ ./Benchmark_O --num-iters=1 --num-samples=1`
94103
* `$ ./Benchmark_Onone --list`
95104
* `$ ./Benchmark_Osize Ackermann`
105+
* `$ ./Benchmark_O --tags=Dictionary`
106+
* `$ ./Benchmark_O --skip-tags=unstable,skip,validation`
96107

97108
### Note
98109
As a shortcut, you can also refer to benchmarks by their ordinal numbers.
99-
The regular `--list` option does not provide these, but you can run:
100-
* `$ ./Benchmark_O --list --run-all | tail -n +2 | nl`
101-
You can use ordinal numbers instead of test names like this:
110+
These are printed out together with benchmark names and tags using the
111+
`--list` parameter. For a complete list of all available performance tests run
112+
* `$ ./Benchmark_O --list --skip-tags=`
113+
114+
You can use test numbers instead of test names like this:
102115
* `$ ./Benchmark_O 1 42`
103116
* `$ ./Benchmark_Driver run 1 42`
104117

118+
Test numbers are not stable in the long run, adding and removing tests from the
119+
benchmark suite will reorder them, but they are stable for a given build.
120+
105121
Using the Harness Generator
106122
---------------------------
107123

@@ -186,3 +202,21 @@ public func run_YourTestName(N: Int) {
186202

187203
The current set of tags are defined by the `BenchmarkCategory` enum in
188204
`TestsUtils.swift` .
205+
206+
Testing the Benchmark Drivers
207+
-----------------------------
208+
When working on tests, after the initial build
209+
````
210+
swift-source$ ./swift/utils/build-script -R -B
211+
````
212+
you can rebuild just the benchmarks:
213+
````
214+
swift-source$ export SWIFT_BUILD_DIR=`pwd`/build/Ninja-ReleaseAssert/swift-macosx-x86_64
215+
swift-source$ ninja -C ${SWIFT_BUILD_DIR} swift-benchmark-macosx-x86_64
216+
````
217+
218+
When modifying the testing infrastructure, you should verify that your changes
219+
pass all the tests:
220+
````
221+
swift-source$ ./llvm/utils/lit/lit.py -sv ${SWIFT_BUILD_DIR}/test-macosx-x86_64/benchmark
222+
````

Diff for: benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

+14-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ macro(configure_build)
4040
message(FATAL_ERROR "Unsupported platform?!")
4141
endif()
4242

43+
set(PAGE_ALIGNMENT_OPTION "-Xllvm" "-align-module-to-page-size")
44+
execute_process(
45+
COMMAND "touch" "empty.swift"
46+
RESULT_VARIABLE result
47+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
48+
execute_process(
49+
COMMAND "${SWIFT_EXEC}" ${PAGE_ALIGNMENT_OPTION} "empty.swift"
50+
RESULT_VARIABLE result
51+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
52+
if(NOT "${result}" MATCHES "0")
53+
set(PAGE_ALIGNMENT_OPTION "")
54+
endif()
55+
4356
# We always infer the SWIFT_LIBRARY_PATH from SWIFT_EXEC unless
4457
# SWIFT_LIBRARY_PATH is specified explicitly.
4558
if(NOT SWIFT_LIBRARY_PATH)
@@ -293,7 +306,7 @@ function (swift_benchmark_compile_archopts)
293306
set(common_options
294307
"-c"
295308
"-target" "${target}"
296-
"-${BENCH_COMPILE_ARCHOPTS_OPT}")
309+
"-${BENCH_COMPILE_ARCHOPTS_OPT}" ${PAGE_ALIGNMENT_OPTION})
297310

298311
if (is_darwin)
299312
list(APPEND common_options

Diff for: benchmark/scripts/Benchmark_Driver

+18-14
Original file line numberDiff line numberDiff line change
@@ -118,28 +118,32 @@ def instrument_test(driver_path, test, num_samples):
118118
return avg_test_output
119119

120120

121-
BENCHMARK_OUTPUT_RE = re.compile('([^,]+),')
122-
123-
124121
def get_tests(driver_path, args):
125122
"""Return a list of available performance tests"""
126123
driver = ([driver_path, '--list'])
124+
# Use tab delimiter for easier parsing to override the default comma.
125+
# (The third 'column' is always comma-separated list of tags in square
126+
# brackets -- currently unused here.)
127+
driver.append('--delim=\t')
127128
if args.benchmarks or args.filters:
128-
driver.append('--run-all')
129-
tests = []
130-
for l in subprocess.check_output(driver).split("\n")[1:]:
131-
m = BENCHMARK_OUTPUT_RE.match(l)
132-
if m is None:
133-
continue
134-
tests.append(m.group(1))
129+
driver.append('--skip-tags=') # list all tests, don't skip any tags
130+
index_name_pairs = [
131+
line.split('\t')[:2] for line in
132+
subprocess.check_output(driver).split('\n')[1:-1]
133+
]
134+
indices, names = zip(*index_name_pairs) # unzip list of pairs into 2 lists
135135
if args.filters:
136136
regexes = [re.compile(pattern) for pattern in args.filters]
137137
return sorted(list(set([name for pattern in regexes
138-
for name in tests if pattern.match(name)])))
138+
for name in names if pattern.match(name)])))
139139
if not args.benchmarks:
140-
return tests
141-
tests.extend(map(str, range(1, len(tests) + 1))) # ordinal numbers
142-
return sorted(list(set(tests).intersection(set(args.benchmarks))))
140+
return names
141+
benchmarks = set(args.benchmarks)
142+
index_to_name = dict(index_name_pairs)
143+
indexed_names = [index_to_name[i]
144+
for i in benchmarks.intersection(set(indices))]
145+
return sorted(list(
146+
benchmarks.intersection(set(names)).union(indexed_names)))
143147

144148

145149
def get_current_git_branch(git_repo_path):

0 commit comments

Comments
 (0)