Skip to content

Commit 578a526

Browse files
Merge branch 'master' into se-147
2 parents ca6353d + e844d57 commit 578a526

File tree

7,253 files changed

+12984
-11792
lines changed

Some content is hidden

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

7,253 files changed

+12984
-11792
lines changed

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,33 @@ CHANGELOG
2020
Swift 3.1
2121
---------
2222

23+
* The `withoutActuallyEscaping` function from [SE-0103][] has been implemented.
24+
To pass off a non-escaping closure to an API that formally takes an
25+
`@escaping` closure, but which is used in a way that will not in fact
26+
escape it in practice, use `withoutActuallyEscaping` to get an escapable
27+
copy of the closure and delimit its expected lifetime. For example:
28+
29+
```swift
30+
func doSimultaneously(_ f: () -> (), and g: () -> (), on q: DispatchQueue) {
31+
// DispatchQueue.async normally has to be able to escape its closure
32+
// since it may be called at any point after the operation is queued.
33+
// By using a barrier, we ensure it does not in practice escape.
34+
withoutActuallyEscaping(f) { escapableF in
35+
withoutActuallyEscaping(g) { escapableG in
36+
q.async(escapableF)
37+
q.async(escapableG)
38+
q.sync(flags: .barrier) {}
39+
}
40+
}
41+
// `escapableF` and `escapableG` must be dequeued by the point
42+
// `withoutActuallyEscaping` returns.
43+
}
44+
```
45+
46+
The old workaround of using `unsafeBitCast` to cast to an `@escaping` type
47+
is not guaranteed to work in future versions of Swift, and will
48+
now raise a warning.
49+
2350
* [SR-1446](https://bugs.swift.org/browse/SR-1446)
2451

2552
Nested types may now appear inside generic types, and nested types may have their own generic parameters:

benchmark/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ list(APPEND CMAKE_MODULE_PATH
1515
include(AddSwiftBenchmarkSuite)
1616

1717
set(SWIFT_BENCH_MODULES
18-
single-source/unit-tests/ObjectiveCBridging
19-
single-source/unit-tests/ObjectiveCBridgingStubs
20-
single-source/unit-tests/ObjectiveCNoBridgingStubs
21-
single-source/unit-tests/StackPromo
2218
single-source/Ackermann
2319
single-source/AngryPhonebook
2420
single-source/AnyHashableWithAClass
@@ -64,10 +60,13 @@ set(SWIFT_BENCH_MODULES
6460
single-source/NSStringConversion
6561
single-source/NopDeinit
6662
single-source/ObjectAllocation
63+
single-source/ObjectiveCBridging
64+
single-source/ObjectiveCBridgingStubs
65+
single-source/ObjectiveCNoBridgingStubs
6766
single-source/ObserverClosure
6867
single-source/ObserverForwarderStruct
69-
single-source/ObserverPartiallyAppliedMethod
70-
single-source/ObserverUnappliedMethod
68+
single-source/ObserverPartiallyAppliedMethod
69+
single-source/ObserverUnappliedMethod
7170
single-source/OpenClose
7271
single-source/Phonebook
7372
single-source/PolymorphicCalls
@@ -77,15 +76,16 @@ set(SWIFT_BENCH_MODULES
7776
single-source/ProtocolDispatch
7877
single-source/ProtocolDispatch2
7978
single-source/RC4
80-
single-source/ReversedCollections
8179
single-source/RGBHistogram
8280
single-source/RangeAssignment
8381
single-source/RecursiveOwnedParameter
82+
single-source/ReversedCollections
8483
single-source/SetTests
8584
single-source/SevenBoom
8685
single-source/Sim2DArray
8786
single-source/SortLettersInPlace
8887
single-source/SortStrings
88+
single-source/StackPromo
8989
single-source/StaticArray
9090
single-source/StrComplexWalk
9191
single-source/StrToInt

benchmark/scripts/Benchmark_DTrace.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# This source file is part of the Swift.org open source project
66
#
7-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
88
# Licensed under Apache License v2.0 with Runtime Library Exception
99
#
1010
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/Benchmark_Driver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# This source file is part of the Swift.org open source project
77
#
8-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
8+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
99
# Licensed under Apache License v2.0 with Runtime Library Exception
1010
#
1111
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/Benchmark_GuardMalloc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# This source file is part of the Swift.org open source project
66
#
7-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
88
# Licensed under Apache License v2.0 with Runtime Library Exception
99
#
1010
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/Benchmark_RuntimeLeaksRunner.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# This source file is part of the Swift.org open source project
66
#
7-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
88
# Licensed under Apache License v2.0 with Runtime Library Exception
99
#
1010
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/compare_perf_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# This source file is part of the Swift.org open source project
77
#
8-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
8+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
99
# Licensed under Apache License v2.0 with Runtime Library Exception
1010
#
1111
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/generate_harness/CMakeLists.txt_template

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ if(NOT SWIFT_LIBRARY_PATH)
6767
set(SWIFT_LIBRARY_PATH "${tmp_dir}/lib/swift")
6868
endif()
6969

70-
runcmd(COMMAND "xcrun" "-f" "clang"
70+
runcmd(COMMAND "xcrun" "-toolchain" "${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" "-f" "clang"
7171
VARIABLE CLANG_EXEC
7272
ERROR "Unable to find Clang driver")
7373

@@ -84,6 +84,11 @@ if(NOT SWIFT_OPTIMIZATION_LEVELS)
8484
${SWIFT_EXTRA_BENCH_CONFIGS})
8585
endif()
8686

87+
set(SWIFT_BENCHMARK_NUM_O_ITERATIONS "" CACHE STRING
88+
"Number of iterations to perform when running -O benchmarks via cmake")
89+
set(SWIFT_BENCHMARK_NUM_ONONE_ITERATIONS "" CACHE STRING
90+
"Number of iterations to perform when running -Onone benchmarks via cmake")
91+
8792
# Options for the default (= empty) configuration
8893
set(BENCHOPTS "-whole-module-optimization")
8994

benchmark/scripts/generate_harness/generate_harness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# This source file is part of the Swift.org open source project
66
#
7-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
88
# Licensed under Apache License v2.0 with Runtime Library Exception
99
#
1010
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/generate_harness/main.swift_template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/scripts/perf_test_driver/perf_test_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# This source file is part of the Swift.org open source project
66
#
7-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
88
# Licensed under Apache License v2.0 with Runtime Library Exception
99
#
1010
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/perf_test_driver/swift_stats.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* This source file is part of the Swift.org open source project
44
*
5-
* Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
* Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
* Licensed under Apache License v2.0 with Runtime Library Exception
77
*
88
* See https://swift.org/LICENSE.txt for license information

benchmark/single-source/Ackermann.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/AngryPhonebook.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/AnyHashableWithAClass.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/Array2D.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/ArrayAppend.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/ArrayInClass.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/ArrayLiteral.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/ArrayOfGenericPOD.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/ArrayOfGenericRef.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/ArrayOfPOD.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/ArrayOfRef.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/ArraySubscript.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/BitCount.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/ByteSwap.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/Calculator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/CaptureProp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/Chars.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/ClassArrayGetter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/DeadArray.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/DictTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/DictTest2.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/DictTest3.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/DictionaryBridge.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/single-source/DictionaryLiteral.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

0 commit comments

Comments
 (0)