Skip to content

Commit 34d7a4b

Browse files
Andrew Bennetttherealbnut
authored andcommitted
Merge branch 'master' into therealbnut-droplast-suffix-benchmarks
2 parents c6dc0b0 + 5247d8c commit 34d7a4b

File tree

1,231 files changed

+57554
-17433
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,231 files changed

+57554
-17433
lines changed

.pep8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[flake8]
2-
filename = *.py,80+-check,backtrace-check,Benchmark_Driver,Benchmark_DTrace.in,Benchmark_GuardMalloc.in,Benchmark_RuntimeLeaksRunner.in,build-script,check-incremental,clang++,coverage-build-db,coverage-generate-data,coverage-query-db,coverage-touch-tests,gyb,ld,line-directive,mock-distcc,ns-html2rst,PathSanitizingFileCheck,recursive-lipo,rth,run-test,scale-test,submit-benchmark-results,update-checkout,viewcfg,symbolicate-linux-fatal
2+
filename = *.py,80+-check,backtrace-check,Benchmark_Driver,Benchmark_DTrace.in,Benchmark_GuardMalloc.in,Benchmark_RuntimeLeaksRunner.in,build-script,check-incremental,clang++,coverage-build-db,coverage-generate-data,coverage-query-db,coverage-touch-tests,gyb,ld,line-directive,mock-distcc,ns-html2rst,PathSanitizingFileCheck,python-lint,recursive-lipo,round-trip-syntax-test,rth,run-test,scale-test,submit-benchmark-results,update-checkout,viewcfg,symbolicate-linux-fatal

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
| Contents |
88
| :--------------------- |
9+
| [Swift 4.0](#swift-40) |
910
| [Swift 3.1](#swift-31) |
1011
| [Swift 3.0](#swift-30) |
1112
| [Swift 2.2](#swift-22) |
@@ -17,6 +18,28 @@ CHANGELOG
1718

1819
</details>
1920

21+
Swift 4.0
22+
---------
23+
24+
* [SE-0148][]:
25+
26+
Subscript declarations can now be defined to have generic parameter lists.
27+
Example:
28+
29+
```
30+
extension JSON {
31+
subscript<T>(key: String) -> T?
32+
where T : JSONConvertible {
33+
// ...
34+
}
35+
}
36+
```
37+
38+
* [SE-0110][]:
39+
40+
In Swift 4 mode, Swift's type system properly distinguishes between functions that
41+
take one tuple argument, and functions that take multiple arguments.
42+
2043
* More types of C macros which define integer constants are supported by the
2144
importer. Specifically the `+, -, *, /, ^, >>, ==, <, <=, >, >=` operators
2245
are now recognized, and the previously-supported `<<, &&, ||, &, |`
@@ -6408,3 +6431,11 @@ Swift 1.0
64086431
[SE-0145]: <https://github.com/apple/swift-evolution/blob/master/proposals/0145-package-manager-version-pinning.md>
64096432
[SE-0146]: <https://github.com/apple/swift-evolution/blob/master/proposals/0146-package-manager-product-definitions.md>
64106433
[SE-0147]: <https://github.com/apple/swift-evolution/blob/master/proposals/0147-move-unsafe-initialize-from.md>
6434+
[SE-0148]: <https://github.com/apple/swift-evolution/blob/master/proposals/0148-generic-subscripts.md>
6435+
[SE-0149]: <https://github.com/apple/swift-evolution/blob/master/proposals/0149-package-manager-top-of-tree.md>
6436+
[SE-0150]: <https://github.com/apple/swift-evolution/blob/master/proposals/0150-package-manager-branch-support.md>
6437+
[SE-0151]: <https://github.com/apple/swift-evolution/blob/master/proposals/0151-package-manager-swift-language-compatibility-version.md>
6438+
[SE-0152]: <https://github.com/apple/swift-evolution/blob/master/proposals/0152-package-manager-tools-version.md>
6439+
[SE-0153]: <https://github.com/apple/swift-evolution/blob/master/proposals/0153-compensate-for-the-inconsistency-of-nscopyings-behaviour.md>
6440+
[SE-0154]: <https://github.com/apple/swift-evolution/blob/master/proposals/0154-dictionary-key-and-value-collections.md>
6441+
[SE-0155]: <https://github.com/apple/swift-evolution/blob/master/proposals/0155-normalize-enum-case-representation.md>

CMakeLists.txt

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ option(SWIFT_STDLIB_ENABLE_RESILIENCE
270270
"Build the standard libraries and overlays with resilience enabled; see docs/LibraryEvolution.rst"
271271
FALSE)
272272

273+
option(SWIFT_STDLIB_USE_NONATOMIC_RC
274+
"Build the standard libraries and overlays with nonatomic reference count operations enabled"
275+
FALSE)
276+
273277
option(SWIFT_STDLIB_ENABLE_SIL_OWNERSHIP
274278
"Build the standard libraries and overlays with sil ownership enabled."
275279
FALSE)
@@ -358,9 +362,7 @@ if(SWIFT_BUILT_STANDALONE)
358362
project(Swift C CXX ASM)
359363
endif()
360364

361-
if("${CMAKE_SYSTEM_NAME}" STREQUAL "")
362-
message(FATAL_ERROR "CMAKE_SYSTEM_NAME is empty!")
363-
endif()
365+
precondition(CMAKE_SYSTEM_NAME)
364366
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
365367
set(SWIFT_BUILD_SOURCEKIT_default TRUE)
366368
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
@@ -411,12 +413,6 @@ include(SwiftList)
411413
# Configure swift include, install, build components.
412414
swift_configure_components()
413415

414-
if("${CMAKE_VERSION}" VERSION_LESS "3.0")
415-
set(SWIFT_CMAKE_HAS_GENERATOR_EXPRESSIONS FALSE)
416-
else()
417-
set(SWIFT_CMAKE_HAS_GENERATOR_EXPRESSIONS TRUE)
418-
endif()
419-
420416
# lipo is used to create universal binaries.
421417
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
422418
include(SwiftDarwin)
@@ -459,6 +455,9 @@ endif()
459455

460456
set(SWIFT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
461457
set(SWIFT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
458+
set(SWIFT_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
459+
set(SWIFT_MAIN_INCLUDE_DIR "${SWIFT_SOURCE_DIR}/include")
460+
set(SWIFT_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
462461

463462
set(SWIFT_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin")
464463
set(SWIFT_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib")
@@ -479,8 +478,8 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
479478

480479
# We'll need this once we have generated headers
481480
include_directories(BEFORE
482-
${CMAKE_CURRENT_BINARY_DIR}/include
483-
${CMAKE_CURRENT_SOURCE_DIR}/include
481+
${SWIFT_MAIN_INCLUDE_DIR}
482+
${SWIFT_INCLUDE_DIR}
484483
)
485484

486485
# A convenience pattern to match Darwin platforms. Example:
@@ -671,6 +670,10 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "CYGWIN")
671670
set(SWIFT_PRIMARY_VARIANT_ARCH_default "x86_64")
672671

673672
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "WINDOWS")
673+
674+
set(SWIFT_HOST_VARIANT "windows" CACHE STRING
675+
"Deployment OS for Swift host tools (the compiler) [windows].")
676+
674677
configure_sdk_windows(WINDOWS "Windows" "msvc" "${SWIFT_HOST_VARIANT_ARCH}")
675678
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
676679
set(SWIFT_PRIMARY_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")
@@ -828,21 +831,10 @@ endif()
828831

829832
list_subtract("${SWIFT_SDKS}" "${SWIFT_CONFIGURED_SDKS}" unknown_sdks)
830833

831-
if(NOT "${unknown_sdks}" STREQUAL "")
832-
message(FATAL_ERROR "Unknown SDKs: ${unknown_sdks}")
833-
endif()
834-
835-
if("${SWIFT_CONFIGURED_SDKS}" STREQUAL "")
836-
message(FATAL_ERROR "No SDKs selected.")
837-
endif()
838-
839-
if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "")
840-
message(FATAL_ERROR "No SDK for host tools.")
841-
endif()
842-
843-
if("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "")
844-
message(FATAL_ERROR "No arch for host tools.")
845-
endif()
834+
precondition(unknown_sdks NEGATE MESSAGE "Unknown SDKs: ${unknown_sdks}")
835+
precondition(SWIFT_CONFIGURED_SDKS MESSAGE "No SDKs selected.")
836+
precondition(SWIFT_HOST_VARIANT_SDK MESSAGE "No SDK for host tools.")
837+
precondition(SWIFT_HOST_VARIANT_ARCH MESSAGE "No arch for host tools")
846838

847839
set(SWIFT_PRIMARY_VARIANT_SUFFIX
848840
"-${SWIFT_SDK_${SWIFT_PRIMARY_VARIANT_SDK}_LIB_SUBDIR}-${SWIFT_PRIMARY_VARIANT_ARCH}")
@@ -853,8 +845,8 @@ foreach(sdk ${SWIFT_SDKS})
853845
endforeach()
854846

855847
if(SWIFT_PARALLEL_LINK_JOBS)
856-
if(CMAKE_VERSION VERSION_LESS 3.0 OR NOT CMAKE_MAKE_PROGRAM MATCHES "ninja")
857-
message(WARNING "Job pooling is only available with Ninja generators and CMake 3.0 and later.")
848+
if(NOT CMAKE_MAKE_PROGRAM MATCHES "ninja")
849+
message(WARNING "Job pooling is only available with Ninja generators.")
858850
else()
859851
set_property(GLOBAL APPEND PROPERTY JOB_POOLS swift_link_job_pool=${SWIFT_PARALLEL_LINK_JOBS})
860852
set(CMAKE_JOB_POOL_LINK swift_link_job_pool)
@@ -907,11 +899,7 @@ option(SWIFT_HAVE_LIBXML
907899
cmake_push_check_state()
908900
list(APPEND CMAKE_REQUIRED_LIBRARIES "edit")
909901
check_symbol_exists(el_wgets "histedit.h" HAVE_EL_WGETS)
910-
check_symbol_exists(wcslcat wchar.h HAVE_WCSLCAT)
911-
# FIXME: UNICODE_LIBEDIT shouldn't need BSD's wcslcat function,
912-
# rewrite the usages in terms of wcsncat to get the REPL
913-
# building on linux.
914-
if(HAVE_EL_WGETS AND HAVE_WCSLCAT)
902+
if(HAVE_EL_WGETS)
915903
set(HAVE_UNICODE_LIBEDIT 1)
916904
endif()
917905
cmake_pop_check_state()
@@ -954,6 +942,8 @@ if(SWIFT_INCLUDE_DOCS)
954942
add_subdirectory(docs)
955943
endif()
956944

945+
add_subdirectory(cmake/modules)
946+
957947
swift_install_in_component(license
958948
FILES "LICENSE.txt"
959949
DESTINATION "share/swift")

CODE_OWNERS.TXT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ D: Swift standard library
1313

1414
N: David Farler
1515
16-
D: Markup, Swift Linux port
16+
D: Markup, lib/Syntax, Swift Linux port
1717

1818
N: Doug Gregor
1919

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ discussed below.
5353
macOS, Ubuntu Linux LTS, and the latest Ubuntu Linux release are the current
5454
supported host development operating systems.
5555

56-
For macOS, you need [the latest Xcode](https://developer.apple.com/xcode/downloads/).
56+
For macOS, you need [Xcode 8.3 Beta 3](https://developer.apple.com/xcode/downloads/).
5757

5858
For Ubuntu, you'll need the following development dependencies:
5959

benchmark/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ set(SWIFT_BENCH_MODULES
4949
single-source/GlobalClass
5050
single-source/Hanoi
5151
single-source/Hash
52+
single-source/HashQuadratic
5253
single-source/Histogram
5354
single-source/Integrate
5455
single-source/IterateData

benchmark/scripts/compare_perf_tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#
1414
# ===---------------------------------------------------------------------===//
1515

16+
from __future__ import print_function
17+
1618
import argparse
1719
import csv
1820
import sys

benchmark/scripts/generate_harness/CMakeLists.txt_template

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,18 @@ if(NOT SWIFT_LIBRARY_PATH)
6767
set(SWIFT_LIBRARY_PATH "${tmp_dir}/lib/swift")
6868
endif()
6969

70-
runcmd(COMMAND "xcrun" "-toolchain" "${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" "-f" "clang"
71-
VARIABLE CLANG_EXEC
72-
ERROR "Unable to find Clang driver")
70+
# If the CMAKE_C_COMPILER is already clang, don't find it again,
71+
# thus allowing the --host-cc build-script argument to work here.
72+
get_filename_component(c_compiler ${CMAKE_C_COMPILER} NAME)
73+
74+
if(${c_compiler} STREQUAL "clang")
75+
set(CLANG_EXEC ${CMAKE_C_COMPILER})
76+
else()
77+
runcmd(COMMAND "xcrun" "-toolchain" "${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" "-f" "clang"
78+
VARIABLE CLANG_EXEC
79+
ERROR "Unable to find Clang driver")
80+
endif()
81+
7382

7483
# You have to delete CMakeCache.txt in the swift build to force a
7584
# reconfiguration.

benchmark/scripts/generate_harness/generate_harness.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
# Generate CMakeLists.txt and utils/main.swift from templates.
1616

17+
from __future__ import print_function
18+
1719
import glob
1820
import os
1921
import re

benchmark/scripts/perf_test_driver/perf_test_driver.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#
1313
# ===---------------------------------------------------------------------===//
1414

15+
from __future__ import print_function
16+
17+
import functools
1518
import multiprocessing
1619
import os
1720
import re
@@ -54,6 +57,7 @@ def print_data(self, max_test_len):
5457
def _unwrap_self(args):
5558
return type(args[0]).process_input(*args)
5659

60+
5761
BenchmarkDriver_OptLevels = ['Onone', 'O', 'Ounchecked']
5862

5963

@@ -106,7 +110,7 @@ def reduce_results(acc, r):
106110
acc['extra_data'] = r.merge_in_extra_data(acc['extra_data'])
107111
return acc
108112

109-
return reduce(reduce_results, results, {
113+
return functools.reduce(reduce_results, results, {
110114
'result': [],
111115
'has_failure': False,
112116
'max_test_len': 0,
@@ -124,7 +128,9 @@ def run(self, test_filter=None):
124128
self.data = [
125129
self.run_for_opt_level(binary, opt_level, test_filter)
126130
for binary, opt_level in self.targets]
127-
max_test_len = reduce(max, [d['max_test_len']for d in self.data])
128-
has_failure = reduce(max, [d['has_failure']for d in self.data])
131+
max_test_len = functools.reduce(max,
132+
[d['max_test_len'] for d in self.data])
133+
has_failure = functools.reduce(max,
134+
[d['has_failure'] for d in self.data])
129135
self.print_data(self.data, max_test_len)
130136
return not has_failure
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//===--- HashQuadratic.swift ----------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2017 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+
let size = 3_000_000
16+
17+
@inline(never)
18+
public func run_HashQuadratic(_ N: Int) {
19+
for _ in 1...N {
20+
var dict1: [Int: Int] = [:]
21+
for i in 0..<size {
22+
dict1[i] = i * 2
23+
}
24+
25+
var dict2: [Int: Int] = [:]
26+
for (k, v) in dict1 {
27+
dict2[k] = v
28+
}
29+
30+
CheckResults(dict1[size/2] == dict2[size/2],
31+
"Incorrect results in HashQuadratic")
32+
}
33+
}

benchmark/utils/convertToJSON.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
# ]
5858
# }
5959

60+
from __future__ import print_function
61+
6062
import json
6163
import re
6264
import sys

benchmark/utils/main.swift

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import Fibonacci
5454
import GlobalClass
5555
import Hanoi
5656
import Hash
57+
import HashQuadratic
5758
import Histogram
5859
import Integrate
5960
import IterateData
@@ -115,28 +116,28 @@ precommitTests = [
115116
"Array2D": run_Array2D,
116117
"ArrayAppend": run_ArrayAppend,
117118
"ArrayAppendArrayOfInt": run_ArrayAppendArrayOfInt,
119+
"ArrayAppendAscii": run_ArrayAppendAscii,
118120
"ArrayAppendFromGeneric": run_ArrayAppendFromGeneric,
119121
"ArrayAppendGenericStructs": run_ArrayAppendGenericStructs,
122+
"ArrayAppendLatin1": run_ArrayAppendLatin1,
120123
"ArrayAppendLazyMap": run_ArrayAppendLazyMap,
121124
"ArrayAppendOptionals": run_ArrayAppendOptionals,
122125
"ArrayAppendRepeatCol": run_ArrayAppendRepeatCol,
123126
"ArrayAppendReserved": run_ArrayAppendReserved,
124127
"ArrayAppendSequence": run_ArrayAppendSequence,
125128
"ArrayAppendStrings": run_ArrayAppendStrings,
126-
"ArrayAppendASCII": run_ArrayAppendAscii,
127-
"ArrayAppendLatin1": run_ArrayAppendLatin1,
128-
"ArrayAppendUTF16": run_ArrayAppendUTF16,
129129
"ArrayAppendToFromGeneric": run_ArrayAppendToFromGeneric,
130130
"ArrayAppendToGeneric": run_ArrayAppendToGeneric,
131-
"ArrayPlusEqualSingleElementCollection": run_ArrayPlusEqualSingleElementCollection,
132-
"ArrayPlusEqualFiveElementCollection": run_ArrayPlusEqualFiveElementCollection,
131+
"ArrayAppendUTF16": run_ArrayAppendUTF16,
133132
"ArrayInClass": run_ArrayInClass,
134133
"ArrayLiteral": run_ArrayLiteral,
135134
"ArrayOfGenericPOD": run_ArrayOfGenericPOD,
136135
"ArrayOfGenericRef": run_ArrayOfGenericRef,
137136
"ArrayOfPOD": run_ArrayOfPOD,
138137
"ArrayOfRef": run_ArrayOfRef,
139138
"ArrayPlusEqualArrayOfInt": run_ArrayPlusEqualArrayOfInt,
139+
"ArrayPlusEqualFiveElementCollection": run_ArrayPlusEqualFiveElementCollection,
140+
"ArrayPlusEqualSingleElementCollection": run_ArrayPlusEqualSingleElementCollection,
140141
"ArraySubscript": run_ArraySubscript,
141142
"ArrayValueProp": run_ArrayValueProp,
142143
"ArrayValueProp2": run_ArrayValueProp2,
@@ -170,6 +171,7 @@ precommitTests = [
170171
"ErrorHandling": run_ErrorHandling,
171172
"GlobalClass": run_GlobalClass,
172173
"Hanoi": run_Hanoi,
174+
"HashQuadratic": run_HashQuadratic,
173175
"HashTest": run_HashTest,
174176
"Histogram": run_Histogram,
175177
"Integrate": run_Integrate,
@@ -178,15 +180,16 @@ precommitTests = [
178180
"LinkedList": run_LinkedList,
179181
"MapReduce": run_MapReduce,
180182
"MapReduceAnyCollection": run_MapReduceAnyCollection,
181-
"MapReduceShort": run_MapReduceShort,
182-
"MapReduceSequence": run_MapReduceSequence,
183-
"MapReduceLazySequence": run_MapReduceLazySequence,
183+
"MapReduceAnyCollectionShort": run_MapReduceAnyCollectionShort,
184+
"MapReduceClass": run_MapReduceClass,
185+
"MapReduceClassShort": run_MapReduceClassShort,
184186
"MapReduceLazyCollection": run_MapReduceLazyCollection,
185187
"MapReduceLazyCollectionShort": run_MapReduceLazyCollectionShort,
186-
"MapReduceString": run_MapReduceString,
188+
"MapReduceLazySequence": run_MapReduceLazySequence,
189+
"MapReduceSequence": run_MapReduceSequence,
190+
"MapReduceShort": run_MapReduceShort,
187191
"MapReduceShortString": run_MapReduceShortString,
188-
"MapReduceClass": run_MapReduceClass,
189-
"MapReduceClassShort": run_MapReduceClassShort,
192+
"MapReduceString": run_MapReduceString,
190193
"Memset": run_Memset,
191194
"MonteCarloE": run_MonteCarloE,
192195
"MonteCarloPi": run_MonteCarloPi,

0 commit comments

Comments
 (0)