Skip to content

Commit eefdd69

Browse files
authored
Merge pull request #82915 from al45tair/eng/PR-151147606-take2
[Concurrency] Remove custom global executors from 6.2.
2 parents c4a3d31 + bd289dc commit eefdd69

Some content is hidden

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

55 files changed

+531
-1867
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,10 @@ option(SWIFT_STDLIB_ASSERTIONS
464464
"Enable internal checks for the Swift standard library (useful for debugging the library itself, does not affect checks required for safety)"
465465
"${SWIFT_STDLIB_ASSERTIONS_default}")
466466

467+
option(SWIFT_STDLIB_ENABLE_STRICT_AVAILABILITY
468+
"Enable strict availability; this will cause things to break at desk or in CI if the host OS is a lower version than some `@availability` annotations in the runtime code"
469+
FALSE)
470+
467471
option(SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER
468472
"Use the host compiler and not the internal clang to build the swift runtime"
469473
FALSE)
@@ -1406,8 +1410,9 @@ endif()
14061410

14071411
if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
14081412
message(STATUS "Building Swift standard library and overlays for SDKs: ${SWIFT_SDKS}")
1409-
message(STATUS " Build type: ${SWIFT_STDLIB_BUILD_TYPE}")
1410-
message(STATUS " Assertions: ${SWIFT_STDLIB_ASSERTIONS}")
1413+
message(STATUS " Build type: ${SWIFT_STDLIB_BUILD_TYPE}")
1414+
message(STATUS " Assertions: ${SWIFT_STDLIB_ASSERTIONS}")
1415+
message(STATUS " Strict availability: ${SWIFT_STDLIB_ENABLE_STRICT_AVAILABILITY}")
14111416
message(STATUS "")
14121417

14131418
message(STATUS "Building Swift runtime with:")

