Skip to content

Commit 28276e2

Browse files
committed
---
yaml --- r: 268799 b: refs/heads/marcrasi-const-evaluator-part-2 c: 92377cc h: refs/heads/master i: 268797: b5b987b 268795: f65e1f4 268791: 3940502 268783: 4f00789 268767: 49e8527 268735: e7f256a 268671: db39cdb 268543: 37015ae 268287: f50744e
1 parent dd97450 commit 28276e2

File tree

792 files changed

+8028
-9354
lines changed

Some content is hidden

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

792 files changed

+8028
-9354
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-09-28-a: c30bf9b3ca148b1b90ebcd80141d9
10811081
refs/heads/bananaphone: 2af9a1dc7f40dcb4b2949876f7e237763d1a7972
10821082
refs/heads/marcrasi-const-evaluator-part-3: 867d96d6aa4cfb5079b7478be617387a1f621c88
10831083
refs/heads/marcrasi-const-evaluator-part-1: 390daeaeea2181a1fc24910e09b5861053cd3558
1084-
refs/heads/marcrasi-const-evaluator-part-2: ab4436a1f438194580c5a6ea458e81cb1e15c2ed
1084+
refs/heads/marcrasi-const-evaluator-part-2: 92377cc1459a0cea230f8ce87da6abc8759c9e65
10851085
refs/heads/revert-19689-keep-sourcekitd-response-alive-while-variant-lives: b5b1d9ab2340a64a3c7332529cdca1cb2318d93c
10861086
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-10-01-a: 63059bdab8bbcdd68591738fa28c68c8c19bde75
10871087
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-10-02-a: 12514879eff2c34a64ac6e65b323447f6525cfd0

branches/marcrasi-const-evaluator-part-2/CMakeLists.txt

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,23 +399,37 @@ endif()
399399

400400
precondition(CMAKE_SYSTEM_NAME)
401401
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
402+
set(SWIFT_BUILD_SYNTAXPARSERLIB_default TRUE)
402403
set(SWIFT_BUILD_SOURCEKIT_default TRUE)
403404
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
404405
if(EXISTS ${SWIFT_PATH_TO_LIBDISPATCH_SOURCE})
406+
set(SWIFT_BUILD_SYNTAXPARSERLIB_default TRUE)
405407
set(SWIFT_BUILD_SOURCEKIT_default TRUE)
406408
else()
409+
set(SWIFT_BUILD_SYNTAXPARSERLIB_default FALSE)
407410
set(SWIFT_BUILD_SOURCEKIT_default FALSE)
408411
endif()
409412
else()
413+
set(SWIFT_BUILD_SYNTAXPARSERLIB_default FALSE)
410414
set(SWIFT_BUILD_SOURCEKIT_default FALSE)
411415
endif()
416+
option(SWIFT_BUILD_SYNTAXPARSERLIB
417+
"Build the Swift Syntax Parser library"
418+
${SWIFT_BUILD_SYNTAXPARSERLIB_default})
412419
option(SWIFT_BUILD_SOURCEKIT
413420
"Build SourceKit"
414421
${SWIFT_BUILD_SOURCEKIT_default})
415422
option(SWIFT_ENABLE_SOURCEKIT_TESTS
416423
"Enable running SourceKit tests"
417424
${SWIFT_BUILD_SOURCEKIT_default})
418425

426+
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND
427+
(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT))
428+
set(SWIFT_NEED_EXPLICIT_LIBDISPATCH TRUE)
429+
else()
430+
set(SWIFT_NEED_EXPLICIT_LIBDISPATCH FALSE)
431+
endif()
432+
419433
#
420434
# Assume a new enough ar to generate the index at construction time. This avoids
421435
# having to invoke ranlib as a secondary command.
@@ -880,6 +894,96 @@ if (LLVM_ENABLE_DOXYGEN)
880894
message(STATUS "Doxygen: enabled")
881895
endif()
882896

