Skip to content

Commit 698ad0d

Browse files
Merge pull request #4689 from swiftwasm/katei/merge-main-2022-07-12
Merge main 2022-07-12
2 parents e27e1c4 + caf1787 commit 698ad0d

File tree

354 files changed

+9219
-3203
lines changed

Some content is hidden

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

354 files changed

+9219
-3203
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ assignees: ''
1010
**Describe the bug**
1111
A clear and concise description of what the bug is.
1212

13-
**To Reproduce**
13+
**Steps To Reproduce**
1414
Steps to reproduce the behavior:
1515
1.
1616
2.
@@ -22,7 +22,7 @@ A clear and concise description of what you expected to happen.
2222
**Screenshots**
2323
If applicable, add screenshots to help explain your problem.
2424

25-
**Environment (please complete the following information):**
25+
**Environment (please fill out the following information)**
2626
- OS: [e.g. macOS 11.0]
2727
- Xcode Version/Tag/Branch:
2828

CMakeLists.txt

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,6 @@ option(SWIFT_STDLIB_ENABLE_UNICODE_DATA
192192
NOTE: Disabling this will cause many String methods to crash."
193193
TRUE)
194194

195-
include(Threading)
196-
197-
threading_package_default("${SWIFT_HOST_VARIANT_SDK}"
198-
SWIFT_THREADING_PACKAGE_default)
199-
200-
set(SWIFT_THREADING_PACKAGE "${SWIFT_THREADING_PACKAGE_default}"
201-
CACHE STRING
202-
"The threading package to use. Must be one of 'none', 'pthreads',
203-
'darwin', 'linux', 'win32', 'c11'.")
204-
205195
option(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY
206196
"Build dynamic variants of the Swift SDK overlay"
207197
TRUE)
@@ -594,6 +584,12 @@ cmake_dependent_option(SWIFT_ENABLE_SOURCEKIT_TESTS
594584
"Enable running SourceKit tests" TRUE
595585
"SWIFT_BUILD_SOURCEKIT" FALSE)
596586

587+
option(SWIFT_THREADING_PACKAGE
588+
"Override the threading package used for the build. This can either be a
589+
single package name, or a semicolon separated sequence of sdk:package pairs.
590+
Valid package names are 'pthreads', 'darwin', 'linux', 'win32', 'c11', 'none'
591+
or the empty string for the SDK default.")
592+
597593
#
598594
# End of user-configurable options.
599595
#
@@ -825,6 +821,32 @@ if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQU
825821
set(SWIFT_COMPILER_IS_MSVC_LIKE TRUE)
826822
endif()
827823

824+
#
825+
# Display a message if the threading package has been overridden
826+
#
827+
828+
if(SWIFT_THREADING_PACKAGE)
829+
message(STATUS "")
830+
message(STATUS "Threading package override enabled")
831+
foreach(elt ${SWIFT_THREADING_PACKAGE})
832+
string(REPLACE ":" ";" elt_list "${elt}")
833+
list(LENGTH elt_list elt_list_len)
834+
if(elt_list_len EQUAL 1)
835+
set(elt_sdk "Global")
836+
list(GET elt_list 0 elt_package)
837+
elseif(elt_list_len EQUAL 2)
838+
list(GET elt_list 0 elt_sdk)
839+
list(GET elt_list 1 elt_package)
840+
string(TOUPPER "${elt_sdk}" elt_sdk)
841+
else()
842+
message(FATAL_ERROR "Bad threading override \"${elt}\" - SWIFT_THREADING_PACKAGE must be a semicolon separated list of package or sdk:package pairs.")
843+
endif()
844+
string(TOLOWER "${elt_package}" elt_package)
845+
message(STATUS " ${elt_sdk}: ${elt_package}")
846+
endforeach()
847+
message(STATUS "")
848+
endif()
849+
828850
#
829851
# Configure SDKs.
830852
#
@@ -1059,7 +1081,6 @@ if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
10591081
message(STATUS " Leak Detection Checker Entrypoints: ${SWIFT_RUNTIME_ENABLE_LEAK_CHECKER}")
10601082
message(STATUS "")
10611083

1062-
message(STATUS "Threading Package: ${SWIFT_THREADING_PACKAGE}")
10631084
message(STATUS "Differentiable Programming Support: ${SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING}")
10641085
message(STATUS "Concurrency Support: ${SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY}")
10651086
message(STATUS "Distributed Support: ${SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED}")

SwiftCompilerSources/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ function(add_swift_compiler_modules_library name)
8787
list(APPEND swift_compile_options "-O" "-cross-module-optimization")
8888
endif()
8989

90+
if(NOT SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT)
91+
list(APPEND swift_compile_options "-Xfrontend" "-disable-legacy-type-info")
92+
endif()
93+
9094
get_bootstrapping_path(build_dir ${CMAKE_CURRENT_BINARY_DIR} "${ALS_BOOTSTRAPPING}")
9195

9296
set(sdk_option "")
@@ -267,7 +271,7 @@ else()
267271
list(APPEND b1_deps copy-libstdcxx-modulemap-bootstrapping1 copy-libstdcxx-header-bootstrapping1)
268272
endif()
269273
endif()
270-
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
274+
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS AND SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT)
271275
set(platform ${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
272276
set(compatibility_libs
273277
"swiftCompatibility50-${platform}"

SwiftCompilerSources/Sources/AST/DiagnosticEngine.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public struct DiagnosticEngine {
8181
fixIts: [DiagnosticFixIt] = []) {
8282

8383
let bridgedSourceLoc: swift.SourceLoc = position.bridged
84-
let bridgedHighlightRange: BridgedCharSourceRange = highlight.bridged
84+
let bridgedHighlightRange: swift.CharSourceRange = highlight.bridged
8585
var bridgedArgs: [BridgedDiagnosticArgument] = []
8686
var bridgedFixIts: [BridgedDiagnosticFixIt] = []
8787

SwiftCompilerSources/Sources/Basic/SourceLoc.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
import ASTBridging
14+
1315
public struct SourceLoc {
1416
/// Points into a source file.
1517
let locationInFile: UnsafePointer<UInt8>
@@ -47,27 +49,27 @@ extension Optional where Wrapped == SourceLoc {
4749

4850
public struct CharSourceRange {
4951
private let start: SourceLoc
50-
private let byteLength: Int
52+
private let byteLength: UInt32
5153

52-
public init(start: SourceLoc, byteLength: Int) {
54+
public init(start: SourceLoc, byteLength: UInt32) {
5355
self.start = start
5456
self.byteLength = byteLength
5557
}
5658

57-
public init?(bridged: BridgedCharSourceRange) {
58-
guard let start = SourceLoc(bridged: bridged.start) else {
59+
public init?(bridged: swift.CharSourceRange) {
60+
guard let start = SourceLoc(bridged: bridged.getStart()) else {
5961
return nil
6062
}
61-
self.init(start: start, byteLength: bridged.byteLength)
63+
self.init(start: start, byteLength: bridged.getByteLength())
6264
}
6365

64-
public var bridged: BridgedCharSourceRange {
65-
.init(start: start.bridged, byteLength: byteLength)
66+
public var bridged: swift.CharSourceRange {
67+
.init(start.bridged, byteLength)
6668
}
6769
}
6870

6971
extension Optional where Wrapped == CharSourceRange {
70-
public var bridged: BridgedCharSourceRange {
71-
self?.bridged ?? .init(start: .init(), byteLength: 0)
72+
public var bridged: swift.CharSourceRange {
73+
self?.bridged ?? .init(.init(), 0)
7274
}
7375
}

SwiftCompilerSources/Sources/Basic/Utils.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ extension BridgedStringRef {
4646
let buffer = UnsafeBufferPointer<UInt8>(start: data, count: Int(length))
4747
return String(decoding: buffer, as: UTF8.self)
4848
}
49-
50-
public func takeString() -> String {
51-
let str = string
52-
freeBridgedStringRef(self)
53-
return str
54-
}
5549
}
5650

5751
extension String {

SwiftCompilerSources/Sources/Optimizer/Analysis/AliasAnalysis.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ struct AliasAnalysis {
4545
}
4646

4747
/// Returns the correct path for address-alias functions.
48-
static func getPtrOrAddressPath(for value: Value) -> EscapeInfo.Path {
48+
static func getPtrOrAddressPath(for value: Value) -> SmallProjectionPath {
4949
let ty = value.type
5050
if ty.isAddress {
5151
// This is the regular case: the path selects any sub-fields of an address.
52-
return EscapeInfo.Path(.anyValueFields)
52+
return SmallProjectionPath(.anyValueFields)
5353
}
5454
// Some optimizations use the address-alias APIs with non-address SIL values.
5555
// TODO: this is non-intuitive and we should eliminate those API uses.
5656
if ty.isClass {
5757
// If the value is a (non-address) reference it means: all addresses within the class instance.
58-
return EscapeInfo.Path(.anyValueFields).push(.anyClassField)
58+
return SmallProjectionPath(.anyValueFields).push(.anyClassField)
5959
}
6060
// Any other non-address value means: all addresses of any referenced class instances within the value.
61-
return EscapeInfo.Path(.anyValueFields).push(.anyClassField).push(.anyValueFields)
61+
return SmallProjectionPath(.anyValueFields).push(.anyClassField).push(.anyValueFields)
6262
}
6363
}

0 commit comments

Comments
 (0)