Runtimes/Core/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ set(SwiftCore_VENDOR_MODULE_DIR "${SwiftCore_CMAKE_MODULES_DIR}/vendor"
7878
include(GNUInstallDirs)
7979
include(CheckSymbolExists)
8080
include(CheckIncludeFileCXX)
81-
include(AvailabilityMacros)
8281
include(CompilerSettings)
8382
include(DefaultSettings)
8483
include(EmitSwiftInterface)
8584
include(PlatformInfo)
8685
include(gyb)
8786
include(ResourceEmbedding)
8887
include(CatalystSupport)
88+
include(AvailabilityMacros)
8989

9090
check_symbol_exists("asl_log" "asl.h" SwiftCore_HAS_ASL)
9191
check_symbol_exists("dladdr" "dlfcn.h" SwiftCore_HAS_DLADDR)
@@ -125,6 +125,7 @@ defaulted_option(SwiftCore_ENABLE_BACKTRACING "Enable backtracing runtime suppor
125125
defaulted_set(SwiftCore_BACKTRACER_PATH STRING "Set a fixed path to the Swift backtracer")
126126
defaulted_option(SwiftCore_ENABLE_FATALERROR_BACKTRACE "Build stdlib fatalError with backtrace output")
127127
defaulted_option(SwiftCore_ENABLE_PRESPECIALIZATION "Enable generic metadata prespecialization")
128+
defaulted_option(SwiftCore_ENABLE_STRICT_AVAILABILITY "Enable strict availability; this will cause things to break at desk or in CI if the host OS is a lower version than some `@availability` annotations in the runtime code")
128129

129130
option(SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS "" OFF)
130131
option(SwiftCore_ENABLE_RUNTIME_LEAK_CHECKER "" OFF)

Runtimes/Core/cmake/caches/Vendors/Apple/apple-common.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ set(SwiftCore_ENABLE_VECTOR_TYPES ON CACHE BOOL "")
1212
set(SwiftCore_ENABLE_RUNTIME_FUNCTION_COUNTERS ON CACHE BOOL "")
1313
set(SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT ON CACHE BOOL "")
1414
set(SwiftCore_ENABLE_FILESYSTEM_SUPPORT ON CACHE BOOL "")
15+
set(SwiftCore_ENABLE_STRICT_AVAILABILITY ON CACHE BOOL "")
16+
1517
set(SwiftCore_OPTIMIZATION_REMARKS "bitstream" CACHE STRING "")
1618

1719
set(SwiftCore_INSTALL_NESTED_SUBDIR OFF CACHE BOOL "")

Runtimes/Core/cmake/modules/AvailabilityMacros.cmake

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,39 @@ configure_file("${SwiftCore_SWIFTC_SOURCE_DIR}/utils/availability-macros.def"
44
file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/availability-macros.def" availability_defs)
55
list(FILTER availability_defs EXCLUDE REGEX "^\\s*(#.*)?$")
66
foreach(def ${availability_defs})
7-
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -define-availability -Xfrontend \"${def}\">")
7+
list(APPEND availability_definitions "-Xfrontend -define-availability -Xfrontend \"${def}\"")
8+
9+
if("${def}" MATCHES "SwiftStdlib .*")
10+
# For each SwiftStdlib x.y, also define StdlibDeploymentTarget x.y, which,
11+
# will expand to the current `-target` platform if the macro defines a
12+
# newer platform as its availability.
13+
#
14+
# There is a setting, SwiftCore_ENABLE_STRICT_AVAILABILITY, which if set
15+
# ON will cause us to use the "proper" availability instead.
16+
string(REPLACE "SwiftStdlib" "StdlibDeploymentTarget" current "${def}")
17+
if(NOT SwiftCore_ENABLE_STRICT_AVAILABILITY AND SwiftCore_SWIFT_AVAILABILITY_PLATFORM)
18+
if("${SwiftCore_SWIFT_AVAILABILITY_PLATFORM}" STREQUAL "macOS" AND "${SwiftCore_VARIANT_AVAILABILITY_PLATFORM}" STREQUAL "iOS")
19+
string(REGEX MATCH "iOS ([0-9]+(\.[0-9]+)+)" ios_platform_version "${def}")
20+
string(REGEX MATCH "[0-9]+(\.[0-9]+)+" ios_version "${ios_platform_version}")
21+
string(REGEX MATCH "macOS ([0-9]+(\.[0-9]+)+)" macos_platform_version "${def}")
22+
string(REGEX MATCH "[0-9]+(\.[0-9]+)+" macos_version "${macos_platform_version}")
23+
if((NOT macos_version STREQUAL "9999" OR NOT ios_version STREQUAL "9999") AND (macos_version VERSION_GREATER CMAKE_OSX_DEPLOYMENT_TARGET OR ios_version VERSION_GREATER SwiftCore_VARIANT_DEPLOYMENT_VERSION))
24+
string(REGEX REPLACE ":.*" ": macOS ${CMAKE_OSX_DEPLOYMENT_VERSION}, iOS ${SwiftCore_VARIANT_DEPLOYMENT_VERSION}" current "${current}")
25+
endif()
26+
else()
27+
string(REGEX MATCH "${SwiftCore_SWIFT_AVAILABILITY_PLATFORM} ([0-9]+(\.[0-9]+)+)" platform_version "${def}")
28+
string(REGEX MATCH "[0-9]+(\.[0-9]+)+" version "${platform_version}")
29+
if(NOT version STREQUAL "9999" AND version VERSION_GREATER CMAKE_OSX_DEPLOYMENT_TARGET)
30+
string(REGEX REPLACE ":.*" ":${SwiftCore_SWIFT_AVAILABILITY_PLATFORM} ${CMAKE_OSX_DEPLOYMENT_TARGET}" current "${current}")
31+
endif()
32+
endif()
33+
endif()
34+
list(APPEND availability_definitions "-Xfrontend -define-availability -Xfrontend \"${current}\"")
35+
endif()
836
endforeach()
37+
38+
list(JOIN availability_definitions "\n" availability_definitions)
39+
file(GENERATE
40+
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/availability-macros.rsp"
41+
CONTENT "${availability_definitions}")
42+
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:${CMAKE_Swift_RESPONSE_FILE_FLAG}${CMAKE_CURRENT_BINARY_DIR}/availability-macros.rsp>")

Runtimes/Core/cmake/modules/CatalystSupport.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,12 @@ if(SwiftCore_COMPILER_VARIANT_TARGET)
3434
set(SwiftCore_VARIANT_MODULE_TRIPLE "${module_triple}" CACHE STRING "Triple used for installed swift{module,interface} files for the target variant")
3535
mark_as_advanced(SwiftCore_VARIANT_MODULE_TRIPLE)
3636
message(CONFIGURE_LOG "Swift target variant module triple: ${module_triple}")
37+
38+
string(JSON triple GET "${target_info_json}" "target" "triple")
39+
if(triple MATCHES "apple-([a-zA-Z]+)([0-9]+[.0-9]*)-macabi")
40+
set(SwiftCore_VARIANT_DEPLOYMENT_VERSION "${CMAKE_MATCH_2}")
41+
mark_as_advanced(SwiftCore_VARIANT_DEPLOYMENT_VERSION)
42+
message(CONFIGURE_LOG "Swift target variant deployment version: ${SwiftCore_VARIANT_DEPLOYMENT_VERSION}")
43+
endif()
3744
endif()
3845
endif()

Runtimes/Core/cmake/modules/DefaultSettings.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ set(SwiftCore_ENABLE_COMMANDLINE_SUPPORT_default OFF) # TODO: enable this by def
1111
set(SwiftCore_ENABLE_STDIN_default ON)
1212
set(SwiftCore_ENABLE_TYPE_PRINTING_default ON)
1313

14+
set(SwiftCore_ENABLE_STRICT_AVAILABILITY_default OFF)
15+
1416
set(SwiftCore_BACKTRACER_PATH_default "")
1517

1618
# Provide a boolean option that a user can optionally enable.
@@ -20,7 +22,7 @@ macro(defaulted_option variable helptext)
2022
if(NOT DEFINED ${variable}_default)
2123
set(${variable}_default OFF)
2224
endif()
23-
option(${variable} ${helptext} ${${variable}_default})
25+
option(${variable} "${helptext}" ${${variable}_default})
2426
endmacro()
2527

2628
# Create a defaulted cache entry

Runtimes/Core/cmake/modules/PlatformInfo.cmake

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,47 @@ if(NOT SwiftCore_ARCH_SUBDIR)
3636

3737
message(CONFIGURE_LOG "Swift Arch: ${arch}")
3838
endif()
39+
40+
# Note: *moduleTriple* doesn't have an "x" on the end of "macos"; just to be
41+
# safe, we support both cases here.
42+
set(availability_platform_macos "macOS")
43+
set(availaiblity_platform_macosx "macOS")
44+
set(availability_platform_ios "iOS")
45+
set(availability_platform_watchos "watchOS")
46+
set(availability_platform_tvos "tvOS")
47+
set(availability_platform_xros "visionOS")
48+
set(availability_platform_bridgeos "bridgeOS")
49+
50+
if(NOT SwiftCore_SWIFT_AVAILABILITY_PLATFORM)
51+
if(SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)-simulator$")
52+
set(platform "${CMAKE_MATCH_1}")
53+
elseif(SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)-msvc$")
54+
set(platform "${CMAKE_MATCH_1}")
55+
elseif(SwiftCore_MODULE_TRIPLE MATCHES ".*-([^-]+)$")
56+
set(platform "${CMAKE_MATCH_1}")
57+
else()
58+
message(WARNING "Unable to extract platform name from triple ${SwiftCore_MODULE_TRIPLE}")
59+
endif()
60+
61+
if(availability_platform_${platform})
62+
set(SwiftCore_SWIFT_AVAILABILITY_PLATFORM "${availability_platform_${platform}}")
63+
else()
64+
set(SwiftCore_SWIFT_AVAILABILITY_PLATFORM "unknown")
65+
message(WARNING "Unknown platform ${platform} for availability")
66+
endif()
67+
endif()
68+
69+
set(SwiftCore_VARIANT_AVAILABILITY_PLATFORM "none")
70+
if(SwiftCore_VARIANT_MODULE_TRIPLE)
71+
if(SwiftCore_VARIANT_MODULE_TRIPLE MATCHES ".*-([^-]+)$")
72+
set(platform "${CMAKE_MATCH_1}")
73+
else()
74+
message(FATAL_ERROR "Unable to extract platform name from triple ${SwiftCore_VARIANT_MODULE_TRIPLE}")
75+
endif()
76+
77+
if(availability_platform_${platform})
78+
set(SwiftCore_VARIANT_AVAILABILITY_PLATFORM "${availability_platform_${platform}}")
79+
else()
80+
message(WARNING "Unknown platform ${platform} for variant availability")
81+
endif()
82+
endif()

cmake/modules/DarwinSDKs.cmake

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ is_sdk_requested(OSX swift_build_osx)
1212
if(swift_build_osx)
1313
configure_sdk_darwin(
1414
OSX "OS X" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_OSX}"
15-
macosx macosx macos "${SUPPORTED_OSX_ARCHS}")
15+
macosx macosx macos macOS "${SUPPORTED_OSX_ARCHS}")
1616
configure_target_variant(OSX-DA "OS X Debug+Asserts" OSX DA "Debug+Asserts")
1717
configure_target_variant(OSX-RA "OS X Release+Asserts" OSX RA "Release+Asserts")
1818
configure_target_variant(OSX-R "OS X Release" OSX R "Release")
@@ -22,16 +22,21 @@ is_sdk_requested(FREESTANDING swift_build_freestanding)
2222
if(swift_build_freestanding AND (SWIFT_FREESTANDING_FLAVOR STREQUAL "apple"))
2323
set(SWIFT_FREESTANDING_SDK "" CACHE STRING
2424
"Which SDK to use when building the FREESTANDING stdlib")
25+
set(SWIFT_FREESTANDING_DEPLOYMENT_VERSION "" CACHE STRING
26+
"The deployment version to use when building the FREESTANDING stdlib")
2527
set(SWIFT_FREESTANDING_TRIPLE_NAME "" CACHE STRING
2628
"Which triple name (e.g. 'none-macho') to use when building the FREESTANDING stdlib")
2729
set(SWIFT_FREESTANDING_MODULE_NAME "" CACHE STRING
2830
"Which .swiftmodule name (e.g. 'freestanding') to use when building the FREESTANDING stdlib")
31+
set(SWIFT_FREESTANDING_AVAILABILITY_NAME "" CACHE STRING
32+
"Which @availability name (e.g. 'macOS') to use when building the FREESTANDING stdlib")
2933
set(SWIFT_FREESTANDING_ARCHS "" CACHE STRING
3034
"Which architectures to build when building the FREESTANDING stdlib")
3135
configure_sdk_darwin(
32-
FREESTANDING "FREESTANDING" ""
36+
FREESTANDING "FREESTANDING" "${SWIFT_FREESTANDING_DEPLOYMENT_VERSION}"
3337
"${SWIFT_FREESTANDING_SDK}"
34-
"${SWIFT_FREESTANDING_TRIPLE_NAME}" "${SWIFT_FREESTANDING_MODULE_NAME}" "${SWIFT_FREESTANDING_ARCHS}")
38+
"${SWIFT_FREESTANDING_TRIPLE_NAME}" "${SWIFT_FREESTANDING_MODULE_NAME}"
39+
"${SWIFT_FREESTANDING_AVAILABILITY_NAME}" "${SWIFT_FREESTANDING_ARCHS}")
3540
set(SWIFT_SDK_FREESTANDING_LIB_SUBDIR "freestanding")
3641
configure_target_variant(FREESTANDING-DA "FREESTANDING Debug+Asserts" FREESTANDING DA "Debug+Asserts")
3742
configure_target_variant(FREESTANDING-RA "FREESTANDING Release+Asserts" FREESTANDING RA "Release+Asserts")
@@ -53,7 +58,7 @@ is_sdk_requested(IOS swift_build_ios)
5358
if(swift_build_ios)
5459
configure_sdk_darwin(
5560
IOS "iOS" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS}"
56-
iphoneos ios ios "${SUPPORTED_IOS_ARCHS}")
61+
iphoneos ios ios iOS "${SUPPORTED_IOS_ARCHS}")
5762
configure_target_variant(IOS-DA "iOS Debug+Asserts" IOS DA "Debug+Asserts")
5863
configure_target_variant(IOS-RA "iOS Release+Asserts" IOS RA "Release+Asserts")
5964
configure_target_variant(IOS-R "iOS Release" IOS R "Release")
@@ -63,7 +68,7 @@ is_sdk_requested(IOS_SIMULATOR swift_build_ios_simulator)
6368
if(swift_build_ios_simulator)
6469
configure_sdk_darwin(
6570
IOS_SIMULATOR "iOS Simulator" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS}"
66-
iphonesimulator ios ios-simulator
71+
iphonesimulator ios ios-simulator iOS
6772
"${SUPPORTED_IOS_SIMULATOR_ARCHS}")
6873
configure_target_variant(
6974
IOS_SIMULATOR-DA "iOS Debug+Asserts" IOS_SIMULATOR DA "Debug+Asserts")
@@ -77,7 +82,7 @@ is_sdk_requested(TVOS swift_build_tvos)
7782
if(swift_build_tvos)
7883
configure_sdk_darwin(
7984
TVOS "tvOS" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS}"
80-
appletvos tvos tvos "${SUPPORTED_TVOS_ARCHS}")
85+
appletvos tvos tvos tvOS "${SUPPORTED_TVOS_ARCHS}")
8186
configure_target_variant(TVOS-DA "tvOS Debug+Asserts" TVOS DA "Debug+Asserts")
8287
configure_target_variant(TVOS-RA "tvOS Release+Asserts" TVOS RA "Release+Asserts")
8388
configure_target_variant(TVOS-R "tvOS Release" TVOS R "Release")
@@ -87,7 +92,7 @@ is_sdk_requested(TVOS_SIMULATOR swift_build_tvos_simulator)
8792
if(swift_build_tvos_simulator)
8893
configure_sdk_darwin(
8994
TVOS_SIMULATOR "tvOS Simulator" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS}"
90-
appletvsimulator tvos tvos-simulator
95+
appletvsimulator tvos tvos-simulator tvOS
9196
"${SUPPORTED_TVOS_SIMULATOR_ARCHS}")
9297
configure_target_variant(
9398
TVOS_SIMULATOR-DA "tvOS Debug+Asserts" TVOS_SIMULATOR DA "Debug+Asserts")
@@ -101,7 +106,7 @@ is_sdk_requested(WATCHOS swift_build_watchos)
101106
if(swift_build_watchos)
102107
configure_sdk_darwin(
103108
WATCHOS "watchOS" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS}"
104-
watchos watchos watchos "${SUPPORTED_WATCHOS_ARCHS}")
109+
watchos watchos watchos watchOS "${SUPPORTED_WATCHOS_ARCHS}")
105110
configure_target_variant(WATCHOS-DA "watchOS Debug+Asserts" WATCHOS DA "Debug+Asserts")
106111
configure_target_variant(WATCHOS-RA "watchOS Release+Asserts" WATCHOS RA "Release+Asserts")
107112
configure_target_variant(WATCHOS-R "watchOS Release" WATCHOS R "Release")
@@ -111,7 +116,7 @@ is_sdk_requested(WATCHOS_SIMULATOR swift_build_watchos_simulator)
111116
if(swift_build_watchos_simulator)
112117
configure_sdk_darwin(
113118
WATCHOS_SIMULATOR "watchOS Simulator" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS}"
114-
watchsimulator watchos watchos-simulator
119+
watchsimulator watchos watchos-simulator watchOS
115120
"${SUPPORTED_WATCHOS_SIMULATOR_ARCHS}")
116121
configure_target_variant(WATCHOS_SIMULATOR-DA "watchOS Debug+Asserts" WATCHOS_SIMULATOR DA "Debug+Asserts")
117122
configure_target_variant(WATCHOS_SIMULATOR-RA "watchOS Release+Asserts" WATCHOS_SIMULATOR RA "Release+Asserts")
@@ -122,7 +127,7 @@ is_sdk_requested(XROS swift_build_xros)
122127
if(swift_build_xros)
123128
configure_sdk_darwin(
124129
XROS "xrOS" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_XROS}"
125-
xros xros xros "${SUPPORTED_XROS_ARCHS}")
130+
xros xros xros visionOS "${SUPPORTED_XROS_ARCHS}")
126131
configure_target_variant(XROS-DA "xrOS Debug+Asserts" XROS DA "Debug+Asserts")
127132
configure_target_variant(XROS-RA "xrOS Release+Asserts" XROS RA "Release+Asserts")
128133
configure_target_variant(XROS-R "xrOS Release" XROS R "Release")
@@ -132,7 +137,7 @@ is_sdk_requested(XROS_SIMULATOR swift_build_xros_simulator)
132137
if(swift_build_xros_simulator)
133138
configure_sdk_darwin(
134139
XROS_SIMULATOR "xrOS Simulator" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_XROS}"
135-
xrsimulator xros xros-simulator
140+
xrsimulator xros xros-simulator visionOS
136141
"${SUPPORTED_XROS_SIMULATOR_ARCHS}")
137142