897+
if(SWIFT_NEED_EXPLICIT_LIBDISPATCH)
898+
if(CMAKE_C_COMPILER_ID STREQUAL Clang AND
899+
CMAKE_C_COMPILER_VERSION VERSION_GREATER 3.8
900+
OR LLVM_USE_SANITIZER)
901+
set(SWIFT_LIBDISPATCH_C_COMPILER ${CMAKE_C_COMPILER})
902+
set(SWIFT_LIBDISPATCH_CXX_COMPILER ${CMAKE_CXX_COMPILER})
903+
elseif(${CMAKE_SYSTEM_NAME} STREQUAL ${CMAKE_HOST_SYSTEM_NAME})
904+
set(SWIFT_LIBDISPATCH_C_COMPILER ${PATH_TO_CLANG_BUILD}/bin/clang)
905+
set(SWIFT_LIBDISPATCH_CXX_COMPILER ${PATH_TO_CLANG_BUILD}/bin/clang++)
906+
else()
907+
message(SEND_ERROR "libdispatch requires a newer clang compiler (${CMAKE_C_COMPILER_VERSION} < 3.9)")
908+
endif()
909+
910+
include(ExternalProject)
911+
ExternalProject_Add(libdispatch
912+
SOURCE_DIR
913+
"${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}"
914+
CMAKE_ARGS
915+
-DCMAKE_AR=${CMAKE_AR}
916+
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
917+
-DCMAKE_C_COMPILER=${SWIFT_LIBDISPATCH_C_COMPILER}
918+
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
919+
-DCMAKE_CXX_COMPILER=${SWIFT_LIBDISPATCH_CXX_COMPILER}
920+
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
921+
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
922+
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
923+
-DCMAKE_LINKER=${CMAKE_LINKER}
924+
-DCMAKE_RANLIB=${CMAKE_RANLIB}
925+
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
926+
-DENABLE_SWIFT=NO
927+
-DENABLE_TESTING=NO
928+
INSTALL_COMMAND
929+
# NOTE(compnerd) provide a custom install command to
930+
# ensure that we strip out the DESTDIR environment
931+
# from the sub-build
932+
${CMAKE_COMMAND} -E env --unset=DESTDIR ${CMAKE_COMMAND} --build . --target install
933+
STEP_TARGETS
934+
install
935+
BUILD_BYPRODUCTS
936+
<INSTALL_DIR>/lib/${CMAKE_SHARED_LIBRARY_PREFIX}dispatch${CMAKE_SHARED_LIBRARY_SUFFIX}
937+
<INSTALL_DIR>/lib/${CMAKE_IMPORT_LIBRARY_PREFIX}dispatch${CMAKE_IMPORT_LIBRARY_SUFFIX}
938+
<INSTALL_DIR>/lib/${CMAKE_SHARED_LIBRARY_PREFIX}BlocksRuntime${CMAKE_SHARED_LIBRARY_SUFFIX}
939+
<INSTALL_DIR>/lib/${CMAKE_IMPORT_LIBRARY_PREFIX}BlocksRuntime${CMAKE_IMPORT_LIBRARY_SUFFIX}
940+
BUILD_ALWAYS
941+
1)
942+
943+
ExternalProject_Get_Property(libdispatch install_dir)
944+
945+
# CMake does not like the addition of INTERFACE_INCLUDE_DIRECTORIES without
946+
# the directory existing. Just create the location which will be populated
947+
# during the installation.
948+
file(MAKE_DIRECTORY ${install_dir}/include)
949+
950+
add_library(dispatch SHARED IMPORTED)
951+
set_target_properties(dispatch
952+
PROPERTIES
953+
IMPORTED_LOCATION
954+
${install_dir}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}dispatch${CMAKE_SHARED_LIBRARY_SUFFIX}
955+
IMPORTED_IMPLIB
956+
${install_dir}/lib/${CMAKE_IMPORT_LIBRARY_PREFIX}dispatch${CMAKE_IMPORT_LIBRARY_SUFFIX}
957+
INTERFACE_INCLUDE_DIRECTORIES
958+
${install_dir}/include)
959+
960+
add_library(BlocksRuntime SHARED IMPORTED)
961+
set_target_properties(BlocksRuntime
962+
PROPERTIES
963+
IMPORTED_LOCATION
964+
${install_dir}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}BlocksRuntime${CMAKE_SHARED_LIBRARY_SUFFIX}
965+
IMPORTED_IMPLIB
966+
${install_dir}/lib/${CMAKE_IMPORT_LIBRARY_PREFIX}BlocksRuntime${CMAKE_IMPORT_LIBRARY_SUFFIX}
967+
INTERFACE_INCLUDE_DIRECTORIES
968+
${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}/src/BlocksRuntime)
969+
970+
add_dependencies(dispatch libdispatch-install)
971+
add_dependencies(BlocksRuntime libdispatch-install)
972+
973+
swift_install_in_component(sourcekit-inproc
974+
FILES
975+
$<TARGET_FILE:dispatch>
976+
$<TARGET_FILE:BlocksRuntime>
977+
DESTINATION
978+
lib${LLVM_LIBDIR_SUFFIX})
979+
980+
# FIXME(compnerd) this should be taken care of by the
981+
# INTERFACE_INCLUDE_DIRECTORIES above
982+
include_directories(AFTER
983+
${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}/src/BlocksRuntime
984+
${SWIFT_PATH_TO_LIBDISPATCH_SOURCE})
985+
endif()
986+
883987
#
884988
# Set up global CMake variables for API notes.
885989
#

