Skip to content

Commit d89347b

Browse files
committedSep 20, 2024
Merge branch 'main' into wip-experimental-isolated-deinit
2 parents 2fd6f00 + d3b788f commit d89347b

File tree

229 files changed

+3243
-1956
lines changed

Some content is hidden

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

229 files changed

+3243
-1956
lines changed
 

‎CMakeLists.txt

+13-5
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ else()
155155
set(SWIFT_HOST_VARIANT_SDK_default "ANDROID")
156156
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
157157
set(SWIFT_HOST_VARIANT_SDK_default "OSX")
158+
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "WASI")
159+
set(SWIFT_HOST_VARIANT_SDK_default "WASI")
158160
else()
159161
message(FATAL_ERROR "Unable to detect SDK for host system: ${CMAKE_SYSTEM_NAME}")
160162
endif()
@@ -419,6 +421,17 @@ set(SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY
419421
${SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY_default}
420422
CACHE STRING "MSVC Runtime Library for the standard library")
421423

424+
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS" AND
425+
CMAKE_BUILD_TYPE STREQUAL "Debug")
426+
# Building with the host Swift toolchain requires linking just-built binaries
427+
# against the host Swift runtime. In debug builds, that means linking a debug
428+
# binary against a release binary. The MSVC linker does not normally permit
429+
# this, since debug builds enable bounds-checked C++ iterators by default,
430+
# which are not ABI-compatible with regular iterators. Let's instruct MSVC to
431+
# disable bounds-checked iterators to make it possible to do a debug build of
432+
# the Swift compiler with a host toolchain.
433+
add_definitions(-D_ITERATOR_DEBUG_LEVEL=0)
434+
endif()
422435

423436
if(BRIDGING_MODE STREQUAL "DEFAULT" OR NOT BRIDGING_MODE)
424437
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR "${SWIFT_HOST_VARIANT_SDK}" STREQUAL "WINDOWS" OR (CMAKE_Swift_COMPILER AND CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.8))
@@ -703,10 +716,6 @@ option(SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED
703716
"Enable experimental distributed actors and functions"
704717
FALSE)
705718

706-
option(SWIFT_ENABLE_EXPERIMENTAL_NONESCAPABLE_TYPES
707-
"Enable experimental NonescapableTypes"
708-
FALSE)
709-
710719
option(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING
711720
"Enable experimental string processing"
712721
FALSE)
@@ -1385,7 +1394,6 @@ if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
13851394
message(STATUS "Differentiable Programming Support: ${SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING}")
13861395
message(STATUS "Concurrency Support: ${SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY}")
13871396
message(STATUS "Distributed Support: ${SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED}")
1388-
message(STATUS "NonEscapableTypes Support: ${SWIFT_ENABLE_EXPERIMENTAL_NONESCAPABLE_TYPES}")
13891397
message(STATUS "String Processing Support: ${SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING}")
13901398
message(STATUS "Backtracing Support: ${SWIFT_ENABLE_BACKTRACING}")
13911399
message(STATUS "Unicode Support: ${SWIFT_STDLIB_ENABLE_UNICODE_DATA}")

‎SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyBuiltin.swift

+11-10
Original file line numberDiff line numberDiff line change
@@ -150,19 +150,20 @@ private extension BuiltinInst {
150150
}
151151

152152
func optimizeAssertConfig(_ context: SimplifyContext) {
153-
let literal: IntegerLiteralInst
154-
switch context.options.assertConfiguration {
155-
case .enabled:
156-
let builder = Builder(before: self, context)
157-
literal = builder.createIntegerLiteral(1, type: type)
158-
case .disabled:
153+
// The values for the assert_configuration call are:
154+
// 0: Debug
155+
// 1: Release
156+
// 2: Fast / Unchecked
157+
let config = context.options.assertConfiguration
158+
switch config {
159+
case .debug, .release, .unchecked:
159160
let builder = Builder(before: self, context)
160-
literal = builder.createIntegerLiteral(0, type: type)
161-
default:
161+
let literal = builder.createIntegerLiteral(config.integerValue, type: type)
162+
uses.replaceAll(with: literal, context)
163+
context.erase(instruction: self)
164+
case .unknown:
162165
return
163166
}
164-
uses.replaceAll(with: literal, context)
165-
context.erase(instruction: self)
166167
}
167168

168169
func optimizeTargetTypeConst(_ context: SimplifyContext) {

0 commit comments

Comments
 (0)