138143
configure_target_variant(

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ endfunction()
136136
# deployment_version # Deployment version
137137
# xcrun_name # SDK name to use with xcrun
138138
# triple_name # The name used in Swift's -triple
139+
# availability_name # The name used in Swift's @availability
139140
# architectures # A list of architectures this SDK supports
140141
# )
141142
#
@@ -165,9 +166,11 @@ endfunction()
165166
# SWIFT_SDK_${prefix}_ARCH_${ARCH}_TRIPLE Triple name
166167
# SWIFT_SDK_${prefix}_ARCH_${ARCH}_MODULE Module triple name for this SDK
167168
# SWIFT_SDK_${prefix}_USE_BUILD_ID Whether to pass --build-id to the linker
169+
# SWIFT_SDK_${prefix}_AVAILABILITY_NAME Name to use in @availability
170+
#
168171
macro(configure_sdk_darwin
169172
prefix name deployment_version xcrun_name
170-
triple_name module_name architectures)
173+
triple_name module_name availability_name architectures)
171174
# Note: this has to be implemented as a macro because it sets global
172175
# variables.
173176

@@ -201,6 +204,7 @@ macro(configure_sdk_darwin
201204
set(SWIFT_SDK_${prefix}_DEPLOYMENT_VERSION "${deployment_version}")
202205
set(SWIFT_SDK_${prefix}_LIB_SUBDIR "${xcrun_name}")
203206
set(SWIFT_SDK_${prefix}_TRIPLE_NAME "${triple_name}")
207+
set(SWIFT_SDK_${prefix}_AVAILABILITY_NAME "${availability_name}")
204208
set(SWIFT_SDK_${prefix}_OBJECT_FORMAT "MACHO")
205209
set(SWIFT_SDK_${prefix}_USE_ISYSROOT TRUE)
206210
set(SWIFT_SDK_${prefix}_SHARED_LIBRARY_PREFIX "lib")

lib/SILGen/SILGenFunction.cpp

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,28 +1387,6 @@ void SILGenFunction::emitArtificialTopLevel(Decl *mainDecl) {
13871387
}
13881388
}
13891389

