Skip to content

Commit f870349

Browse files
authored
---
yaml --- r: 294270 b: refs/heads/tensorflow c: 14a20ee h: refs/heads/master
1 parent db570fa commit f870349

File tree

258 files changed

+4674
-2039
lines changed

Some content is hidden

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

258 files changed

+4674
-2039
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: b85c600395b3d21b00830f58246376743ba1c474
819+
refs/heads/tensorflow: 14a20eea03e9115e2c5cf91bccc86e6cd5334df9
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ Swift 5.1
197197
}
198198
```
199199

200-
* `weak` and `unowned` stored properties no longer inhibit the
200+
* [SR-9827][]:
201+
202+
`weak` and `unowned` stored properties no longer inhibit the
201203
automatic synthesis of `Equatable` or `Hashable` conformance.
202204

203205
* [SR-2688][]:
@@ -7695,3 +7697,4 @@ Swift 1.0
76957697
[SR-8109]: <https://bugs.swift.org/browse/SR-8109>
76967698
[SR-8546]: <https://bugs.swift.org/browse/SR-8546>
76977699
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
7700+
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>

branches/tensorflow/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,12 @@ endif()
10511051
# https://bugs.swift.org/browse/SR-5975
10521052
if(SWIFT_BUILD_STDLIB)
10531053
add_subdirectory(stdlib)
1054+
else()
1055+
# Some tools (e.g. swift-reflection-dump) rely on a host swiftReflection, so
1056+
# ensure we build that when building tools.
1057+
if(SWIFT_INCLUDE_TOOLS)
1058+
add_subdirectory(stdlib/public/Reflection)
1059+
endif()
10541060
endif()
10551061

10561062
if(SWIFT_INCLUDE_APINOTES)

branches/tensorflow/apinotes/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ add_custom_command(
2323
COMMAND
2424
"${CMAKE_COMMAND}" "-E" "copy_if_different" ${inputs} "${output_dir}/")
2525

26-
add_custom_target("copy_apinotes"
26+
add_custom_target("copy_apinotes" ALL
2727
DEPENDS "${outputs}" "${output_dir}"
2828
COMMENT "Copying API notes to ${output_dir}"
2929
SOURCES "${sources}")

branches/tensorflow/benchmark/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ set(SWIFT_BENCH_MODULES
9292
single-source/Hash
9393
single-source/Histogram
9494
single-source/InsertCharacter
95+
single-source/IntegerParsing
9596
single-source/Integrate
9697
single-source/IterateData
9798
single-source/Join

branches/tensorflow/benchmark/single-source/AngryPhonebook.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public let AngryPhonebook = BenchmarkInfo(
2121
tags: [.validation, .api, .String],
2222
legacyFactor: 7)
2323

24-
var words = [
24+
let words = [
2525
"James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph",
2626
"Charles", "Thomas", "Christopher", "Daniel", "Matthew", "Donald", "Anthony",
2727
"Paul", "Mark", "George", "Steven", "Kenneth", "Andrew", "Edward", "Brian",

branches/tensorflow/benchmark/single-source/AnyHashableWithAClass.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import TestsUtils
2222
// 11% _swift_stdlib_makeAnyHashableUpcastingToHashableBaseType
2323
// 16% _swift_retain_[n]
2424
// 5% swift_conformsToProtocol
25-
public var AnyHashableWithAClass = BenchmarkInfo(
25+
public let AnyHashableWithAClass = BenchmarkInfo(
2626
name: "AnyHashableWithAClass",
2727
runFunction: run_AnyHashableWithAClass,
2828
tags: [.abstraction, .runtime, .cpubench],

branches/tensorflow/benchmark/single-source/ArrayOfGenericPOD.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public func run_ArrayOfGenericPOD(_ N: Int) {
7676

7777
// --- ArrayInitFromSlice
7878

79-
var globalArray = Array<UInt8>(repeating: 0, count: 4096)
79+
let globalArray = Array<UInt8>(repeating: 0, count: 4096)
8080

8181
func createArrayOfPOD() {
8282
blackHole(globalArray)

branches/tensorflow/benchmark/single-source/ArraySetElement.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import TestsUtils
1515
// 33% isUniquelyReferenced
1616
// 15% swift_rt_swift_isUniquelyReferencedOrPinned_nonNull_native
1717
// 18% swift_isUniquelyReferencedOrPinned_nonNull_native
18-
public var ArraySetElement = BenchmarkInfo(
18+
public let ArraySetElement = BenchmarkInfo(
1919
name: "ArraySetElement",
2020
runFunction: run_ArraySetElement,
2121
tags: [.runtime, .cpubench]

branches/tensorflow/benchmark/single-source/ChainedFilterMap.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import TestsUtils
22

3-
public var ChainedFilterMap = [
3+
public let ChainedFilterMap = [
44
BenchmarkInfo(name: "ChainedFilterMap", runFunction: run_ChainedFilterMap,
55
tags: [.algorithm], setUpFunction: { blackHole(first100k) },
66
legacyFactor: 9),

branches/tensorflow/benchmark/single-source/Chars.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public let Chars = BenchmarkInfo(
2020
setUpFunction: { blackHole(alphabetInput) },
2121
legacyFactor: 50)
2222

23-
var alphabetInput: [Character] = [
23+
let alphabetInput: [Character] = [
2424
"A", "B", "C", "D", "E", "F", "G",
2525
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
2626
"S", "T", "U",

branches/tensorflow/benchmark/single-source/Hash.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Hash {
127127
final
128128
class MD5 : Hash {
129129
// Integer part of the sines of integers (in radians) * 2^32.
130-
var k : [UInt32] = [0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee ,
130+
let k : [UInt32] = [0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee ,
131131
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501 ,
132132
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be ,
133133
0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821 ,
@@ -145,7 +145,7 @@ class MD5 : Hash {
145145
0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 ]
146146

147147
// Per-round shift amounts
148-
var r : [UInt32] = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
148+
let r : [UInt32] = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
149149
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
150150
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
151151
6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]
@@ -433,7 +433,7 @@ class SHA256 : Hash {
433433
var h6: UInt32 = 0
434434
var h7: UInt32 = 0
435435

436-
var k : [UInt32] = [
436+
let k : [UInt32] = [
437437
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
438438
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
439439
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
//===--- IntegerParsing.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 IntegerParsing = [
16+
BenchmarkInfo(name: "ParseInt.Small.Decimal",
17+
runFunction: run_ParseIntFromSmallDecimal,
18+
tags: [.validation, .api],
19+
setUpFunction: { blackHole(smallDecimalStrings) }),
20+
BenchmarkInfo(name: "ParseInt.Small.Binary",
21+
runFunction: run_ParseIntFromSmallBinary,
22+
tags: [.validation, .api],
23+
setUpFunction: { blackHole(smallBinaryStrings) }),
24+
BenchmarkInfo(name: "ParseInt.Small.Hex",
25+
runFunction: run_ParseIntFromSmallHex,
26+
tags: [.validation, .api],
27+
setUpFunction: { blackHole(smallHexStrings) }),
28+
BenchmarkInfo(name: "ParseInt.Small.UncommonRadix",
29+
runFunction: run_ParseIntFromSmallUncommonRadix,
30+
tags: [.validation, .api],
31+
setUpFunction: { blackHole(smallUncommonRadixStrings) }),
32+
BenchmarkInfo(name: "ParseInt.Large.Decimal",
33+
runFunction: run_ParseIntFromLargeDecimal,
34+
tags: [.validation, .api],
35+
setUpFunction: { blackHole(largeDecimalStrings) }),
36+
BenchmarkInfo(name: "ParseInt.Large.Binary",
37+
runFunction: run_ParseIntFromLargeBinary,
38+
tags: [.validation, .api],
39+
setUpFunction: { blackHole(largeBinaryStrings) }),
40+
BenchmarkInfo(name: "ParseInt.Large.Hex",
41+
runFunction: run_ParseIntFromLargeHex,
42+
tags: [.validation, .api],
43+
setUpFunction: { blackHole(largeHexStrings) }),
44+
BenchmarkInfo(name: "ParseInt.Large.UncommonRadix",
45+
runFunction: run_ParseIntFromLargeUncommonRadix,
46+
tags: [.validation, .api],
47+
setUpFunction: { blackHole(largeUncommonRadixStrings) }),
48+
]
49+
50+
private let uncommonRadix: Int = 7
51+
private let smallValuesSum: Int = 0
52+
private let largeValuesSum: Int64 = 4790606764485943206
53+
// Values
54+
private let smallValues: [Int] = Array(-1000...1000)
55+
private let largeValues: [Int64] = {
56+
var rng = SplitMix64(seed: 42)
57+
return (0..<2000).map { _ in Int64.random(in: .min ... .max, using: &rng) }
58+
}()
59+
// Strings
60+
private let smallDecimalStrings: [String]
61+
= smallValues.map { String($0, radix: 10) }
62+
private let smallBinaryStrings: [String]
63+
= smallValues.map { String($0, radix: 2) }
64+
private let smallHexStrings: [String]
65+
= smallValues.map { String($0, radix: 16) }
66+
private let smallUncommonRadixStrings: [String]
67+
= smallValues.map { String($0, radix: uncommonRadix) }
68+
private let largeDecimalStrings: [String]
69+
= largeValues.map { String($0, radix: 10) }
70+
private let largeBinaryStrings: [String]
71+
= largeValues.map { String($0, radix: 2) }
72+
private let largeHexStrings: [String]
73+
= largeValues.map { String($0, radix: 16) }
74+
private let largeUncommonRadixStrings: [String]
75+
= largeValues.map { String($0, radix: uncommonRadix) }
76+
77+
@inline(never)
78+
public func run_ParseIntFromSmallDecimal(N: Int) {
79+
var result = 0
80+
let count = N*10
81+
for _ in 0..<count {
82+
for string in smallDecimalStrings {
83+
result &+= Int(string, radix: 10)!
84+
}
85+
}
86+
CheckResults(result == smallValuesSum &* count)
87+
}
88+
89+
@inline(never)
90+
public func run_ParseIntFromSmallBinary(N: Int) {
91+
var result = 0
92+
let count = N*10
93+
for _ in 0..<count {
94+
for string in smallBinaryStrings {
95+
result &+= Int(string, radix: 2)!
96+
}
97+
}
98+
CheckResults(result == smallValuesSum &* count)
99+
}
100+
101+
@inline(never)
102+
public func run_ParseIntFromSmallHex(N: Int) {
103+
var result = 0
104+
let count = N*10
105+
for _ in 0..<count {
106+
for string in smallHexStrings {
107+
result &+= Int(string, radix: 16)!
108+
}
109+
}
110+
CheckResults(result == smallValuesSum &* count)
111+
}
112+
113+
@inline(never)
114+
public func run_ParseIntFromSmallUncommonRadix(N: Int) {
115+
var result = 0
116+
let count = N*10
117+
for _ in 0..<count {
118+
for string in smallUncommonRadixStrings {
119+
result &+= Int(string, radix: uncommonRadix)!
120+
}
121+
}
122+
CheckResults(result == smallValuesSum &* count)
123+
}
124+
125+
@inline(never)
126+
public func run_ParseIntFromLargeDecimal(N: Int) {
127+
var result: Int64 = 0
128+
for _ in 0..<N {
129+
for string in largeDecimalStrings {
130+
result &+= Int64(string, radix: 10)!
131+
}
132+
}
133+
CheckResults(result == largeValuesSum &* Int64(N))
134+
}
135+
136+
@inline(never)
137+
public func run_ParseIntFromLargeBinary(N: Int) {
138+
var result: Int64 = 0
139+
for _ in 0..<N {
140+
for string in largeBinaryStrings {
141+
result &+= Int64(string, radix: 2)!
142+
}
143+
}
144+
CheckResults(result == largeValuesSum &* Int64(N))
145+
}
146+
147+
@inline(never)
148+
public func run_ParseIntFromLargeHex(N: Int) {
149+
var result: Int64 = 0
150+
for _ in 0..<N {
151+
for string in largeHexStrings {
152+
result &+= Int64(string, radix: 16)!
153+
}
154+
}
155+
CheckResults(result == largeValuesSum &* Int64(N))
156+
}
157+
158+
@inline(never)
159+
public func run_ParseIntFromLargeUncommonRadix(N: Int) {
160+
var result: Int64 = 0
161+
for _ in 0..<N {
162+
for string in largeUncommonRadixStrings {
163+
result &+= Int64(string, radix: uncommonRadix)!
164+
}
165+
}
166+
CheckResults(result == largeValuesSum &* Int64(N))
167+
}

branches/tensorflow/benchmark/single-source/LuhnAlgoEager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import TestsUtils
77

8-
public var LuhnAlgoEager = BenchmarkInfo(
8+
public let LuhnAlgoEager = BenchmarkInfo(
99
name: "LuhnAlgoEager",
1010
runFunction: run_LuhnAlgoEager,
1111
tags: [.algorithm]

branches/tensorflow/benchmark/single-source/LuhnAlgoLazy.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import TestsUtils
77

8-
public var LuhnAlgoLazy = BenchmarkInfo(
8+
public let LuhnAlgoLazy = BenchmarkInfo(
99
name: "LuhnAlgoLazy",
1010
runFunction: run_LuhnAlgoLazy,
1111
tags: [.algorithm]

branches/tensorflow/benchmark/single-source/NibbleSort.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import TestsUtils
66

7-
public var NibbleSort = BenchmarkInfo(
7+
public let NibbleSort = BenchmarkInfo(
88
name: "NibbleSort",
99
runFunction: run_NibbleSort,
1010
tags: [.validation],

branches/tensorflow/benchmark/single-source/PolymorphicCalls.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ applying a jump-threading in combination with the speculative devirtualization.
2222

2323
import TestsUtils
2424

25-
public var PolymorphicCalls = BenchmarkInfo(
25+
public let PolymorphicCalls = BenchmarkInfo(
2626
name: "PolymorphicCalls",
2727
runFunction: run_PolymorphicCalls,
2828
tags: [.abstraction, .cpubench]

branches/tensorflow/benchmark/single-source/PopFront.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public func run_PopFrontArray(_ N: Int) {
4242

4343
@inline(never)
4444
public func run_PopFrontUnsafePointer(_ N: Int) {
45-
var orig = Array(repeating: 1, count: arrayCount)
45+
let orig = Array(repeating: 1, count: arrayCount)
4646
let a = UnsafeMutablePointer<Int>.allocate(capacity: arrayCount)
4747
for _ in 1...N {
4848
for i in 0..<arrayCount {

branches/tensorflow/benchmark/single-source/SevenBoom.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import Foundation
2222
// 7% objc_msgSend
2323
// 5% _swift_release_
2424
// 2% _swift_retain_
25-
public var SevenBoom = BenchmarkInfo(
25+
public let SevenBoom = BenchmarkInfo(
2626
name: "SevenBoom",
2727
runFunction: run_SevenBoom,
2828
tags: [.runtime, .exceptions, .bridging, .cpubench]

branches/tensorflow/benchmark/single-source/SortStrings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ public func run_SortSortedStrings(_ N: Int) {
10501050
}
10511051
}
10521052

1053-
var unicodeWords: [String] = [
1053+
let unicodeWords: [String] = [
10541054
"❄️woodshed",
10551055
"❄️lakism",
10561056
"❄️gastroperiodynia",

branches/tensorflow/benchmark/single-source/StrComplexWalk.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public let StrComplexWalk = BenchmarkInfo(
2020

2121
@inline(never)
2222
public func run_StrComplexWalk(_ N: Int) {
23-
var s = "निरन्तरान्धकारिता-दिगन्तर-कन्दलदमन्द-सुधारस-बिन्दु-सान्द्रतर-घनाघन-वृन्द-सन्देहकर-स्यन्दमान-मकरन्द-बिन्दु-बन्धुरतर-माकन्द-तरु-कुल-तल्प-कल्प-मृदुल-सिकता-जाल-जटिल-मूल-तल-मरुवक-मिलदलघु-लघु-लय-कलित-रमणीय-पानीय-शालिका-बालिका-करार-विन्द-गलन्तिका-गलदेला-लवङ्ग-पाटल-घनसार-कस्तूरिकातिसौरभ-मेदुर-लघुतर-मधुर-शीतलतर-सलिलधारा-निराकरिष्णु-तदीय-विमल-विलोचन-मयूख-रेखापसारित-पिपासायास-पथिक-लोकान्"
23+
let s = "निरन्तरान्धकारिता-दिगन्तर-कन्दलदमन्द-सुधारस-बिन्दु-सान्द्रतर-घनाघन-वृन्द-सन्देहकर-स्यन्दमान-मकरन्द-बिन्दु-बन्धुरतर-माकन्द-तरु-कुल-तल्प-कल्प-मृदुल-सिकता-जाल-जटिल-मूल-तल-मरुवक-मिलदलघु-लघु-लय-कलित-रमणीय-पानीय-शालिका-बालिका-करार-विन्द-गलन्तिका-गलदेला-लवङ्ग-पाटल-घनसार-कस्तूरिकातिसौरभ-मेदुर-लघुतर-मधुर-शीतलतर-सलिलधारा-निराकरिष्णु-तदीय-विमल-विलोचन-मयूख-रेखापसारित-पिपासायास-पथिक-लोकान्"
2424
let ref_result = 379
2525
for _ in 1...200*N {
2626
var count = 0

0 commit comments

Comments
 (0)