Skip to content

Commit 38726d0

Browse files
author
Max Moiseev
committed
Merge branch 'swift-3-api-guidelines' into swift-3-indexing-model
2 parents b58cfcd + 859db53 commit 38726d0

File tree

857 files changed

+17053
-9146
lines changed

Some content is hidden

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

857 files changed

+17053
-9146
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!-- Please complete this template before creating pull request. -->
2+
#### What's in this pull request?
3+
<!-- Description about pull request. -->
4+
5+
#### Resolved bug number: ([SR-](https://bugs.swift.org/browse/SR-))
6+
<!-- If this pull request resolves any bugs from Swift bug tracker -->
7+
8+
* * * *
9+
10+
<!-- This selection should only be completed by Swift admin -->
11+
Before merging this pull request to apple/swift repository:
12+
- [ ] Test pull request on Swift continuous integration.
13+
14+
<details>
15+
<summary>Triggering Swift CI</summary>
16+
17+
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
18+
19+
**Smoke Testing**
20+
21+
Platform | Comment
22+
------------ | -------------
23+
All supported platforms | @swift-ci Please smoke test
24+
OS X platform | @swift-ci Please smoke test OS X platform
25+
Linux platform | @swift-ci Please smoke test Linux platform
26+
27+
**Validation Testing**
28+
29+
Platform | Comment
30+
------------ | -------------
31+
All supported platforms | @swift-ci Please test
32+
OS X platform | @swift-ci Please test OS X platform
33+
Linux platform | @swift-ci Please test Linux platform
34+
35+
Note: Only members of the Apple organization can trigger swift-ci.
36+
</details>
37+
<!-- Thank you for your contribution to Swift! -->

CMakeLists.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ option(SWIFT_RUNTIME_CRASH_REPORTER_CLIENT
140140
set(SWIFT_DARWIN_XCRUN_TOOLCHAIN "XcodeDefault" CACHE STRING
141141
"The name of the toolchain to pass to 'xcrun'")
142142

143-
set(SWIFT_DARWIN_ICU_INCLUDE_PATH "" CACHE STRING
144-
"Path to the directory where the ICU headers are located")
145-
146143
set(SWIFT_DARWIN_STDLIB_INSTALL_NAME_DIR "@rpath" CACHE STRING
147144
"The directory of the install_name for standard library dylibs")
148145

@@ -247,7 +244,6 @@ include(CheckCXXSourceRuns)
247244
include(CMakeParseArguments)
248245
include(SwiftTranslateFlag)
249246
include(SwiftHandleGybSources)
250-
include(SwiftHandleDTraceSources)
251247
include(SwiftSetIfArchBitness)
252248
include(AddSwift)
253249
include(SwiftConfigureSDK)
@@ -308,7 +304,6 @@ set(SWIFT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
308304

309305
set(SWIFT_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin")
310306
set(SWIFT_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib")
311-
set(SWIFT_INCLUDE_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/include")
312307
if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "")
313308
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "${SWIFT_RUNTIME_OUTPUT_INTDIR}")
314309
endif()
@@ -455,6 +450,19 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
455450

456451
set(SWIFT_PRIMARY_VARIANT_SDK_default "FREEBSD")
457452
set(SWIFT_PRIMARY_VARIANT_ARCH_default "x86_64")
453+
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
454+
configure_sdk_unix(CYGWIN "Cygwin" "windows" "cygwin" "x86_64" "x86_64-unknown-windows-cygnus")
455+
456+
# set(CMAKE_EXECUTABLE_FORMAT "ELF")
457+
458+
set(SWIFT_HOST_VARIANT "windows" CACHE STRING
459+
"Deployment OS for Swift host tools (the compiler) [windows].")
460+
461+
set(SWIFT_HOST_VARIANT_SDK "CYGWIN")
462+
set(SWIFT_HOST_VARIANT_ARCH "x86_64")
463+
464+
set(SWIFT_PRIMARY_VARIANT_SDK_default "CYGWIN")
465+
set(SWIFT_PRIMARY_VARIANT_ARCH_default "x86_64")
458466
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
459467
# Set defaults.
460468

@@ -626,7 +634,6 @@ message(STATUS " Assertions: ${SWIFT_STDLIB_ASSERTIONS}")
626634
message(STATUS "")
627635

628636
message(STATUS "Building Swift runtime with:")
629-
message(STATUS " Dtrace: ${SWIFT_RUNTIME_ENABLE_DTRACE}")
630637
message(STATUS " Leak Detection Checker Entrypoints: ${SWIFT_RUNTIME_ENABLE_LEAK_CHECKER}")
631638
message(STATUS "")
632639

CODE_OWNERS.TXT

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ N: Argyrios Kyrzidis
2828
2929
D: IDE, SourceKit, swift-ide-test
3030

31+
N: Luke Larson
32+
33+
D: Swift Benchmark Suite
34+
3135
N: Chris Lattner
3236
3337
D: Everything in Swift not covered by someone else

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ modules, eliminating the need for headers and the code duplication they entail.
2424

2525
To read the documentation, start by installing the
2626
[Sphinx](http://sphinx-doc.org) documentation generator tool (just run
27-
`easy_install -U Sphinx` from the command line and you're good to go). Once you
27+
`easy_install -U Sphinx==1.3.4` (more recent versions are currently not supported)
28+
from the command line and you're good to go). Once you
2829
have that, you can build the Swift documentation by going into `docs` and
2930
typing `make`. This compiles the `.rst` files in the `docs` directory into
3031
HTML in the `docs/_build/html` directory.

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function (swift_benchmark_compile_archopts)
107107
"-module-name" "${module_name}"
108108
"-emit-sib"
109109
"-o" "${sibfile}"
110-
"${srcdir}/${module_name_path}.swift" ${extra_sources})
110+
"${source}" ${extra_sources})
111111
endif()
112112
endforeach()
113113

@@ -116,6 +116,7 @@ function (swift_benchmark_compile_archopts)
116116

117117
set(objfile "${objdir}/${module_name}.o")
118118
set(swiftmodule "${objdir}/${module_name}.swiftmodule")
119+
set(source "${srcdir}/${module_name_path}.swift")
119120
list(APPEND bench_library_objects "${objfile}")
120121
add_custom_command(
121122
OUTPUT "${objfile}"
@@ -129,7 +130,7 @@ function (swift_benchmark_compile_archopts)
129130
"-module-name" "${module_name}"
130131
"-emit-module" "-emit-module-path" "${swiftmodule}"
131132
"-o" "${objfile}"
132-
"${srcdir}/${module_name_path}.swift" ${extra_sources})
133+
"${source}" ${extra_sources})
133134
if (SWIFT_BENCHMARK_EMIT_SIB)
134135
set(sibfile "${objdir}/${module_name}.sib")
135136
list(APPEND bench_library_sibfiles "${sibfile}")
@@ -145,7 +146,7 @@ function (swift_benchmark_compile_archopts)
145146
"-module-name" "${module_name}"
146147
"-emit-sib"
147148
"-o" "${sibfile}"
148-
"${srcdir}/${module_name_path}.swift" ${extra_sources})
149+
"${source}" ${extra_sources})
149150
endif()
150151
endforeach()
151152