1390-
static bool isCreateExecutorsFunctionAvailable(SILGenModule &SGM) {
1391-
FuncDecl *createExecutorsFuncDecl = SGM.getCreateExecutors();
1392-
if (!createExecutorsFuncDecl)
1393-
return false;
1394-
1395-
auto &ctx = createExecutorsFuncDecl->getASTContext();
1396-
1397-
if (ctx.LangOpts.hasFeature(Feature::Embedded))
1398-
return true;
1399-
1400-
if (!ctx.LangOpts.DisableAvailabilityChecking) {
1401-
auto deploymentAvailability = AvailabilityRange::forDeploymentTarget(ctx);
1402-
auto runtimeAvailability = AvailabilityRange::forRuntimeTarget(ctx);
1403-
auto declAvailability = ctx.getCustomGlobalExecutorsAvailability();
1404-
auto declRtAvailability = ctx.getCustomGlobalExecutorsRuntimeAvailability();
1405-
return deploymentAvailability.isContainedIn(declAvailability)
1406-
&& runtimeAvailability.isContainedIn(declRtAvailability);
1407-
}
1408-
1409-
return true;
1410-
}
1411-
14121390
void SILGenFunction::emitAsyncMainThreadStart(SILDeclRef entryPoint) {
14131391
auto moduleLoc = entryPoint.getAsRegularLocation();
14141392
auto *entryBlock = B.getInsertionBB();
@@ -1424,46 +1402,6 @@ void SILGenFunction::emitAsyncMainThreadStart(SILDeclRef entryPoint) {
14241402

14251403
B.setInsertionPoint(entryBlock);
14261404

1427-
// If we're using a new enough deployment target, and we can find a
1428-
// DefaultExecutorFactory type, call swift_createExecutors()
1429-
Type factoryNonCanTy = SGM.getConfiguredExecutorFactory();
1430-
1431-
if (isCreateExecutorsFunctionAvailable(SGM) && factoryNonCanTy) {
1432-
CanType factoryTy = factoryNonCanTy->getCanonicalType();
1433-
1434-
ProtocolDecl *executorFactoryProtocol
1435-
= ctx.getProtocol(KnownProtocolKind::ExecutorFactory);
1436-
auto conformance = lookupConformance(factoryTy, executorFactoryProtocol);
1437-
1438-
if (conformance.isInvalid()) {
1439-
// If this type doesn't conform, ignore it and use the default factory
1440-
SourceLoc loc = extractNearestSourceLoc(factoryTy);
1441-
1442-
ctx.Diags.diagnose(loc, diag::executor_factory_must_conform);
1443-
1444-
factoryTy = SGM.getDefaultExecutorFactory()->getCanonicalType();
1445-
conformance = lookupConformance(factoryTy, executorFactoryProtocol);
1446-
1447-
assert(!conformance.isInvalid());
1448-
}
1449-
1450-
FuncDecl *createExecutorsFuncDecl = SGM.getCreateExecutors();
1451-
assert(createExecutorsFuncDecl
1452-
&& "Failed to find swift_createExecutors function decl");
1453-
SILFunction *createExecutorsSILFunc =
1454-
SGM.getFunction(SILDeclRef(createExecutorsFuncDecl, SILDeclRef::Kind::Func),
1455-
NotForDefinition);
1456-
SILValue createExecutorsFunc =
1457-
B.createFunctionRefFor(moduleLoc, createExecutorsSILFunc);
1458-
MetatypeType *factoryThickMetaTy
1459-
= MetatypeType::get(factoryTy, MetatypeRepresentation::Thick);
1460-
SILValue factorySILMetaTy
1461-
= B.createMetatype(moduleLoc, getLoweredType(factoryThickMetaTy));
1462-
auto ceSubs = SubstitutionMap::getProtocolSubstitutions(
1463-
conformance.getProtocol(), factoryTy, conformance);
1464-
B.createApply(moduleLoc, createExecutorsFunc, ceSubs, { factorySILMetaTy });
1465-
}
1466-
14671405
auto wrapCallArgs = [this, &moduleLoc](SILValue originalValue, FuncDecl *fd,
14681406
uint32_t paramIndex) -> SILValue {
14691407
Type parameterType = fd->getParameters()->get(paramIndex)->getTypeInContext();

0 commit comments

Comments
 (0)