Skip to content

Commit 43cfc33

Browse files
committed
Merge remote-tracking branch 'upstream/master' into optional-to-archetype-swift5
2 parents 5028063 + cad4c71 commit 43cfc33

File tree

1,422 files changed

+25184
-19311
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,422 files changed

+25184
-19311
lines changed

CHANGELOG.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@ Swift 5.0
6464
// prints: Optional(42)
6565
```
6666

67+
* [SE-0227][]:
68+
69+
Key paths now support the `\.self` keypath, which is a `WritableKeyPath`
70+
that refers to its entire input value:
71+
72+
```swift
73+
let id = \Int.self
74+
75+
var x = 2
76+
print(x[keyPath: id]) // prints 2
77+
x[keyPath: id] = 3
78+
print(x[keyPath: id]) // prints 3
79+
```
80+
6781
* [SE-0214][]:
6882

6983
Renamed the `DictionaryLiteral` type to `KeyValuePairs`.
@@ -112,6 +126,8 @@ Swift 5.0
112126
Swift 4.2
113127
---------
114128

129+
### 2018-09-17 (Xcode 10.0)
130+
115131
* [SE-0194][]
116132

117133
The new CaseIterable protocol describes types which have a static
@@ -317,8 +333,6 @@ Swift 4.2
317333
conditionally conforms to `P`, will succeed when the conditional
318334
requirements are met.
319335

320-
**Add new entries to the top of this section, not here!**
321-
322336
Swift 4.1
323337
---------
324338

CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -860,15 +860,14 @@ function(swift_icu_variables_set sdk arch result)
860860
endif()
861861
endfunction()
862862

863-
# ICU is provided through CoreFoundation on Darwin. On other hosts, assume that
864-
# we are compiling for the build as the host. In such a case, if the ICU
863+
# ICU is provided through CoreFoundation on Darwin. On other hosts, if the ICU
865864
# unicode and i18n include and library paths are not defined, perform a standard
866865
# package lookup. Otherwise, rely on the paths specified by the user. These
867866
# need to be defined when cross-compiling.
868867
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
869868
if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
870-
swift_icu_variables_set("${SWIFT_HOST_VARIANT_SDK_default}"
871-
"${SWIFT_HOST_VARIANT_ARCH_default}"
869+
swift_icu_variables_set("${SWIFT_PRIMARY_VARIANT_SDK}"
870+
"${SWIFT_PRIMARY_VARIANT_ARCH}"
872871
ICU_CONFIGURED)
873872
if("${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "" AND NOT ${ICU_CONFIGURED})
874873
find_package(ICU REQUIRED COMPONENTS uc i18n)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ supported host development operating systems.
7171

7272
#### macOS
7373

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

apinotes/README.md

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,75 +6,12 @@ original Objective-C headers. This semantic information can then be
66
used by the Swift compiler when importing the corresponding Objective-C
77
module to provide a better mapping of Objective-C APIs into Swift.
88

9-
API notes are organized into a set of `.apinotes` files. Each
10-
`.apinotes` file contains annotations for a single Objective-C module,
11-
written in YAML (FIXME: to be) described below. These YAML sources
12-
must be manually compiled into a binary representation (`.apinotesc`)
13-
that the Swift compiler will lazily load when it builds code, also
9+
API notes are organized into a set of `.apinotes` files. Each `.apinotes` file
10+
contains annotations for a single Objective-C module, written in YAML (FIXME:
11+
to be) described in the Clang repository. These YAML sources are lazily loaded
12+
by the Swift compiler when it imports the corresponding framework, also
1413
described below.
1514

16-
# API Notes YAML Format
17-
18-
TBD...
19-
20-
# Compiling API notes
21-
22-
The Swift compiler lazily loads API notes from compiled API notes
23-
files (`.apinotesc` files) and uses these annotations to affect the
24-
Swift signatures of imported Objective-C APIs. Compiled API notes
25-
files reside in the Swift module directory, i.e., the same directory
26-
where the `.swiftmodule` file would reside for the Swift overlay of
27-
that module. For system modules, the path depends on the platform
28-
and architecture.
29-
30-
Platform | Path
31-
:------------- | :-------------
32-
macOS | `$SWIFT_EXEC/lib/swift/macosx/`
33-
iOS (32-bit) | `$SWIFT_EXEC/lib/swift/iphoneos/32`
34-
iOS (64-bit) | `$SWIFT_EXEC/lib/swift/iphoneos`
35-
iOS Simulator (32-bit) | `$SWIFT_EXEC/lib/swift/iphonesimulator/32`
36-
iOS Simulator (64-bit) | `$SWIFT_EXEC/lib/swift/iphonesimulator`
37-
38-
where `$SWIFT_EXEC/bin/swift` is the path to the Swift compiler
39-
executable.
40-
41-
When updating API notes for a system module, recompile the API notes
42-
and place the result in the appropriate directories listed above. The
43-
Swift compiler itself need not be recompiled except in rare cases
44-
where the changes affect how the SDK overlays are built. To recompile
45-
API notes for a given module `$MODULE` and place them into their
46-
47-
### macOS
48-
```
49-
xcrun swift -apinotes -yaml-to-binary -target x86_64-apple-macosx10.10 -o $SWIFT_EXEC/lib/swift/macosx/$MODULE.apinotesc $MODULE.apinotes
50-
```
51-
52-
### iOS (32-bit)
53-
```
54-
xcrun swift -apinotes -yaml-to-binary -target armv7-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphoneos/32/$MODULE.apinotesc $MODULE.apinotes
55-
```
56-
57-
### iOS (64-bit)
58-
```
59-
xcrun swift -apinotes -yaml-to-binary -target arm64-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphoneos/$MODULE.apinotesc $MODULE.apinotes
60-
```
61-
62-
### iOS Simulator (32-bit)
63-
```
64-
xcrun swift -apinotes -yaml-to-binary -target i386-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphonesimulator/32/$MODULE.apinotesc $MODULE.apinotes
65-
```
66-
67-
### iOS Simulator (64-bit)
68-
```
69-
xcrun swift -apinotes -yaml-to-binary -target x86_64-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphonesimulator/$MODULE.apinotesc $MODULE.apinotes
70-
```
71-
7215
To add API notes for a system module `$MODULE` that does not have them yet,
7316
create a new source file `$MODULE.apinotes` and update CMakeLists.txt.
7417
Updated API notes will be found by the build system during the next build.
75-
76-
Note that Swift provides decompilation of binary API notes files via
77-
the `-apinotes -binary-to-yaml` option, which allows one to inspect
78-
the information the compiler is using internally. The order of the
79-
entities in the original YAML input is not preserved, so all entities
80-
in the resulting YAML output are sorted alphabetically.

benchmark/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ set(SWIFT_BENCH_MODULES
5656
single-source/Chars
5757
single-source/ClassArrayGetter
5858
single-source/Combos
59+
single-source/CountAlgo
5960
single-source/DataBenchmarks
6061
single-source/DeadArray
6162
single-source/DictOfArraysToArrayOfDicts

benchmark/scripts/Benchmark_Driver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ class BenchmarkDoctor(object):
434434
measurements = dict(
435435
[('{0} {1} i{2}{3}'.format(benchmark, o, i, suffix),
436436
self.driver.run(benchmark, num_samples=s, num_iters=i,
437-
verbose=True))
437+
verbose=True, measure_memory=True))
438438
for o in opts
439439
for s, i in run_args
440440
for suffix in list('abcde')

benchmark/scripts/compare_perf_tests.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class `ReportFormatter` creates the test comparison report in specified format.
3434
import sys
3535
from bisect import bisect, bisect_left, bisect_right
3636
from collections import namedtuple
37+
from decimal import Decimal, ROUND_HALF_EVEN
3738
from math import sqrt
3839

3940

@@ -141,20 +142,32 @@ def max(self):
141142
"""Maximum sampled value."""
142143
return self.samples[-1].runtime
143144

145+
def quantile(self, q):
146+
"""Return runtime of a sample nearest to the quantile.
147+
148+
Explicitly uses round-half-to-even rounding algorithm to match the
149+
behavior of numpy's quantile(interpolation='nearest') and quantile
150+
estimate type R-3, SAS-2. See:
151+
https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample
152+
"""
153+
index = int(Decimal((self.count - 1) * Decimal(q))
154+
.quantize(0, ROUND_HALF_EVEN))
155+
return self.samples[index].runtime
156+
144157
@property
145158
def median(self):
146159
"""Median sampled value."""
147-
return self.samples[self.count / 2].runtime
160+
return self.quantile(0.5)
148161

149162
@property
150163
def q1(self):
151164
"""First Quartile (25th Percentile)."""
152-
return self.samples[self.count / 4].runtime
165+
return self.quantile(0.25)
153166

154167
@property
155168
def q3(self):
156169
"""Third Quartile (75th Percentile)."""
157-
return self.samples[(self.count / 2) + (self.count / 4)].runtime
170+
return self.quantile(0.75)
158171

159172
@property
160173
def iqr(self):
@@ -487,7 +500,7 @@ def __init__(self, comparator, old_branch, new_branch, changes_only,
487500
{0} ({1}): {2}"""
488501

489502
PERFORMANCE_TEST_RESULT_HEADER = ('TEST', 'MIN', 'MAX', 'MEAN', 'MAX_RSS')
490-
RESULT_COMPARISON_HEADER = ('TEST', 'OLD', 'NEW', 'DELTA', 'SPEEDUP')
503+
RESULT_COMPARISON_HEADER = ('TEST', 'OLD', 'NEW', 'DELTA', 'RATIO')
491504

492505
@staticmethod
493506
def header_for(result):

benchmark/scripts/test_Benchmark_Driver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,10 @@ def test_measure_10_independent_1s_benchmark_series(self):
476476
# 5x i1 series, with 300 μs runtime its possible to take 4098
477477
# samples/s, but it should be capped at 2k
478478
([(_run('B1', num_samples=2048, num_iters=1,
479-
verbose=True), _PTR(min=300))] * 5) +
479+
verbose=True, measure_memory=True), _PTR(min=300))] * 5) +
480480
# 5x i2 series
481481
([(_run('B1', num_samples=2048, num_iters=2,
482-
verbose=True), _PTR(min=300))] * 5)
482+
verbose=True, measure_memory=True), _PTR(min=300))] * 5)
483483
))
484484
doctor = BenchmarkDoctor(self.args, driver)
485485
with captured_output() as (out, _):

benchmark/scripts/test_compare_perf_tests.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ def test_computes_five_number_summary(self):
7575
self.samples, (1000, 1000, 1000, 1000, 1000))
7676
self.samples.add(Sample(2, 1, 1100))
7777
self.assertEqualFiveNumberSummary(
78-
self.samples, (1000, 1000, 1100, 1100, 1100))
78+
self.samples, (1000, 1000, 1000, 1100, 1100))
7979
self.samples.add(Sample(3, 1, 1050))
8080
self.assertEqualFiveNumberSummary(
81-
self.samples, (1000, 1000, 1050, 1050, 1100))
81+
self.samples, (1000, 1000, 1050, 1100, 1100))
8282
self.samples.add(Sample(4, 1, 1025))
8383
self.assertEqualFiveNumberSummary(
84-
self.samples, (1000, 1025, 1050, 1100, 1100))
84+
self.samples, (1000, 1025, 1050, 1050, 1100))
8585
self.samples.add(Sample(5, 1, 1075))
8686
self.assertEqualFiveNumberSummary(
8787
self.samples, (1000, 1025, 1050, 1075, 1100))
@@ -156,11 +156,12 @@ def test_excludes_outliers_zero_IQR(self):
156156
self.samples.add(Sample(0, 2, 23))
157157
self.samples.add(Sample(1, 2, 18))
158158
self.samples.add(Sample(2, 2, 18))
159+
self.samples.add(Sample(3, 2, 18))
159160
self.assertEquals(self.samples.iqr, 0)
160161

161162
self.samples.exclude_outliers()
162163

163-
self.assertEquals(self.samples.count, 2)
164+
self.assertEquals(self.samples.count, 3)
164165
self.assertEqualStats(
165166
(self.samples.min, self.samples.max), (18, 18))
166167

@@ -368,7 +369,6 @@ def test_parse_results_verbose(self):
368369
Sample 0,11812
369370
Measuring with scale 90.
370371
Sample 1,13898
371-
Measuring with scale 91.
372372
Sample 2,11467
373373
1,AngryPhonebook,3,11467,13898,12392,1315,11812
374374
Running Array2D for 3 samples.
@@ -388,7 +388,7 @@ def test_parse_results_verbose(self):
388388
)
389389
self.assertEquals(r.num_samples, r.samples.num_samples)
390390
self.assertEquals(results[0].samples.all_samples,
391-
[(0, 78, 11812), (1, 90, 13898), (2, 91, 11467)])
391+
[(0, 78, 11812), (1, 90, 13898), (2, 90, 11467)])
392392

393393
r = results[1]
394394
self.assertEquals(
@@ -587,21 +587,21 @@ def test_column_headers(self):
587587
comparison_result = self.tc.increased[0]
588588
self.assertEquals(
589589
ReportFormatter.header_for(comparison_result),
590-
('TEST', 'OLD', 'NEW', 'DELTA', 'SPEEDUP')
590+
('TEST', 'OLD', 'NEW', 'DELTA', 'RATIO')
591591
)
592592
self.assert_markdown_contains([
593-
'TEST | OLD | NEW | DELTA | SPEEDUP',
593+
'TEST | OLD | NEW | DELTA | RATIO',
594594
'--- | --- | --- | --- | --- ',
595595
'TEST | MIN | MAX | MEAN | MAX_RSS'])
596596
self.assert_git_contains([
597-
'TEST OLD NEW DELTA SPEEDUP',
597+
'TEST OLD NEW DELTA RATIO',
598598
'TEST MIN MAX MEAN MAX_RSS'])
599599
self.assert_html_contains([
600600
"""
601601
<th align='left'>OLD</th>
602602
<th align='left'>NEW</th>
603603
<th align='left'>DELTA</th>
604-
<th align='left'>SPEEDUP</th>""",
604+
<th align='left'>RATIO</th>""",
605605
"""
606606
<th align='left'>MIN</th>
607607
<th align='left'>MAX</th>
@@ -764,12 +764,12 @@ class Test_compare_perf_tests_main(OldAndNewLog, FileSystemIntegration):
764764
"""Integration test that invokes the whole comparison script."""
765765
markdown = [
766766
'<summary>Regression (1)</summary>',
767-
'TEST | OLD | NEW | DELTA | SPEEDUP',
767+
'TEST | OLD | NEW | DELTA | RATIO',
768768
'BitCount | 3 | 9 | +199.9% | **0.33x**',
769769
]
770770
git = [
771771
'Regression (1):',
772-
'TEST OLD NEW DELTA SPEEDUP',
772+
'TEST OLD NEW DELTA RATIO',
773773
'BitCount 3 9 +199.9% **0.33x**',
774774
]
775775
html = ['<html>', "<td align='left'>BitCount</td>"]

0 commit comments

Comments
 (0)