Skip to content

Commit f10ae47

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-next
2 parents b87fc0b + 67f4ae0 commit f10ae47

File tree

1,534 files changed

+22439
-13169
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,534 files changed

+22439
-13169
lines changed

CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -506,20 +506,20 @@ if(XCODE)
506506
endif()
507507

508508
# FIXME: the parameters we specify in SWIFT_SDKS are lacking architecture specifics,
509-
# so we need to hard-code it. For example, the SDK for Android is just 'ANDROID',
510-
# which we assume below to be armv7.
509+
# so we need to hard-code it. For example, the SDK for Android is just 'ANDROID',
510+
# which we assume below to be armv7.
511511
# The iOS SDKs all have their architectures hardcoded because they are just specified by name (e.g. 'IOS' or 'WATCHOS').
512512
# We can't cross-compile the standard library for another linux architecture,
513513
# because the SDK list would just be 'LINUX' and we couldn't disambiguate it from the host.
514-
#
514+
#
515515
# To fix it, we would need to append the architecture to the SDKs,
516516
# for example: 'OSX-x86_64;IOS-armv7;...etc'.
517517
# We could easily do that - we have all of that information in build-script-impl.
518518
# Also, we would need to be provided with the sysroot for each SDK (see SWIFT_ANDROID_SDK_PATH/SWIFT_SDK_ANDROID_PATH).
519519
# Darwin targets cheat and use `xcrun`.
520520

521521
if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
522-
522+
523523
set(CMAKE_EXECUTABLE_FORMAT "ELF")
524524
set(SWIFT_HOST_VARIANT "linux" CACHE STRING
525525
"Deployment OS for Swift host tools (the compiler) [linux].")
@@ -550,7 +550,7 @@ if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
550550
endif()
551551

552552
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "FREEBSD")
553-
553+
554554
set(CMAKE_EXECUTABLE_FORMAT "ELF")
555555
set(SWIFT_HOST_VARIANT "freebsd" CACHE STRING
556556
"Deployment OS for Swift host tools (the compiler) [freebsd].")
@@ -563,13 +563,13 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "FREEBSD")
563563
"x86_64-unknown-freebsd${FREEBSD_SYSTEM_VERSION}" "/")
564564
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
565565
set(SWIFT_PRIMARY_VARIANT_ARCH_default "x86_64")
566-
566+
567567
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "CYGWIN")
568-
568+
569569
# set(CMAKE_EXECUTABLE_FORMAT "ELF")
570570
set(SWIFT_HOST_VARIANT "windows" CACHE STRING
571571
"Deployment OS for Swift host tools (the compiler) [windows].")
572-
572+
573573
configure_sdk_unix(CYGWIN "Cygwin" "windows" "cygwin" "windows" "x86_64-unknown-windows-cygnus" "/")
574574
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
575575
set(SWIFT_PRIMARY_VARIANT_ARCH_default "x86_64")
@@ -579,7 +579,7 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" MATCHES "(OSX|IOS*|TVOS*|WATCHOS*)")
579579
set(SWIFT_HOST_VARIANT "macosx" CACHE STRING
580580
"Deployment OS for Swift host tools (the compiler) [macosx, iphoneos].")
581581

