Skip to content

Commit 6a121fb

Browse files
committed
Merge branch 'master' of https://github.com/apple/swift
2 parents 5462fb2 + feae5f9 commit 6a121fb

File tree

1,025 files changed

+21303
-11012
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,025 files changed

+21303
-11012
lines changed

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
|| **Swift** | **Package** |
55
|---|---|---|
66
|**macOS** |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-osx/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-osx)|[![Build Status](https://ci.swift.org/job/oss-swift-package-osx/badge/icon)](https://ci.swift.org/job/oss-swift-package-osx)|
7-
|**Ubuntu 14.04** |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04)|
8-
|**Ubuntu 15.10** |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-15_10/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-15_10)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-15_10/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-15_10)|
97
|**Ubuntu 16.04** |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04)|
108
|**Ubuntu 16.10** |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_10/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_10)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_10/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_10)|
119

@@ -63,12 +61,7 @@ For Ubuntu, you'll need the following development dependencies:
6361
**Note:** LLDB currently requires at least `swig-1.3.40` but will successfully build
6462
with version 2 shipped with Ubuntu.
6563

66-
If you are building on Ubuntu 14.04 LTS, you'll need to upgrade your clang
67-
compiler for C++14 support and create a symlink:
68-
69-
sudo apt-get install clang-3.6
70-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 100
71-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 100
64+
Ubuntu 14.04 LTS is no longer supported. Unsupported build instructions for Ubuntu 14.04 LTS can be found [here](docs/Ubuntu14.md)
7265

7366
### Getting Sources for Swift and Related Projects
7467

apinotes/Foundation.apinotes

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,8 +1254,6 @@ Tags:
12541254
- Name: NSURLHandleStatus
12551255
SwiftName: NSURLHandle.Status
12561256
Typedefs:
1257-
- Name: NSAffineTransformStruct
1258-
SwiftName: AffineTransform
12591257
- Name: NSComparator
12601258
SwiftName: Comparator
12611259
- Name: NSDecimal
@@ -1740,3 +1738,13 @@ Enumerators:
17401738
SwiftName: regularExpression
17411739
- Name: NSStringEnumerationByLines
17421740
SwiftName: byLines
1741+
SwiftVersions:
1742+
- Version: 3
1743+
Protocols:
1744+
- Name: NSFastEnumeration
1745+
Methods:
1746+
- Selector: 'countByEnumeratingWithState:objects:count:'
1747+
MethodKind: Instance
1748+
Parameters:
1749+
- Position: 1
1750+
Nullability: U

