Skip to content

Back-deploy concurrency #39342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
d04f951
[Serialization] Remove an assertion that fires spuriously.
DougGregor Sep 11, 2021
40e4263
[build-script] Refactor out BuildScriptInvocation into its own file a…
gottesmm Aug 15, 2021
a61d116
Revert "Revert "[Build] Make cmark build a build-script product (#371…
drexin May 23, 2021
8591c5a
[Build] Fix Python 2 incompatibility in cmake_product.py (#37659)
drexin May 27, 2021
f87af92
Add missing --config flag when building with --xcode.
varungandhi-apple Jun 2, 2021
2e409ba
[build-script] Provide infrastructure for CMakeProduct subclasses to …
gottesmm Aug 1, 2021
675d785
[concurrency] Implement a compatibility .a library for Concurrency.
gottesmm Jul 23, 2021
075cc07
[test] Skip some Concurrency tests during back deployment testing
hamishknight Aug 19, 2021
be533d6
Add a temporary flag to stage in back-deployment of concurrency.
DougGregor Aug 23, 2021
655cb0f
Add an option to build the concurrency library for back deployment.
DougGregor Aug 25, 2021
dc3e1f0
Optionally build the compiler and _Concurrency library for back deplo…
DougGregor Aug 26, 2021
5787b42
Clean up build-script test failures and linter errors
DougGregor Aug 26, 2021
12e868c
Build compiler, other libraries, and tests for back-deployed concurre…
DougGregor Aug 26, 2021
5d7b2b2
Enable concurrency back deployment in CI configurations.
DougGregor Aug 26, 2021
04c6874
[build-script] Add `--install-back-deploy-concurrency`.
DougGregor Aug 27, 2021
89c6794
Install the back-deployment concurrency libraries in most configurati…
DougGregor Aug 27, 2021
0583d5e
[IRGen] Support back-deployment of concurrency-related function types.
varungandhi-apple Aug 27, 2021
e733b49
Build the back-deployed _Concurrency library with an `@rpath` install…
DougGregor Aug 27, 2021
1e95290
[Test] Add back-deployed concurrency library path for runtime OS testing
DougGregor Aug 27, 2021
a6ec08f
Enable concurrency back-deployment in the compiler by default.
DougGregor Aug 29, 2021
e9ed329
Always use the older available for concurrency in tests
DougGregor Aug 29, 2021
d02ac19
Disable job-based dispatch integration in the back-deployed library.
DougGregor Aug 30, 2021
a4747e9
Allow a Swift 5.5 compiler to process the new _Concurrency module.
DougGregor Sep 2, 2021
868d896
Disable availability checking when type-checking the _Concurrency int…
DougGregor Sep 2, 2021
0b5c8f7
Make swift_async_extendedFramePointerFlags = 0 in back-deployed confi…
DougGregor Sep 2, 2021
29fc319
Prefer just-built compiler when building back-deployed concurrency li…
DougGregor Sep 8, 2021
af29d5b
Skip standard substitutions for _Concurrency types when back-deploying.
DougGregor Sep 9, 2021
99f3236
Ensure that we build back-deployed concurrency libraries with library…
DougGregor Sep 10, 2021
450cb1c
Fix the host-specific installation destdir for build-script products.
DougGregor Sep 11, 2021
65be4d0
Back-deploy creation of global-actor-qualified function type metadata.
DougGregor Sep 13, 2021
23c78e9
Generalize test slightly to work on older Swift runtimes.
DougGregor Sep 13, 2021
e99a6db
Consistently use `dlsym` for finding global-actor-qualified function …
DougGregor Sep 13, 2021
325a40e
[Test] Define concurrency_runtime feature when the concurrency runtim…
DougGregor Sep 13, 2021
0f0f9e2
Switch concurrency runtime tests to "REQUIRES: concurrency_runtime"
DougGregor Sep 13, 2021
dea7523
Use private concurrent queues for back-deployed concurrency.
DougGregor Sep 13, 2021
ae42a3e
Install Clang when building the macOS source compatibility suite.
DougGregor Sep 14, 2021
751c909
Add flag -swift-async-framepointer=auto,never,always to
aschwaighofer Sep 14, 2021
0b21f02
Change the logic to exclude extended frame info on all platforms but …
aschwaighofer Sep 14, 2021
44d42d8
Default to SwiftAsyncFramePointerKind::Always for now
aschwaighofer Sep 11, 2021
7eaf4b5
[IRGen] De-duplicate implementations of minimum OS versions supportin…
varungandhi-apple Aug 20, 2021
01c0c25
Clone exclusivity save/restore for tasks into back-deployment library
DougGregor Aug 30, 2021
1b57825
[exclusivity] Split out of Exclusivity.cpp FunctionReplacement and th…
gottesmm Jul 24, 2021
351d41b
Adjustments for the 5.5 branch
DougGregor Sep 17, 2021
4039218
[build] Add the flags to enable cross-compiling the corelibs
finagolfin Aug 31, 2020
d680f1d
[build-script] Use a toolchain file and always cross compile cmark.
gottesmm Jun 27, 2021
0516744
Adjustments for the 5.5 branch
DougGregor Sep 22, 2021
24d3a98
The concurrency compat library should not be unconditionally used in …
kubamracek Sep 22, 2021
9279139
Set CMake minimum version for back-deploy concurrency
edymtt Sep 16, 2021
c5aec28
Add magic symbols for concurrency.
varungandhi-apple Aug 31, 2021
ba13f9d
Extend and test install_name symbols for back-deployed concurrency.
DougGregor Sep 22, 2021
a6163be
[concurrency] Provide missing header file. (#37004)
3405691582 May 13, 2021
e491ccf
Avoid including "llvm/Config/config.h" in the concurrency back-deploy…
DougGregor Sep 23, 2021
5ecc094
Make sure we set configuration in back-deployed concurrency libraries.
DougGregor Sep 23, 2021
cfd87f4
build: repair the sub-build for libdispatch on Windows i686
compnerd Aug 30, 2021
fe15893
[cmark] Start always cross compiling cmark on Linux.
gottesmm Aug 4, 2021
214e517
[build-script] Begin tracking ar in build-script toolchains and start…
gottesmm May 21, 2021
24638e1
IRGen: Emit a weak reference to swift_async_extendedFramePointerFlags…
aschwaighofer Sep 23, 2021
12b7758
Use AvailabilityContext to check for concurrency availability
aschwaighofer Sep 23, 2021
581c1b1
Fix Python lint warning
DougGregor Sep 9, 2021
3f6852d
Fix Python linting/testing issues
DougGregor Aug 27, 2021
1009bbb
Fix some cherry-pick issues with the 5.5 branch
DougGregor Sep 24, 2021
b462ac1
[build-script] Add is_verbose support to cmake_product.
gottesmm Aug 4, 2021
dab326a
Most build products aren't "before build-script-impl"
DougGregor Sep 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,11 @@ else()
add_subdirectory(stdlib/toolchain)
endif()

if (BUILD_SWIFT_CONCURRENCY_BACK_DEPLOYMENT_LIBRARIES)
# Build the back-deployed concurrency library.
add_subdirectory(stdlib/public/BackDeployConcurrency)
endif()

# Some tools (e.g. swift-reflection-dump) rely on a host swiftReflection, so
# ensure we build that when building tools.
if(SWIFT_INCLUDE_TOOLS)
Expand Down
6 changes: 6 additions & 0 deletions cmake/modules/Libdispatch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ foreach(sdk ${DISPATCH_SDKS})
foreach(arch ${ARCHS})
set(LIBDISPATCH_VARIANT_NAME "libdispatch-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")

if(sdk MATCHES WINDOWS)
set(SWIFT_LIBDISPATCH_COMPILER_TRIPLE_CMAKE_ARGS -DCMAKE_C_COMPILER_TARGET=${SWIFT_SDK_WINDOWS_ARCH_${arch}_TRIPLE};-DCMAKE_CXX_COMPILER_TARGET=${SWIFT_SDK_WINDOWS_ARCH_${arch}_TRIPLE})
endif()


if(NOT sdk STREQUAL ANDROID)
set(SWIFT_LIBDISPATCH_SYSTEM_PROCESSOR -DCMAKE_SYSTEM_PROCESSOR=${arch})
endif()
Expand All @@ -80,6 +85,7 @@ foreach(sdk ${DISPATCH_SDKS})
-DCMAKE_AR=${CMAKE_AR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
${SWIFT_LIBDISPATCH_COMPILER_CMAKE_ARGS}
${SWIFT_LIBDISPATCH_COMPILER_TRIPLE_CMAKE_ARGS}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
Expand Down
5 changes: 4 additions & 1 deletion cmake/modules/SwiftComponents.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# The set of "defined" swift components are as follows:
#
# * autolink-driver -- the Swift driver support tools
# * back-deployment -- Swift back-deployment libraries
# * compiler -- the Swift compiler and (on supported platforms) the REPL.
# * clang-builtin-headers -- install a copy of Clang builtin headers under
# 'lib/swift/clang'. This is useful when Swift compiler is installed in
Expand All @@ -66,7 +67,7 @@
# * toolchain-dev-tools -- install development tools useful in a shared toolchain
# * dev -- headers and libraries required to use Swift compiler as a library.
set(_SWIFT_DEFINED_COMPONENTS
"autolink-driver;compiler;clang-builtin-headers;clang-resource-dir-symlink;clang-builtin-headers-in-clang-resource-dir;stdlib;stdlib-experimental;sdk-overlay;parser-lib;editor-integration;tools;testsuite-tools;toolchain-tools;toolchain-dev-tools;dev;license;sourcekit-xpc-service;sourcekit-inproc;swift-remote-mirror;swift-remote-mirror-headers")
"autolink-driver;back-deployment;compiler;clang-builtin-headers;clang-resource-dir-symlink;clang-builtin-headers-in-clang-resource-dir;stdlib;stdlib-experimental;sdk-overlay;parser-lib;editor-integration;tools;testsuite-tools;toolchain-tools;toolchain-dev-tools;dev;license;sourcekit-xpc-service;sourcekit-inproc;swift-remote-mirror;swift-remote-mirror-headers")

# The default install components include all of the defined components, except
# for the following exceptions.
Expand All @@ -85,6 +86,8 @@ else()
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "sourcekit-xpc-service")
endif()
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "stdlib-experimental")
# back-deployment libraries are opt-in
list(REMOVE_ITEM _SWIFT_DEFAULT_COMPONENTS "back-deployment")

macro(swift_configure_components)
# Set the SWIFT_INSTALL_COMPONENTS variable to the default value if it is not passed in via -D
Expand Down
8 changes: 8 additions & 0 deletions include/swift/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,9 @@ class ASTContext final {
/// Get the runtime availability of support for concurrency.
AvailabilityContext getConcurrencyAvailability();

/// Get the back-deployed availability for concurrency.
AvailabilityContext getBackDeployedConcurrencyAvailability();

/// Get the runtime availability of support for differentiation.
AvailabilityContext getDifferentiationAvailability();

Expand All @@ -750,6 +753,11 @@ class ASTContext final {
/// compiler for the target platform.
AvailabilityContext getSwift55Availability();

// Note: Update this function if you add a new getSwiftXYAvailability above.
/// Get the runtime availability for a particular version of Swift (5.0+).
AvailabilityContext
getSwift5PlusAvailability(llvm::VersionTuple swiftVersion);

/// Get the runtime availability of features that have been introduced in the
/// Swift compiler for future versions of the target platform.
AvailabilityContext getSwiftFutureAvailability();
Expand Down
4 changes: 4 additions & 0 deletions include/swift/AST/ASTMangler.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class ASTMangler : public Mangler {
/// to fill these in.
bool AllowSymbolicReferences = false;

/// If enabled, allows the use of standard substitutions for types in the
/// concurrency library.
bool AllowConcurrencyStandardSubstitutions = true;

public:
using SymbolicReferent = llvm::PointerUnion<const NominalTypeDecl *,
const OpaqueTypeDecl *>;
Expand Down
2 changes: 2 additions & 0 deletions include/swift/AST/IRGenOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ class IRGenOptions {
/// Pull in runtime compatibility shim libraries by autolinking.
Optional<llvm::VersionTuple> AutolinkRuntimeCompatibilityLibraryVersion;
Optional<llvm::VersionTuple> AutolinkRuntimeCompatibilityDynamicReplacementLibraryVersion;
Optional<llvm::VersionTuple>
AutolinkRuntimeCompatibilityConcurrencyLibraryVersion;

JITDebugArtifact DumpJIT = JITDebugArtifact::None;

Expand Down
7 changes: 6 additions & 1 deletion include/swift/Demangling/ManglingUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ char translateOperatorChar(char op);
std::string translateOperator(StringRef Op);

/// Returns the standard type kind for an 'S' substitution, e.g. 'i' for "Int".
llvm::Optional<StringRef> getStandardTypeSubst(StringRef TypeName);
///
/// \param allowConcurrencyManglings When true, allows the standard
/// substitutions for types in the _Concurrency module that were introduced in
/// Swift 5.5.
llvm::Optional<StringRef> getStandardTypeSubst(
StringRef TypeName, bool allowConcurrencyManglings);

/// Mangles an identifier using a generic Mangler class.
///
Expand Down
44 changes: 22 additions & 22 deletions include/swift/Demangling/StandardTypesMangling.def
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
/// STANDARD_TYPE(KIND, MANGLING, TYPENAME)
/// The 1-character MANGLING for a known TYPENAME of KIND.
///
/// STANDARD_TYPE_2(KIND, MANGLING, TYPENAME)
/// STANDARD_TYPE_CONCURRENCY(KIND, MANGLING, TYPENAME)
/// The 1-character MANGLING for a known TYPENAME of KIND that is in the
/// second level of standard types, all of which are mangled with the form
/// Sc<MANGLING>.
/// second level of standard types in the Concurrency model, all of which are
/// mangled with the form Sc<MANGLING>.
///
/// OBJC_INTEROP_STANDARD_TYPE(KIND, MANGLING, TYPENAME)
/// The 1-character MANGLING for a known TYPENAME of KIND, for a type that's
Expand Down Expand Up @@ -79,25 +79,25 @@ STANDARD_TYPE(Protocol, y, StringProtocol)
STANDARD_TYPE(Protocol, Z, SignedInteger)
STANDARD_TYPE(Protocol, z, BinaryInteger)

STANDARD_TYPE_2(Protocol, A, Actor)
STANDARD_TYPE_2(Structure, C, CheckedContinuation)
STANDARD_TYPE_2(Structure, c, UnsafeContinuation)
STANDARD_TYPE_2(Structure, E, CancellationError)
STANDARD_TYPE_2(Structure, e, UnownedSerialExecutor)
STANDARD_TYPE_2(Protocol, F, Executor)
STANDARD_TYPE_2(Protocol, f, SerialExecutor)
STANDARD_TYPE_2(Structure, G, TaskGroup)
STANDARD_TYPE_2(Structure, g, ThrowingTaskGroup)
STANDARD_TYPE_2(Protocol, I, AsyncIteratorProtocol)
STANDARD_TYPE_2(Protocol, i, AsyncSequence)
STANDARD_TYPE_2(Structure, J, UnownedJob)
STANDARD_TYPE_2(Class, M, MainActor)
STANDARD_TYPE_2(Structure, P, TaskPriority)
STANDARD_TYPE_2(Structure, S, AsyncStream)
STANDARD_TYPE_2(Structure, s, AsyncThrowingStream)
STANDARD_TYPE_2(Structure, T, Task)
STANDARD_TYPE_2(Structure, t, UnsafeCurrentTask)
STANDARD_TYPE_CONCURRENCY(Protocol, A, Actor)
STANDARD_TYPE_CONCURRENCY(Structure, C, CheckedContinuation)
STANDARD_TYPE_CONCURRENCY(Structure, c, UnsafeContinuation)
STANDARD_TYPE_CONCURRENCY(Structure, E, CancellationError)
STANDARD_TYPE_CONCURRENCY(Structure, e, UnownedSerialExecutor)
STANDARD_TYPE_CONCURRENCY(Protocol, F, Executor)
STANDARD_TYPE_CONCURRENCY(Protocol, f, SerialExecutor)
STANDARD_TYPE_CONCURRENCY(Structure, G, TaskGroup)
STANDARD_TYPE_CONCURRENCY(Structure, g, ThrowingTaskGroup)
STANDARD_TYPE_CONCURRENCY(Protocol, I, AsyncIteratorProtocol)
STANDARD_TYPE_CONCURRENCY(Protocol, i, AsyncSequence)
STANDARD_TYPE_CONCURRENCY(Structure, J, UnownedJob)
STANDARD_TYPE_CONCURRENCY(Class, M, MainActor)
STANDARD_TYPE_CONCURRENCY(Structure, P, TaskPriority)
STANDARD_TYPE_CONCURRENCY(Structure, S, AsyncStream)
STANDARD_TYPE_CONCURRENCY(Structure, s, AsyncThrowingStream)
STANDARD_TYPE_CONCURRENCY(Structure, T, Task)
STANDARD_TYPE_CONCURRENCY(Structure, t, UnsafeCurrentTask)

#undef STANDARD_TYPE
#undef OBJC_INTEROP_STANDARD_TYPE
#undef STANDARD_TYPE_2
#undef STANDARD_TYPE_CONCURRENCY
1 change: 1 addition & 0 deletions include/swift/Frontend/BackDeploymentLibs.def
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
BACK_DEPLOYMENT_LIB((5, 0), all, "swiftCompatibility50")
BACK_DEPLOYMENT_LIB((5, 1), all, "swiftCompatibility51")
BACK_DEPLOYMENT_LIB((5, 0), executable, "swiftCompatibilityDynamicReplacements")
BACK_DEPLOYMENT_LIB((5, 5), all, "swiftCompatibilityConcurrency")

#undef BACK_DEPLOYMENT_LIB
1 change: 0 additions & 1 deletion include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,6 @@ def type_info_dump_filter_EQ : Joined<["-"], "type-info-dump-filter=">,
Flags<[FrontendOption]>,
HelpText<"One of 'all', 'resilient' or 'fragile'">;


def emit_ldadd_cfile_path
: Separate<["-"], "emit-ldadd-cfile-path">, MetaVarName<"<path>">,
HelpText<"Generate .c file defining symbols to add back">;
Expand Down
6 changes: 6 additions & 0 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,12 @@ def disable_autolinking_runtime_compatibility_dynamic_replacements
HelpText<"Do not use autolinking for the dynamic replacement runtime "
"compatibility library">;

def disable_autolinking_runtime_compatibility_concurrency
: Flag<[ "-" ], "disable-autolinking-runtime-compatibility-concurrency">,
Flags<[ FrontendOption ]>,
HelpText<"Do not use autolinking for the concurrency runtime "
"compatibility library">;

def emit_symbol_graph: Flag<["-"], "emit-symbol-graph">,
Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput, HelpHidden]>,
HelpText<"Emit a symbol graph">;
Expand Down
26 changes: 7 additions & 19 deletions include/swift/Runtime/Exclusivity.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,6 @@ SWIFT_RUNTIME_EXPORT
void swift_beginAccess(void *pointer, ValueBuffer *buffer,
ExclusivityFlags flags, void *pc);

/// Loads the replacement function pointer from \p ReplFnPtr and returns the
/// replacement function if it should be called.
/// Returns null if the original function (which is passed in \p CurrFn) should
/// be called.
#ifdef __APPLE__
__attribute__((weak_import))
#endif
SWIFT_RUNTIME_EXPORT
char *swift_getFunctionReplacement(char **ReplFnPtr, char *CurrFn);

/// Returns the original function of a replaced function, which is loaded from
/// \p OrigFnPtr.
/// This function is called from a replacement function to call the original
/// function.
#ifdef __APPLE__
__attribute__((weak_import))
#endif
SWIFT_RUNTIME_EXPORT
char *swift_getOrigOfReplaceable(char **OrigFnPtr);

/// Stop dynamically tracking an access.
SWIFT_RUNTIME_EXPORT
Expand Down Expand Up @@ -91,6 +72,13 @@ void swift_dumpTrackedAccesses();

#endif

// When building the concurrency library for back deployment, we rename these
// symbols unformly so they don't conflict with the real concurrency library.
#ifdef SWIFT_CONCURRENCY_BACK_DEPLOYMENT
# define swift_task_enterThreadLocalContext swift_task_enterThreadLocalContextBackDeploy
# define swift_task_exitThreadLocalContext swift_task_exitThreadLocalContextBackDeploy
#endif

/// Called when a task inits, resumes and returns control to caller synchronous
/// code to update any exclusivity specific state associated with the task.
///
Expand Down
42 changes: 42 additions & 0 deletions include/swift/Runtime/FunctionReplacement.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//===--- FunctionReplacement.h --------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_RUNTIME_FUNCTIONREPLACEMENT_H
#define SWIFT_RUNTIME_FUNCTIONREPLACEMENT_H

#include "swift/Runtime/Config.h"

namespace swift {

/// Loads the replacement function pointer from \p ReplFnPtr and returns the
/// replacement function if it should be called.
/// Returns null if the original function (which is passed in \p CurrFn) should
/// be called.
#ifdef __APPLE__
__attribute__((weak_import))
#endif
SWIFT_RUNTIME_EXPORT char *
swift_getFunctionReplacement(char **ReplFnPtr, char *CurrFn);

/// Returns the original function of a replaced function, which is loaded from
/// \p OrigFnPtr.
/// This function is called from a replacement function to call the original
/// function.
#ifdef __APPLE__
__attribute__((weak_import))
#endif
SWIFT_RUNTIME_EXPORT char *
swift_getOrigOfReplaceable(char **OrigFnPtr);

} // namespace swift

#endif
18 changes: 18 additions & 0 deletions include/swift/Runtime/RuntimeFunctions.def
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,24 @@ FUNCTION(GetFunctionMetadataGlobalActor,
TypeMetadataPtrTy),
ATTRS(NoUnwind, ReadOnly))

// Metadata *
// swift_getFunctionTypeMetadataGlobalActorBackDeploy(unsigned long flags,
// unsigned long diffKind,
// const Metadata **parameters,
// const uint32_t *parameterFlags,
// const Metadata *result,
// const Metadata *globalActor);
FUNCTION(GetFunctionMetadataGlobalActorBackDeploy,
swift_getFunctionTypeMetadataGlobalActorBackDeploy,
C_CC, OpaqueTypeAvailability,
RETURNS(TypeMetadataPtrTy),
ARGS(SizeTy,
SizeTy,
TypeMetadataPtrTy->getPointerTo(0),
Int32Ty->getPointerTo(0),
TypeMetadataPtrTy,
TypeMetadataPtrTy),
ATTRS(NoUnwind, ReadOnly))

// Metadata *swift_getFunctionTypeMetadata0(unsigned long flags,
// const Metadata *resultMetadata);
Expand Down
3 changes: 2 additions & 1 deletion lib/AST/ASTMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2935,7 +2935,8 @@ bool ASTMangler::tryAppendStandardSubstitution(const GenericTypeDecl *decl) {
return false;

if (isa<NominalTypeDecl>(decl)) {
if (auto Subst = getStandardTypeSubst(decl->getName().str())) {
if (auto Subst = getStandardTypeSubst(
decl->getName().str(), AllowConcurrencyStandardSubstitutions)) {
if (!SubstMerging.tryMergeSubst(*this, *Subst, /*isStandardSubst*/ true)){
appendOperator("S", *Subst);
}
Expand Down
21 changes: 21 additions & 0 deletions lib/AST/Availability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ AvailabilityContext ASTContext::getConcurrencyAvailability() {
return getSwift55Availability();
}

AvailabilityContext ASTContext::getBackDeployedConcurrencyAvailability() {
return getSwift51Availability();
}

AvailabilityContext ASTContext::getDifferentiationAvailability() {
return getSwiftFutureAvailability();
}
Expand Down Expand Up @@ -446,3 +450,20 @@ AvailabilityContext ASTContext::getSwiftFutureAvailability() {
return AvailabilityContext::alwaysAvailable();
}
}

AvailabilityContext
ASTContext::getSwift5PlusAvailability(llvm::VersionTuple swiftVersion) {
if (swiftVersion.getMajor() == 5) {
switch (*swiftVersion.getMinor()) {
case 0: return getSwift50Availability();
case 1: return getSwift51Availability();
case 2: return getSwift52Availability();
case 3: return getSwift53Availability();
case 4: return getSwift54Availability();
case 5: return getSwift55Availability();
default: break;
}
}
llvm::report_fatal_error("Missing call to getSwiftXYAvailability for Swift " +
swiftVersion.getAsString());
}
Loading