@@ -157,6 +158,7 @@ function (swift_benchmark_compile_archopts)
157158
if(module_name)
158159
set(objfile "${objdir}/${module_name}.o")
159160
set(swiftmodule "${objdir}/${module_name}.swiftmodule")
161+
set(source "${srcdir}/${module_name_path}.swift")
160162
list(APPEND SWIFT_BENCH_OBJFILES "${objfile}")
161163
add_custom_command(
162164
OUTPUT "${objfile}"
@@ -171,7 +173,7 @@ function (swift_benchmark_compile_archopts)
171173
"-emit-module" "-emit-module-path" "${swiftmodule}"
172174
"-I" "${objdir}"
173175
"-o" "${objfile}"
174-
"${srcdir}/${module_name_path}.swift")
176+
"${source}")
175177
if (SWIFT_BENCHMARK_EMIT_SIB)
176178
set(sibfile "${objdir}/${module_name}.sib")
177179
list(APPEND SWIFT_BENCH_SIBFILES "${sibfile}")
@@ -188,7 +190,7 @@ function (swift_benchmark_compile_archopts)
188190
"-I" "${objdir}"
189191
"-emit-sib"
190192
"-o" "${sibfile}"
191-
"${srcdir}/${module_name_path}.swift")
193+
"${source}")
192194
endif()
193195
endif()
194196
endforeach()

benchmark/scripts/Benchmark_Driver

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def parse_results(res, optset):
6262
tests.append(mem_test)
6363
return tests
6464

65-
def submit_to_LNT(data, url):
65+
def submit_to_lnt(data, url):
6666
print "\nSubmitting results to LNT server..."
6767
json_report = {'input_data': json.dumps(data), 'commit': '1'}
6868
data = urllib.urlencode(json_report)
@@ -224,7 +224,7 @@ def submit(args):
224224
'Start Time': starttime}
225225
print "End time:\t", endtime
226226

227-
submit_to_LNT(data, args.lnt_host)
227+
submit_to_lnt(data, args.lnt_host)
228228
return 0
229229

230230
def run(args):

