Skip to content

Commit 66efa12

Browse files
authored
Merge pull request #1289 from swiftwasm/maxd/master-merge
Resolve conflicts with master
2 parents b80daa1 + c90937b commit 66efa12

File tree

927 files changed

+8632
-51094
lines changed

Some content is hidden

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

927 files changed

+8632
-51094
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ jobs:
6363
path: ../build-cache
6464
key: ${{ runner.os }}-sccache-v7
6565
- name: Build macOS installable archive
66-
run: ./utils/webassembly/ci.sh
66+
run: |
67+
sudo xcode-select --switch /Applications/Xcode_12_beta.app/Contents/Developer/
68+
./utils/webassembly/ci.sh
6769
- name: Upload macOS installable archive
6870
uses: actions/upload-artifact@v1
6971
with:

CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -487,16 +487,6 @@ if(NOT SWIFT_LIPO)
487487
find_toolchain_tool(SWIFT_LIPO "${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" lipo)
488488
endif()
489489

490-
# Reset CMAKE_SYSTEM_PROCESSOR if not cross-compiling.
491-
# CMake refuses to use `uname -m` on OS X
492-
# http://public.kitware.com/Bug/view.php?id=10326
493-
if(NOT CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386")
494-
execute_process(
495-
COMMAND "uname" "-m"
496-
OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR
497-
OUTPUT_STRIP_TRAILING_WHITESPACE)
498-
endif()
499-
500490
get_filename_component(SWIFT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} REALPATH)
501491
set(SWIFT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
502492
set(SWIFT_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Please make sure you use Python 2.x. Python 3.x is not supported currently.
108108

109109
#### macOS
110110

111-
To build for macOS, you need [Xcode 11.4](https://developer.apple.com/xcode/resources/).
111+
To build for macOS, you need [Xcode 12 beta](https://developer.apple.com/xcode/resources/).
112112
The required version of Xcode changes frequently, and is often a beta release.
113113
Check this document or the host information on <https://ci.swift.org> for the
114114
current required version.

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,11 @@ function (swift_benchmark_compile_archopts)
660660
"-m${triple_platform}-version-min=${ver}"
661661
"-lobjc"
662662
"-L${SWIFT_LIBRARY_PATH}/${BENCH_COMPILE_ARCHOPTS_PLATFORM}"
663+
"-L${sdk}/usr/lib/swift"
663664
"-Xlinker" "-rpath"
664665
"-Xlinker" "${SWIFT_LINK_RPATH}"
666+
"-Xlinker" "-rpath"
667+
"-Xlinker" "/usr/lib/swift"
665668
${bench_library_objects}
666669
${bench_driver_objects}
667670
${ld64_add_ast_path_opts}
@@ -694,7 +697,7 @@ function(swift_benchmark_compile)
694697
cmake_parse_arguments(SWIFT_BENCHMARK_COMPILE "" "PLATFORM" "" ${ARGN})
695698

696699
if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE)
697-
set(stdlib_dependencies "swift")
700+
set(stdlib_dependencies "swift-frontend")
698701
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})
699702
string(FIND "${stdlib_dependency}" "Unittest" find_output)
700703
if("${find_output}" STREQUAL "-1")

benchmark/single-source/FloatingPointParsing.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public func run_ParseDoubleExp(_ N: Int) {
242242

243243
@inline(never)
244244
public func run_ParseFloat80Exp(_ N: Int) {
245-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(Linux)
245+
#if canImport(Darwin) || os(Linux)
246246
// On Darwin, long double is Float80 on x86, and Double otherwise.
247247
// On Linux, Float80 is at aleast available on x86.
248248
#if arch(x86_64) || arch(i386)
@@ -263,7 +263,7 @@ public func run_ParseDoubleUniform(_ N: Int) {
263263

264264
@inline(never)
265265
public func run_ParseFloat80Uniform(_ N: Int) {
266-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(Linux)
266+
#if canImport(Darwin) || os(Linux)
267267
// On Darwin, long double is Float80 on x86, and Double otherwise.
268268
// On Linux, Float80 is at aleast available on x86.
269269
#if arch(x86_64) || arch(i386)

benchmark/single-source/FloatingPointPrinting.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public func run_FloatingPointPrinting_Double_description_small(_ N: Int) {
106106

107107
@inline(never)
108108
public func run_FloatingPointPrinting_Float80_description_small(_ N: Int) {
109-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(Linux)
109+
#if canImport(Darwin) || os(Linux)
110110
// On Darwin, long double is Float80 on x86, and Double otherwise.
111111
// On Linux, Float80 is at aleast available on x86.
112112
#if arch(x86_64) || arch(i386)
@@ -152,7 +152,7 @@ public func run_FloatingPointPrinting_Double_description_uniform(_ N: Int) {
152152

153153
@inline(never)
154154
public func run_FloatingPointPrinting_Float80_description_uniform(_ N: Int) {
155-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(Linux)
155+
#if canImport(Darwin) || os(Linux)
156156
// On Darwin, long double is Float80 on x86, and Double otherwise.
157157
// On Linux, Float80 is at aleast available on x86.
158158
#if arch(x86_64) || arch(i386)
@@ -202,7 +202,7 @@ public func run_FloatingPointPrinting_Double_interpolated(_ N: Int) {
202202

203203
@inline(never)
204204
public func run_FloatingPointPrinting_Float80_interpolated(_ N: Int) {
205-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(Linux)
205+
#if canImport(Darwin) || os(Linux)
206206
// On Darwin, long double is Float80 on x86, and Double otherwise.
207207
// On Linux, Float80 is at aleast available on x86.
208208
#if arch(x86_64) || arch(i386)

benchmark/single-source/NSStringConversion.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
// <rdar://problem/19003201>
14-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
14+
#if canImport(Darwin)
1515

1616
import TestsUtils
1717
import Foundation

benchmark/single-source/Substring.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public let SubstringTest = [
1717
BenchmarkInfo(name: "EqualSubstringString", runFunction: run_EqualSubstringString, tags: [.validation, .api, .String]),
1818
BenchmarkInfo(name: "EqualSubstringSubstring", runFunction: run_EqualSubstringSubstring, tags: [.validation, .api, .String]),
1919
BenchmarkInfo(name: "EqualSubstringSubstringGenericEquatable", runFunction: run_EqualSubstringSubstringGenericEquatable, tags: [.validation, .api, .String]),
20+
BenchmarkInfo(name: "SubstringRemoveFirst1", runFunction: run_SubstringRemoveFirst1, tags: [.validation, .api, .String]),
21+
BenchmarkInfo(name: "SubstringRemoveLast1", runFunction: run_SubstringRemoveLast1, tags: [.validation, .api, .String]),
2022
BenchmarkInfo(name: "LessSubstringSubstring", runFunction: run_LessSubstringSubstring, tags: [.validation, .api, .String]),
2123
BenchmarkInfo(name: "LessSubstringSubstringGenericComparable", runFunction: run_LessSubstringSubstringGenericComparable, tags: [.validation, .api, .String]),
2224
BenchmarkInfo(name: "StringFromLongWholeSubstring", runFunction: run_StringFromLongWholeSubstring, tags: [.validation, .api, .String]),
@@ -34,6 +36,8 @@ let longWide = "fὢasὢodὢijὢadὢolὢsjὢalὢsdὢjlὢasὢdfὢijὢ
3436
let (s1, ss1) = equivalentWithDistinctBuffers()
3537
let (s2, ss2) = equivalentWithDistinctBuffers()
3638

39+
let quiteLong = String(repeating: "0", count: 10_000)[...]
40+
3741
@inline(never)
3842
public func run_SubstringFromLongString(_ N: Int) {
3943
var s = longWide
@@ -126,6 +130,24 @@ public func run_EqualSubstringSubstringGenericEquatable(_ N: Int) {
126130
}
127131
}
128132

133+
@inline(never)
134+
public func run_SubstringRemoveFirst1(_ N: Int) {
135+
for _ in 1...N {
136+
var s = quiteLong
137+
s.removeFirst(1)
138+
blackHole(s.first == "0")
139+
}
140+
}
141+
142+
@inline(never)
143+
public func run_SubstringRemoveLast1(_ N: Int) {
144+
for _ in 1...N {
145+
var s = quiteLong
146+
s.removeLast(1)
147+
blackHole(s.first == "0")
148+
}
149+
}
150+
129151
/*
130152
func checkEqual<T, U>(_ x: T, _ y: U)
131153
where T : StringProtocol, U : StringProtocol {

benchmark/utils/main.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ import NibbleSort
103103
import NIOChannelPipeline
104104
import NSDictionaryCastToSwift
105105
import NSError
106-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
106+
#if canImport(Darwin)
107107
import NSStringConversion
108108
#endif
109109
import NopDeinit
110110
import ObjectAllocation
111-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
111+
#if canImport(Darwin)
112112
import ObjectiveCBridging
113113
import ObjectiveCBridgingStubs
114114
#if !(SWIFT_PACKAGE || Xcode)
@@ -287,14 +287,14 @@ registerBenchmark(MonteCarloE)
287287
registerBenchmark(MonteCarloPi)
288288
registerBenchmark(NSDictionaryCastToSwift)
289289
registerBenchmark(NSErrorTest)
290-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
290+
#if canImport(Darwin)
291291
registerBenchmark(NSStringConversion)
292292
#endif
293293
registerBenchmark(NibbleSort)
294294
registerBenchmark(NIOChannelPipeline)
295295
registerBenchmark(NopDeinit)
296296
registerBenchmark(ObjectAllocation)
297-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
297+
#if canImport(Darwin)
298298
registerBenchmark(ObjectiveCBridging)
299299
registerBenchmark(ObjectiveCBridgingStubs)
300300
#if !(SWIFT_PACKAGE || Xcode)

cmake/modules/AddSwift.cmake

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function(_swift_gyb_target_sources target scope)
2323

2424
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${generated}
2525
COMMAND
26-
$<TARGET_FILE:Python2::Interpreter> ${SWIFT_SOURCE_DIR}/utils/gyb -D CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P} ${SWIFT_GYB_FLAGS} -o ${CMAKE_CURRENT_BINARY_DIR}/${generated}.tmp ${absolute}
26+
$<TARGET_FILE:Python3::Interpreter> ${SWIFT_SOURCE_DIR}/utils/gyb -D CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P} ${SWIFT_GYB_FLAGS} -o ${CMAKE_CURRENT_BINARY_DIR}/${generated}.tmp ${absolute}
2727
COMMAND
2828
${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${generated}.tmp ${CMAKE_CURRENT_BINARY_DIR}/${generated}
2929
COMMAND
@@ -88,6 +88,7 @@ function(_add_host_variant_c_compile_link_flags name)
8888
MACCATALYST_BUILD_FLAVOR ""
8989
DEPLOYMENT_VERSION "${DEPLOYMENT_VERSION}")
9090
target_compile_options(${name} PRIVATE -target;${target})
91+
target_link_options(${name} PRIVATE -target;${target})
9192
endif()
9293

9394
set(_sysroot
@@ -472,6 +473,7 @@ function(add_swift_host_library name)
472473

473474
_add_host_variant_c_compile_flags(${name})
474475
_add_host_variant_link_flags(${name})
476+
_add_host_variant_c_compile_link_flags(${name})
475477
_set_target_prefix_and_suffix(${name} "${libkind}" "${SWIFT_HOST_VARIANT_SDK}")
476478

477479
# Set compilation and link flags.
@@ -528,11 +530,6 @@ function(add_swift_host_library name)
528530
target_link_options(${name} PRIVATE
529531
"LINKER:-current_version,${SWIFT_COMPILER_VERSION}")
530532
endif()
531-
532-
get_target_triple(target target_variant "${SWIFT_HOST_VARIANT_SDK}" "${SWIFT_HOST_VARIANT_ARCH}"
533-
MACCATALYST_BUILD_FLAVOR ""
534-
DEPLOYMENT_VERSION "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
535-
target_link_options(${name} PRIVATE -target;${target})
536533
endif()
537534

538535
add_dependencies(dev ${name})
@@ -577,6 +574,7 @@ function(add_swift_host_tool executable)
577574
add_executable(${executable} ${ASHT_UNPARSED_ARGUMENTS})
578575
_add_host_variant_c_compile_flags(${executable})
579576
_add_host_variant_link_flags(${executable})
577+
_add_host_variant_c_compile_link_flags(${executable})
580578
target_link_directories(${executable} PRIVATE
581579
${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
582580
add_dependencies(${executable} ${LLVM_COMMON_DEPENDS})

cmake/modules/AddSwiftUnittests.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ function(add_swift_unittest test_dirname)
5757
_ENABLE_EXTENDED_ALIGNED_STORAGE)
5858
endif()
5959

60-
if(SWIFT_USE_LINKER)
61-
set_property(TARGET "${test_dirname}" APPEND_STRING PROPERTY
62-
LINK_FLAGS " -fuse-ld=${SWIFT_USE_LINKER}")
60+
if(NOT SWIFT_COMPILER_IS_MSVC_LIKE)
61+
if(SWIFT_USE_LINKER)
62+
target_link_options(${test_dirname} PRIVATE
63+
-fuse-ld=${SWIFT_USE_LINKER}$<$<STREQUAL:${CMAKE_HOST_SYSTEM_NAME},Windows>:.exe>)
64+
endif()
6365
endif()
6466

6567
if(SWIFT_ANALYZE_CODE_COVERAGE)

cmake/modules/SwiftHandleGybSources.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
include(SwiftAddCustomCommandTarget)
22
include(SwiftSetIfArchBitness)
33

4-
find_package(Python2 COMPONENTS Interpreter REQUIRED)
5-
64
# Create a target to process single gyb source with the 'gyb' tool.
75
#
86
# handle_gyb_source_single(
@@ -60,7 +58,7 @@ function(handle_gyb_source_single dependency_out_var_name)
6058
COMMAND
6159
"${CMAKE_COMMAND}" -E make_directory "${dir}"
6260
COMMAND
63-
"$<TARGET_FILE:Python2::Interpreter>" "${gyb_tool}" ${SWIFT_GYB_FLAGS} ${GYB_SINGLE_FLAGS} -o "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_SOURCE}"
61+
"$<TARGET_FILE:Python3::Interpreter>" "${gyb_tool}" ${SWIFT_GYB_FLAGS} ${GYB_SINGLE_FLAGS} -o "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_SOURCE}"
6462
COMMAND
6563
"${CMAKE_COMMAND}" -E copy_if_different "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_OUTPUT}"
6664
COMMAND

docs/Android.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,9 @@ $ NDK_PATH="path/to/android-ndk21"
103103
$ build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc \ # The Swift compiler built in the previous step.
104104
# The location of the tools used to build Android binaries
105105
-tools-directory ${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/ \
106-
-target armv7a-none-linux-androideabi \ # Targeting android-armv7.
107-
-sdk ${NDK_PATH}/platforms/android-21/arch-arm \ # Use the same architecture and API version as you used to build the stdlib in the previous step.
108-
-Xclang-linker -nostdlib++ \ # Don't link libc++, and supply the path to libgcc.
106+
-target armv7a-none-linux-androideabi \ # Targeting android-armv7, and supply the path to libgcc.
109107
-L ${NDK_PATH}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/armv7-a \
108+
-sdk ${NDK_PATH}/platforms/android-21/arch-arm \ # Use the same architecture and API version as you used to build the stdlib in the previous step.
110109
hello.swift
111110
```
112111

docs/DifferentiableProgramming.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Differentiable Programming Manifesto
22

33
* Authors: [Richard Wei], [Dan Zheng], [Marc Rasi], [Bart Chrzaszcz]
4-
* Status: Partially implemented
4+
* Status: Partially implemented on master, feature gated under `import _Differentiation`
55

66
## Table of contents
77

@@ -1949,7 +1949,7 @@ One concrete example is `sinf(_:)` from the C standard library. It can be made
19491949
differentiable by defining a derivative retroactively.
19501950

19511951
```swift
1952-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
1952+
#if canImport(Darwin)
19531953
import func Darwin.sinf
19541954
#else
19551955
import func Glibc.sinf

0 commit comments

Comments
 (0)