582-
# Display Xcode toolchain version.
582+
# Display Xcode toolchain version.
583583
# The SDK configuration below prints each SDK version.
584584
execute_process(
585585
COMMAND "xcodebuild" "-version"

LICENSE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@
200200
See the License for the specific language governing permissions and
201201
limitations under the License.
202202

203-
204-
203+
204+
205205
## Runtime Library Exception to the Apache 2.0 License: ##
206206

207207

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/CoreGraphics.apinotes

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Functions:
9090
# replaced by Equatable / ==
9191
SwiftName: CGAffineTransform.__equalTo(self:_:)
9292
SwiftPrivate: true
93-
93+
9494
# CGBitmapContext
9595
- Name: CGBitmapContextCreateWithData
9696
SwiftName: CGContext.init(data:width:height:bitsPerComponent:bytesPerRow:space:bitmapInfo:releaseCallback:releaseInfo:)
@@ -114,7 +114,7 @@ Functions:
114114
SwiftName: getter:CGContext.alphaInfo(self:)
115115
- Name: CGBitmapContextCreateImage
116116
SwiftName: CGContext.makeImage(self:)
117-
117+
118118
# CGColor
119119
#
120120
- Name: CGColorCreate
@@ -409,7 +409,7 @@ Functions:
409409
- Name: CGGetLastMouseDelta
410410
# replaced by a version that returns CGVector instead of using out-pointers
411411
SwiftPrivate: true
412-
412+
413413
# CGEvent
414414
- Name: CGEventCreateFromData
415415
SwiftName: CGEvent.init(withDataAllocator:data:)
@@ -421,7 +421,7 @@ Functions:
421421
SwiftName: CGEvent.postToPid(_:self:)
422422
- Name: CGEventCreateSourceFromEvent
423423
SwiftName: CGEventSource.init(event:)
424-
424+
425425
# CGFont
426426
- Name: CGFontCreateWithDataProvider
427427
SwiftName: CGFont.init(_:)
@@ -443,7 +443,7 @@ Functions:
443443
SwiftName: CGFont.table(self:for:)
444444
- Name: CGFontCreateCopyWithVariations
445445
SwiftName: CGFont.copy(self:withVariations:)
446-
446+
447447
# CGGeometry
448448
- Name: CGPointCreateDictionaryRepresentation
449449
SwiftName: getter:CGPoint.dictionaryRepresentation(self:)
@@ -474,7 +474,7 @@ Functions:
474474
# hide in favor of an init (can't map to initializer because out-pointer)
475475
SwiftName: CGRect.__setFromDictionaryRepresentation(_:_:)
476476
SwiftPrivate: true
477-
477+
478478
# CGGradient
479479
- Name: CGGradientCreateWithColorComponents
480480
SwiftName: CGGradient.init(colorSpace:colorComponents:locations:count:)
@@ -557,7 +557,7 @@ Functions:
557557
# CGPSConverter
558558
- Name: CGPSConverterIsConverting
559559
SwiftName: getter:CGPSConverter.isConverting(self:)
560-
560+
561561
# CGPath
562562
- Name: CGPathCreateCopy
563563
SwiftName: CGPath.copy(self:)

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

apinotes/GameplayKit.apinotes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Classes:
206206
- Selector: 'shuffledArrayWithRandomSource:'
207207
SwiftName: shuffled(using:)
208208
MethodKind: Instance
209-
- Name: GKARC4RandomSource
209+
- Name: GKARC4RandomSource
210210
Methods:
211211
- Selector: 'dropValuesWithCount:'
212212
SwiftName: dropValues(_:)

apinotes/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ API notes are organized into a set of `.apinotes` files. Each
1111
written in YAML (FIXME: to be) described below. These YAML sources
1212
must be manually compiled into a binary representation (`.apinotesc`)
1313
that the Swift compiler will lazily load when it builds code, also
14-
described below.
14+
described below.
1515

1616
# API Notes YAML Format
1717

@@ -42,7 +42,7 @@ When updating API notes for a system module, recompile the API notes
4242
and place the result in the appropriate directories listed above. The
4343
Swift compiler itself need not be recompiled except in rare cases
4444
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
45+
API notes for a given module `$MODULE` and place them into their
4646

4747
### OS X
4848
```

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

benchmark/single-source/ArrayAppend.swift

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,14 @@ public func run_ArrayAppendReserved(_ N: Int) {
4242
}
4343

4444
// Append a sequence. Length of sequence unknown so
45-
// can't pre-reserve capacity. Should be comparable
46-
// to append single elements.
45+
// can't pre-reserve capacity.
4746
@inline(never)
4847
public func run_ArrayAppendSequence(_ N: Int) {
4948
let seq = stride(from: 0, to: 10_000, by: 1)
5049
for _ in 0..<N {
5150
for _ in 0..<10 {
5251
var nums = [Int]()
53-
for _ in 0..<4 {
52+
for _ in 0..<8 {
5453
nums.append(contentsOf: seq)
5554
}
5655
}
@@ -60,16 +59,102 @@ public func run_ArrayAppendSequence(_ N: Int) {
6059
// Append another array. Length of sequence known so
6160
// can pre-reserve capacity.
6261
@inline(never)
63-
public func run_ArrayAppendArray(_ N: Int) {
62+
public func run_ArrayAppendArrayOfInt(_ N: Int) {
6463
let other = Array(repeating: 1, count: 10_000)
6564
for _ in 0..<N {
6665
for _ in 0..<10 {
6766
var nums = [Int]()
67+
for _ in 0..<8 {
68+
nums += other
69+
}
70+
}
71+
}
72+
}
73+
74+
// Append another array. Length of sequence known so
75+
// can pre-reserve capacity.
76+
@inline(never)
77+
public func run_ArrayAppendStrings(_ N: Int) {
78+
let other = stride(from: 0, to: 10_000, by: 1).map { "\($0)" }
79+
for _ in 0..<N {
80+
for _ in 0..<10 {
81+
var nums = [String]()
82+
// lower inner count due to string slowness
6883
for _ in 0..<4 {
69-
// note, this uses += rather than append(contentsOf:),
70-
// to ensure operator doesn't introduce inefficiency
7184
nums += other
7285
}
7386
}
7487
}
7588
}
89+
90+
struct S<T,U> {
91+
var x: T
92+
var y: U
93+
}
94+
95+
// Append another array. Length of sequence known so
96+
// can pre-reserve capacity.
97+
@inline(never)
98+
public func run_ArrayAppendGenericStructs(_ N: Int) {
99+
let other = Array(repeating: S(x: 3, y: 4.2), count: 10_000)
100+
for _ in 0..<N {
101+
for _ in 0..<10 {
102+
var nums = [S<Int,Double>]()
103+
for _ in 0..<8 {
104+
nums += other
105+
}
106+
}
107+
}
108+
}
109+
110+
// Append another array. Length of sequence known so
111+
// can pre-reserve capacity.
112+
@inline(never)
113+
public func run_ArrayAppendOptionals(_ N: Int) {
114+
let other: [Int?] = Array(repeating: 1, count: 10_000)
115+
116+
for _ in 0..<N {
117+
for _ in 0..<10 {
118+
var nums = [Int?]()
119+
for _ in 0..<8 {
120+
nums += other
121+
}
122+
}
123+
}
124+
}
125+
126+
127+
// Append a lazily-mapped array. Length of sequence known so
128+
// can pre-reserve capacity, but no optimization points used.
129+
@inline(never)
130+
public func run_ArrayAppendLazyMap(_ N: Int) {
131+
let other = Array(0..<10_000).lazy.map { $0 * 2 }
132+
133+
for _ in 0..<N {
134+
for _ in 0..<10 {
135+
var nums = [Int]()
136+
for _ in 0..<8 {
137+
nums += other
138+
}
139+
}
140+
}
141+
}
142+
143+
144+
// Append a Repeat collection. Length of sequence known so
145+
// can pre-reserve capacity, but no optimization points used.
146+
@inline(never)
147+
public func run_ArrayAppendRepeatCol(_ N: Int) {
148+
let other = repeatElement(1, count: 10_000)
149+
150+
for _ in 0..<N {
151+
for _ in 0..<10 {
152+
var nums = [Int]()
153+
for _ in 0..<8 {
154+
nums += other
155+
}
156+
}
157+
}
158+
}
159+
160+
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+
}

0 commit comments

Comments
 (0)