Skip to content

Commit 9274bd1

Browse files
authored
Merge pull request #9 from apple/master
merge
2 parents 16addd9 + 5b60ace commit 9274bd1

File tree

816 files changed

+16692
-10085
lines changed

Some content is hidden

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

816 files changed

+16692
-10085
lines changed

CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,6 @@ option(SWIFT_RUNTIME_ENABLE_LEAK_CHECKER
295295
"Should the runtime be built with support for non-thread-safe leak detecting entrypoints"
296296
FALSE)
297297

298-
option(SWIFT_STDLIB_ENABLE_RESILIENCE
299-
"Build the standard libraries and overlays with resilience enabled; see docs/LibraryEvolution.rst"
300-
FALSE)
301-
302298
option(SWIFT_STDLIB_USE_NONATOMIC_RC
303299
"Build the standard libraries and overlays with nonatomic reference count operations enabled"
304300
FALSE)
@@ -828,7 +824,7 @@ message(STATUS " LTO: ${SWIFT_TOOLS_ENABLE_LTO}")
828824
message(STATUS " +0 Normal Args: ${SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS}")
829825
message(STATUS "")
830826

831-
if (SWIFT_BULID_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
827+
if (SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
832828

833829
message(STATUS "Building Swift standard library and overlays for SDKs: ${SWIFT_SDKS}")
834830
message(STATUS " Build type: ${SWIFT_STDLIB_BUILD_TYPE}")

benchmark/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ set(SWIFT_BENCH_MODULES
5555
single-source/Chars
5656
single-source/ClassArrayGetter
5757
single-source/Combos
58+
single-source/DataBenchmarks
5859
single-source/DeadArray
5960
single-source/DictOfArraysToArrayOfDicts
6061
single-source/DictTest
6162
single-source/DictTest2
6263
single-source/DictTest3
6364
single-source/DictTest4
6465
single-source/DictionaryBridge
66+
single-source/DictionaryCopy
6567
single-source/DictionaryGroup
6668
single-source/DictionaryLiteral
6769
single-source/DictionaryRemove
@@ -75,6 +77,7 @@ set(SWIFT_BENCH_MODULES
7577
single-source/Exclusivity
7678
single-source/ExistentialPerformance
7779
single-source/Fibonacci
80+
single-source/FloatingPointPrinting
7881
single-source/Hanoi
7982
single-source/Hash
8083
single-source/HashQuadratic
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#!/usr/bin/env python
2+
3+
# ===--- Benchmark_QuickCheck.in -----------------------------------------===//
4+
#
5+
# This source file is part of the Swift.org open source project
6+
#
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
8+
# Licensed under Apache License v2.0 with Runtime Library Exception
9+
#
10+
# See https://swift.org/LICENSE.txt for license information
11+
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
12+
#
13+
# ===---------------------------------------------------------------------===//
14+
15+
import json
16+
import os
17+
import subprocess
18+
import sys
19+
20+
sys.path.append("@PATH_TO_DRIVER_LIBRARY@")
21+
22+
import perf_test_driver # noqa (E402 module level import not at top of file)
23+
24+
# This is a hacked up XFAIL list. It should really be a json file, but it will
25+
# work for now. Add in the exact name of the pass to XFAIL.
26+
XFAIL_LIST = [
27+
]
28+
29+
30+
class QuickCheckResult(perf_test_driver.Result):
31+
32+
def __init__(self, name, success):
33+
assert(isinstance(success, bool))
34+
did_fail = not success
35+
perf_test_driver.Result.__init__(self, name, did_fail, "", XFAIL_LIST)
36+
37+
def print_data(self, max_test_len):
38+
fmt = '{:<%d}{:<10}' % (max_test_len + 5)
39+
print(fmt.format(self.get_name(), self.get_result()))
40+
41+
42+
class QuickCheckBenchmarkDriver(perf_test_driver.BenchmarkDriver):
43+
44+
def __init__(self, binary, xfail_list, num_iters):
45+
perf_test_driver.BenchmarkDriver.__init__(
46+
self, binary, xfail_list,
47+
enable_parallel=True)
48+
self.num_iters = num_iters
49+
50+
def print_data_header(self, max_test_len):
51+
fmt = '{:<%d}{:<10}{:}' % (max_test_len + 5)
52+
print(fmt.format('Name', 'Result', 'RC Delta'))
53+
54+
# Propagate any data from this class that is needed for individual
55+
# tests. The reason this is needed is to avoid issues with attempting to
56+
# access a value in a different process.
57+
def prepare_input(self, name):
58+
return {'num_samples': 1, 'num_iters': self.num_iters}
59+
60+
def run_test_inner(self, data, num_iters):
61+
p = subprocess.Popen([
62+
data['path'],
63+
"--num-samples={}".format(data['num_samples']),
64+
"--num-iters={}".format(num_iters), data['test_name']],
65+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
66+
error_out = p.communicate()[1].split("\n")
67+
result = p.returncode
68+
if result is None:
69+
raise RuntimeError("Expected one line of output")
70+
if result != 0:
71+
raise RuntimeError("Process segfaulted")
72+
return error_out
73+
74+
def run_test(self, data, num_iters):
75+
try:
76+
args = [data, num_iters]
77+
result = perf_test_driver.run_with_timeout(self.run_test_inner,
78+
args)
79+
except Exception, e:
80+
sys.stderr.write("Child Process Failed! (%s,%s). Error: %s\n" % (
81+
data['path'], data['test_name'], e))
82+
sys.stderr.flush()
83+
return None
84+
return True
85+
86+
def process_input(self, data):
87+
test_name = '({},{})'.format(data['opt'], data['test_name'])
88+
print("Running {}...".format(test_name))
89+
sys.stdout.flush()
90+
if self.run_test(data, data['num_iters']) is None:
91+
return QuickCheckResult(test_name, success=False)
92+
return QuickCheckResult(test_name, success=True)
93+
94+
95+
SWIFT_BIN_DIR = os.path.dirname(os.path.abspath(__file__))
96+
97+
98+
def parse_args():
99+
import argparse
100+
parser = argparse.ArgumentParser()
101+
parser.add_argument(
102+
'-filter', type=str, default=None,
103+
help='Filter out any test that does not match the given regex')
104+
parser.add_argument('-num-iters', type=int, default=2)
105+
return parser.parse_args()
106+
107+
108+
if __name__ == "__main__":
109+
args = parse_args()
110+
l = QuickCheckBenchmarkDriver(SWIFT_BIN_DIR, XFAIL_LIST, args.num_iters)
111+
if l.run(args.filter):
112+
sys.exit(0)
113+
else:
114+
sys.exit(-1)

benchmark/scripts/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ configure_file(
88
${CMAKE_CURRENT_SOURCE_DIR}/Benchmark_RuntimeLeaksRunner.in
99
${CMAKE_CURRENT_BINARY_DIR}/Benchmark_RuntimeLeaksRunner
1010
@ONLY)
11+
configure_file(
12+
${CMAKE_CURRENT_SOURCE_DIR}/Benchmark_QuickCheck.in
13+
${CMAKE_CURRENT_BINARY_DIR}/Benchmark_QuickCheck
14+
@ONLY)
1115
configure_file(
1216
${CMAKE_CURRENT_SOURCE_DIR}/Benchmark_DTrace.in
1317
${CMAKE_CURRENT_BINARY_DIR}/Benchmark_DTrace
@@ -24,6 +28,11 @@ file(COPY ${CMAKE_CURRENT_BINARY_DIR}/Benchmark_RuntimeLeaksRunner
2428
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
2529
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
2630

31+
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/Benchmark_QuickCheck
32+
DESTINATION "${swift-bin-dir}"
33+
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
34+
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
35+
2736
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/Benchmark_DTrace
2837
DESTINATION "${swift-bin-dir}"
2938
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ

0 commit comments

Comments
 (0)