benchmark/scripts/compare_perf_tests.py

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,26 @@
2424
VERBOSE = 0
2525

2626
# #,TEST,SAMPLES,MIN(ms),MAX(ms),MEAN(ms),SD(ms),MEDIAN(ms)
27-
SCORERE = re.compile(r"(\d+),[ \t]*(\w+),[ \t]*([\d.]+),[ \t]*([\d.]+)")
28-
TOTALRE = re.compile(r"()(Totals),[ \t]*([\d.]+),[ \t]*([\d.]+)")
29-
KEYGROUP = 2
30-
VALGROUP = 4
27+
SCORERE = re.compile(r"(\d+),[ \t]*(\w+),[ \t]*([\d.]+),[ \t]*([\d.]+),[ \t]*([\d.]+)")
28+
TOTALRE = re.compile(r"()(Totals),[ \t]*([\d.]+),[ \t]*([\d.]+),[ \t]*([\d.]+)")
3129
NUMGROUP = 1
30+
KEYGROUP = 2
31+
BESTGROUP = 4
32+
WORSTGROUP = 5
3233

3334
IsTime = 1
3435
ShowSpeedup = 1
3536
PrintAllScores = 0
3637

37-
def parseInt(word):
38+
def parse_int(word):
3839
try:
3940
return int(word)
4041
except:
4142
raise Exception("Expected integer value, not " + word)
4243

43-
def getScores(fname):
44+
def get_scores(fname):
4445
scores = {}
46+
worstscores = {}
4547
nums = {}
4648
runs = 0
4749
f = open(fname)
@@ -58,11 +60,13 @@ def getScores(fname):
5860
continue
5961

6062
if VERBOSE:
61-
print " match", m.group(KEYGROUP), m.group(VALGROUP)
63+
print " match", m.group(KEYGROUP), m.group(BESTGROUP)
6264

6365
if not m.group(KEYGROUP) in scores:
6466
scores[m.group(KEYGROUP)] = []
65-
scores[m.group(KEYGROUP)].append(parseInt(m.group(VALGROUP)))
67+
worstscores[m.group(KEYGROUP)] = []
68+
scores[m.group(KEYGROUP)].append(parse_int(m.group(BESTGROUP)))
69+
worstscores[m.group(KEYGROUP)].append(parse_int(m.group(WORSTGROUP)))
6670
if is_total:
6771
nums[m.group(KEYGROUP)] = ""
6872
else:
@@ -71,12 +75,12 @@ def getScores(fname):
7175
runs = len(scores[m.group(KEYGROUP)])
7276
finally:
7377
f.close()
74-
return scores, runs, nums
78+
return scores, worstscores, runs, nums
7579

76-
def isMaxScore(newscore, maxscore, invert):
80+
def is_max_score(newscore, maxscore, invert):
7781
return not maxscore or (newscore > maxscore if not invert else newscore < maxscore)
7882

79-
def compareScores(key, score1, score2, runs, num):
83+
def compare_scores(key, score1, worstsample1, score2, worstsample2, runs, num):
8084
print num.rjust(3),
8185
print key.ljust(25),
8286
bestscore1 = None
@@ -87,20 +91,26 @@ def compareScores(key, score1, score2, runs, num):
8791
minworst = not minbest
8892
r = 0
8993
for score in score1:
90-
if isMaxScore(newscore=score, maxscore=bestscore1, invert=minbest):
94+
if is_max_score(newscore=score, maxscore=bestscore1, invert=minbest):
9195
bestscore1 = score
92-
if isMaxScore(newscore=score, maxscore=worstscore1, invert=minworst):
96+
if is_max_score(newscore=score, maxscore=worstscore1, invert=minworst):
9397
worstscore1 = score
9498
if PrintAllScores:
9599
print ("%d" % score).rjust(16),
100+
for score in worstsample1:
101+
if is_max_score(newscore=score, maxscore=worstscore1, invert=minworst):
102+
worstscore1 = score
96103
for score in score2:
97-
if isMaxScore(newscore=score, maxscore=bestscore2, invert=minbest):
104+
if is_max_score(newscore=score, maxscore=bestscore2, invert=minbest):
98105
bestscore2 = score
99-
if isMaxScore(newscore=score, maxscore=worstscore2, invert=minworst):
106+
if is_max_score(newscore=score, maxscore=worstscore2, invert=minworst):
100107
worstscore2 = score
101108
if PrintAllScores:
102109
print ("%d" % score).rjust(16),
103110
r += 1
111+
for score in worstsample2:
112+
if is_max_score(newscore=score, maxscore=worstscore2, invert=minworst):
113+
worstscore2 = score
104114
while r < runs:
105115
if PrintAllScores:
106116
print ("0").rjust(9),
@@ -123,21 +133,23 @@ def compareScores(key, score1, score2, runs, num):
123133
print "*".rjust(9),
124134
if ShowSpeedup:
125135
print "*".rjust(9),
126-
# if the interval endpoints have inverse relationship, then they overlap
136+
# check if the worst->best interval for each configuration overlap.
127137
if minbest:
128-
if bestscore1 < worstscore2:
129-
print "(!)",
138+
if (bestscore1 < bestscore2 and bestscore2 < worstscore1) \
139+
or (bestscore2 < bestscore1 and bestscore1 < worstscore2):
140+
print "(?)",
130141
else:
131-
if bestscore1 > worstscore2:
132-
print "(!)",
142+
if (worstscore1 < worstscore2 and worstscore2 < bestscore1) \
143+
or (worstscore2 < worstscore1 and worstscore1 < bestscore2):
144+
print "(?)",
133145
print
134146