branches/marcrasi-const-evaluator-part-2/benchmark/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ set(SWIFT_BENCH_MODULES
5656
single-source/CharacterProperties
5757
single-source/Chars
5858
single-source/ClassArrayGetter
59-
single-source/Codable
6059
single-source/Combos
6160
single-source/CountAlgo
6261
single-source/DataBenchmarks
@@ -95,6 +94,7 @@ set(SWIFT_BENCH_MODULES
9594
single-source/InsertCharacter
9695
single-source/Integrate
9796
single-source/IterateData
97+
single-source/JSON
9898
single-source/Join
9999
single-source/LazyFilter
100100
single-source/LinkedList
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
# ===--- bench_code_size -------------------------------------------------===//
5+
#
6+
# This source file is part of the Swift.org open source project
7+
#
8+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
9+
# Licensed under Apache License v2.0 with Runtime Library Exception
10+
#
11+
# See https://swift.org/LICENSE.txt for license information
12+
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
13+
#
14+
# ===---------------------------------------------------------------------===//
15+
#
16+
# Reports code size differences of two benchmark build directories
17+
#
18+
# ===---------------------------------------------------------------------===//
19+
20+
from __future__ import print_function
21+
22+
import argparse
23+
import glob
24+
import os
25+
import subprocess
26+
import sys
27+
28+
29+
def main():
30+
argparser = argparse.ArgumentParser()
31+
argparser.add_argument(
32+
'-O', action='append_const', const='O', dest='opt_levels',
33+
help='report code size of -O benchmarks')
34+
argparser.add_argument(
35+
'-Osize', action='append_const', const='Osize', dest='opt_levels',
36+
help='report code size of -Osize benchmarks')
37+
argparser.add_argument(
38+
'-Onone', action='append_const', const='Onone', dest='opt_levels',
39+
help='report code size of -Onone benchmarks')
40+
argparser.add_argument(
41+
'-swiftlibs', action='append_const', const='swiftlibs',
42+
dest='opt_levels',
43+
help='report code size of swift dylibs')
44+
argparser.add_argument(
45+
'oldbuilddir', nargs=1, type=str,
46+
help='old benchmark build directory')
47+
argparser.add_argument(
48+
'newbuilddir', nargs=1, type=str,
49+
help='new benchmark build directory')
50+
argparser.add_argument(
51+
'-platform', type=str,
52+
help='The benchmark build platform', default='macosx')
53+
args = argparser.parse_args()
54+
55+
for opt_level in args.opt_levels or ['O', 'Osize', 'Onone']:
56+
report_code_size(opt_level, args.oldbuilddir[0], args.newbuilddir[0],
57+
args.platform)
58+
59+
return 0
60+
61+
62+
def report_code_size(opt_level, old_dir, new_dir, platform):
63+
def log_filename(bench_dir):
64+
return os.path.join(bench_dir, 'result_' + opt_level + '_size')
65+
66+
old_logf = open(log_filename(old_dir), 'w')
67+
new_logf = open(log_filename(new_dir), 'w')
68+
69+
if opt_level == 'swiftlibs':
70+
files = glob.glob(os.path.join(old_dir, 'lib', 'swift', platform,
71+
'*.dylib'))
72+
else:
73+
files = glob.glob(os.path.join(old_dir,
74+
opt_level + '-*' + platform + '*',
75+
'*.o'))
76+
77+
idx = 1
78+
for oldfile in files:
79+
newfile = oldfile.replace(old_dir, new_dir, 1)
80+
if os.path.isfile(newfile):
81+
oldsize = get_codesize(oldfile)
82+
newsize = get_codesize(newfile)
83+
bname = os.path.basename(oldfile)
84+
85+
def write_line(value, logf):
86+
v = ',' + str(value)
87+
logf.write(str(idx) + ',' + bname + ',1' + (v * 3) +
88+
',0' + v + '\n')
89+
90+
write_line(oldsize, old_logf)
91+
write_line(newsize, new_logf)
92+
idx += 1
93+
94+
old_logf.close()
95+
new_logf.close()
96+
97+
print('Logfiles written to ' + log_filename(old_dir) + ' and ' +
98+
log_filename(new_dir))
99+
100+
101+
def get_codesize(filename):
102+
output = subprocess.check_output(['size', filename]).splitlines()
103+
header_line = output[0]
104+
data_line = output[1]
105+
if header_line.find('__TEXT') != 0:
106+
sys.exit('unexpected output from size command:\n' + output)
107+
return int(data_line.split('\t')[0])
108+
109+
110+
if __name__ == '__main__':
111+
sys.exit(main())

0 commit comments

Comments
 (0)