Skip to content

Commit aef19c9

Browse files
authored
Merge pull request #29964 from apple/tensorflow-merge
Tensorflow merge
2 parents aa7886f + 768942e commit aef19c9

File tree

727 files changed

+26875
-12919
lines changed

Some content is hidden

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

727 files changed

+26875
-12919
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ CHANGELOG
2626
Swift Next
2727
----------
2828

29+
* [SE-0266][]:
30+
31+
Enumerations with no associated values, or only `Comparable` associated values, can opt-in to synthesized `Comparable` conformance by declaring conformance to the `Comparable` protocol. The synthesized implementation orders the cases first by case-declaration order, and then by lexicographic order of the associated values (if any).
32+
33+
```swift
34+
enum Foo: Comparable {
35+
case a(Int), b(Int), c
36+
}
37+
38+
// .a(0) < .a(1) < .b(0) < .b(1) < .c
39+
```
40+
2941
* [SE-0269][]:
3042

3143
When an escaping closure explicitly captures `self` in its capture list, the
@@ -7901,6 +7913,7 @@ Swift 1.0
79017913
[SE-0252]: <https://github.com/apple/swift-evolution/blob/master/proposals/0252-keypath-dynamic-member-lookup.md>
79027914
[SE-0253]: <https://github.com/apple/swift-evolution/blob/master/proposals/0253-callable.md>
79037915
[SE-0254]: <https://github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>
7916+
[SE-0266]: <https://github.com/apple/swift-evolution/blob/master/proposals/0266-synthesized-comparable-for-enumerations.md>
79047917
[SE-0269]: <https://github.com/apple/swift-evolution/blob/master/proposals/0269-implicit-self-explicit-capture.md>
79057918

79067919
[SR-106]: <https://bugs.swift.org/browse/SR-106>

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,29 @@ Additionally, [Bazel](https://www.bazel.build) between v0.24.1 and v0.25.2 (incl
5252

5353
For Ubuntu, you'll need the following development dependencies:
5454

55-
sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libcurl4-openssl-dev libblocksruntime-dev systemtap-sdt-dev tzdata rsync
56-
57-
Additionally, [Bazel](https://www.bazel.build) between v0.24.1 and v0.25.2 (inclusive) is required to build with TensorFlow support. Ubuntu installation instructions can be found [below](#bazel).
55+
```
56+
sudo apt-get install \
57+
clang \
58+
cmake \
59+
git \
60+
icu-devtools \
61+
libcurl4-openssl-dev \
62+
libedit-dev \
63+
libicu-dev \
64+
libncurses5-dev \
65+
libpython-dev \
66+
libsqlite3-dev \
67+
libxml2-dev \
68+
ninja-build \
69+
pkg-config \
70+
python \
71+
python-six \
72+
rsync \
73+
swig \
74+
systemtap-sdt-dev \
75+
tzdata \
76+
uuid-dev
77+
```
5878

5979
**Note:** LLDB currently requires at least `swig-1.3.40` but will successfully build
6080
with version 2 shipped with Ubuntu.

benchmark/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ set(SWIFT_BENCH_MODULES
6262
single-source/Combos
6363
single-source/DataBenchmarks
6464
single-source/DeadArray
65+
single-source/DevirtualizeProtocolComposition
6566
single-source/DictOfArraysToArrayOfDicts
6667
single-source/DictTest
6768
single-source/DictTest2
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//===--- DevirtualizeProtocolComposition.swift -------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2019 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+
import TestsUtils
14+
15+
public let DevirtualizeProtocolComposition = [
16+
BenchmarkInfo(name: "DevirtualizeProtocolComposition", runFunction: run_DevirtualizeProtocolComposition, tags: [.validation, .api]),
17+
]
18+
19+
protocol Pingable { func ping() -> Int; func pong() -> Int}
20+
21+
public class Game<T> {
22+
func length() -> Int { return 10 }
23+
}
24+
25+
public class PingPong: Game<String> { }
26+
27+
extension PingPong : Pingable {
28+
func ping() -> Int { return 1 }
29+
func pong() -> Int { return 2 }
30+
}
31+
32+
func playGame<T>(_ x: Game<T> & Pingable) -> Int {
33+
var sum = 0
34+
for _ in 0..<x.length() {
35+
sum += x.ping() + x.pong()
36+
}
37+
return sum
38+
}
39+
40+
@inline(never)
41+
public func run_DevirtualizeProtocolComposition(N: Int) {
42+
for _ in 0..<N * 20_000 {
43+
blackHole(playGame(PingPong()))
44+
}
45+
}

benchmark/utils/main.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import Codable
5050
import Combos
5151
import DataBenchmarks
5252
import DeadArray
53+
import DevirtualizeProtocolComposition
5354
import DictOfArraysToArrayOfDicts
5455
import DictTest
5556
import DictTest2
@@ -231,6 +232,7 @@ registerBenchmark(Combos)
231232
registerBenchmark(ClassArrayGetter)
232233
registerBenchmark(DataBenchmarks)
233234
registerBenchmark(DeadArray)
235+
registerBenchmark(DevirtualizeProtocolComposition)
234236
registerBenchmark(DictOfArraysToArrayOfDicts)
235237
registerBenchmark(Dictionary)
236238
registerBenchmark(Dictionary2)

0 commit comments

Comments
 (0)