135-
def printBestScores(key, scores):
147+
def print_best_scores(key, scores):
136148
print key,
137149
bestscore = None
138150
minbest = IsTime
139151
for score in scores:
140-
if isMaxScore(newscore=score, maxscore=bestscore, invert=minbest):
152+
if is_max_score(newscore=score, maxscore=bestscore, invert=minbest):
141153
bestscore = score
142154
print ", %d" % bestscore
143155

@@ -151,19 +163,19 @@ def usage():
151163
sys.exit(1)
152164
file1 = sys.argv[1]
153165
if len(sys.argv) < 3:
154-
scores, runs, nums = getScores(file1)
166+
scores, worstscores, runs, nums = get_scores(file1)
155167
keys = list(set(scores.keys()))
156168
keys.sort()
157169
for key in keys:
158-
printBestScores(key, scores[key])
170+
print_best_scores(key, scores[key])
159171
sys.exit(0)
160172

161173
file2 = sys.argv[2]
162174
if len(sys.argv) > 3:
163175
SCORERE = re.compile(sys.argv[3])
164176

165-
scores1, runs1, nums = getScores(file1)
166-
scores2, runs2, nums = getScores(file2)
177+
scores1, worstscores1, runs1, nums = get_scores(file1)
178+
scores2, worstscores2, runs2, nums = get_scores(file2)
167179

168180
runs = runs1
169181
if runs2 > runs:
@@ -201,4 +213,4 @@ def usage():
201213
if key not in scores2:
202214
print key, "not in", file2
203215
continue
204-
compareScores(key, scores1[key], scores2[key], runs, nums[key])
216+
compare_scores(key, scores1[key], worstscores1[key], scores2[key], worstscores2[key], runs, nums[key])

benchmark/single-source/Hash.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Hash {
5252
return x
5353
}
5454

55-
func digestFast(inout Res : [UInt8]) {
55+
func digestFast(Res: inout [UInt8]) {
5656
fillBlock()
5757
hash()
5858
// We use [UInt8] to avoid using String::append.
@@ -76,7 +76,7 @@ class Hash {
7676
func hashState() -> String {
7777
fatalError("Pure virtual")
7878
}
79-
func hashStateFast(inout Res : [UInt8]) {
79+
func hashStateFast(Res: inout [UInt8]) {
8080
fatalError("Pure virtual")
8181
}
8282

@@ -102,7 +102,7 @@ class Hash {
102102
}
103103

104104
final
105-
func toHexFast(In: UInt32, inout _ Res: Array<UInt8>, _ Index : Int) {
105+
func toHexFast(In: UInt32, _ Res: inout Array<UInt8>, _ Index : Int) {
106106
var In = In
107107
for i in 0..<4 {
108108
// Convert one byte each iteration.
@@ -178,7 +178,7 @@ class MD5 : Hash {
178178
dataLength = 0
179179
}
180180

181-
func appendBytes(Val: Int, inout _ Message: Array<UInt8>, _ Offset : Int) {
181+
func appendBytes(Val: Int, _ Message: inout Array<UInt8>, _ Offset : Int) {
182182
Message[Offset] = UInt8(truncatingBitPattern: Val)
183183
Message[Offset + 1] = UInt8(truncatingBitPattern: Val >> 8)
184184
Message[Offset + 2] = UInt8(truncatingBitPattern: Val >> 16)
@@ -290,7 +290,7 @@ class MD5 : Hash {
290290
}
291291

292292
override
293-
func hashStateFast(inout Res : [UInt8]) {
293+
func hashStateFast(Res: inout [UInt8]) {
294294
#if !NO_RANGE
295295
var Idx : Int = 0
296296
for h in [h0, h1, h2, h3] {

0 commit comments

Comments
 (0)