benchmark/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ set(SWIFT_BENCH_MODULES
6464
single-source/NSStringConversion
6565
single-source/NopDeinit
6666
single-source/ObjectAllocation
67+
single-source/ObserverClosure
68+
single-source/ObserverForwarderStruct
69+
single-source/ObserverPartiallyAppliedMethod
70+
single-source/ObserverUnappliedMethod
6771
single-source/OpenClose
6872
single-source/Phonebook
6973
single-source/PolymorphicCalls
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
class Observer {
3+
@inline(never)
4+
func receive(_ value: Int) {
5+
}
6+
}
7+
8+
class Signal {
9+
var observers: [(Int) -> ()] = []
10+
11+
func subscribe(_ observer: @escaping (Int) -> ()) {
12+
observers.append(observer)
13+
}
14+
15+
func send(_ value: Int) {
16+
for observer in observers {
17+
observer(value)
18+
}
19+
}
20+
}
21+
22+
public func run_ObserverClosure(_ iterations: Int) {
23+
let signal = Signal()
24+
let observer = Observer()
25+
for _ in 0 ..< 10_000 * iterations {
26+
signal.subscribe { i in observer.receive(i) }
27+
}
28+
signal.send(1)
29+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
class Observer {
3+
@inline(never)
4+
func receive(_ value: Int) {
5+
}
6+
}
7+
8+
protocol Sink {
9+
func receive(_ value: Int)
10+
}
11+
12+
struct Forwarder: Sink {
13+
let object: Observer
14+
15+
func receive(_ value: Int) {
16+
object.receive(value)
17+
}
18+
}
19+
20+
class Signal {
21+
var observers: [Sink] = []
22+
23+
func subscribe(_ sink: Sink) {
24+
observers.append(sink)
25+
}
26+
27+
func send(_ value: Int) {
28+
for observer in observers {
29+
observer.receive(value)
30+
}
31+
}
32+
}
33+
34+
public func run_ObserverForwarderStruct(_ iterations: Int) {
35+
let signal = Signal()
36+
let observer = Observer()
37+
for _ in 0 ..< 10_000 * iterations {
38+
signal.subscribe(Forwarder(object: observer))
39+
}
40+
signal.send(1)
41+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
class Observer {
3+
@inline(never)
4+
func receive(_ value: Int) {
5+
}
6+
}
7+
8+
class Signal {
9+
var observers: [(Int) -> ()] = []
10+
11+
func subscribe(_ observer: @escaping (Int) -> ()) {
12+
observers.append(observer)
13+
}
14+
15+
func send(_ value: Int) {
16+
for observer in observers {
17+
observer(value)
18+
}
19+
}
20+
}
21+
22+
public func run_ObserverPartiallyAppliedMethod(_ iterations: Int) {
23+
let signal = Signal()
24+
let observer = Observer()
25+
for _ in 0 ..< 10_000 * iterations {
26+
signal.subscribe(observer.receive)
27+
}
28+
signal.send(1)
29+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
class Observer {
3+
@inline(never)
4+
func receive(_ value: Int) {
5+
}
6+
}
7+
8+
protocol Sink {
9+
func receive(_ value: Int)
10+
}
11+
12+
struct Forwarder<Object>: Sink {
13+
let object: Object
14+
let method: (Object) -> (Int) -> ()
15+
16+
func receive(_ value: Int) {
17+
method(object)(value)
18+
}
19+
}
20+
21+
class Signal {
22+
var observers: [Sink] = []
23+
24+
func subscribe(_ sink: Sink) {
25+
observers.append(sink)
26+
}
27+
28+
func send(_ value: Int) {
29+
for observer in observers {
30+
observer.receive(value)
31+
}
32+
}
33+
}
34+
35+
public func run_ObserverUnappliedMethod(_ iterations: Int) {
36+
let signal = Signal()
37+
let observer = Observer()
38+
for _ in 0 ..< 10_000 * iterations {
39+
let forwarder = Forwarder(object: observer, method: Observer.receive)
40+
signal.subscribe(forwarder)
41+
}
42+
signal.send(1)
43+
}

benchmark/single-source/Prims.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func Prims(_ graph : Array<GraphNode>, _ fun : (Int, Int) -> Double) -> Array<In
191191
queue.insert(EdgeCost(to: 0, cost: 0.0, from: 0))
192192

193193
// Take an element with the smallest cost from the queue and add its
194-
// neighbours to the queue if their cost was updated
194+
// neighbors to the queue if their cost was updated
195195
while !queue.isEmpty() {
196196
// Add an edge with minimum cost to the spanning tree
197197
let e = queue.pop()!

benchmark/single-source/SortStrings.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ var stringBenchmarkWords: [String] = [
976976
"heterospory",
977977
"Turkeydom",
978978
"anteprandial",
979-
"neighbourship",
979+
"neighborship",
980980
"thatchless",
981981
"drepanoid",
982982
"lusher",
@@ -1994,7 +1994,7 @@ var stringBenchmarkWordsUnicode: [String] = [
19941994
"❄️heterospory",
19951995
"❄️Turkeydom",
19961996
"❄️anteprandial",
1997-
"️neighbourship",
1997+
"️neighborship",
19981998
"❄️thatchless",
19991999
"❄️drepanoid",
20002000
"❄️lusher",

benchmark/utils/main.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ import ObjectAllocation
6868
import ObjectiveCBridging
6969
import ObjectiveCBridgingStubs
7070
import ObjectiveCNoBridgingStubs
71+
import ObserverClosure
72+
import ObserverForwarderStruct
73+
import ObserverPartiallyAppliedMethod
74+
import ObserverUnappliedMethod
7175
import OpenClose
7276
import Phonebook
7377
import PolymorphicCalls
@@ -197,6 +201,10 @@ precommitTests = [
197201
"ObjectiveCBridgeToNSDictionary": run_ObjectiveCBridgeToNSDictionary,
198202
"ObjectiveCBridgeToNSSet": run_ObjectiveCBridgeToNSSet,
199203
"ObjectiveCBridgeToNSString": run_ObjectiveCBridgeToNSString,
204+
"ObserverClosure": run_ObserverClosure,
205+
"ObserverForwarderStruct": run_ObserverForwarderStruct,
206+
"ObserverPartiallyAppliedMethod": run_ObserverPartiallyAppliedMethod,
207+
"ObserverUnappliedMethod": run_ObserverUnappliedMethod,
200208
"OpenClose": run_OpenClose,
201209
"Phonebook": run_Phonebook,
202210
"PolymorphicCalls": run_PolymorphicCalls,

0 commit comments

Comments
 (0)