Skip to content

Commit 128257f

Browse files
committed
Consistently use dlsym for finding global-actor-qualified function builder
1 parent 5b027ca commit 128257f

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

stdlib/toolchain/CompatibilityConcurrency/CompatibilityConcurrency.cpp

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,6 @@ using namespace swift;
2020

2121
namespace swift {
2222

23-
// Entrypoint provided by the runtime in the OS that first contains support for
24-
// concurrency. Explicitly redeclared as "weak" because this code will run on
25-
// systems where it is not present.
26-
const FunctionTypeMetadata *
27-
swift_getFunctionTypeMetadataGlobalActor(
28-
FunctionTypeFlags flags, FunctionMetadataDifferentiabilityKind diffKind,
29-
const Metadata *const *parameters, const uint32_t *parameterFlags,
30-
const Metadata *result, const Metadata *globalActor
31-
) SWIFT_RUNTIME_WEAK_IMPORT;
32-
33-
// Entrypoint provided only in the back-deployed concurrency library, which
34-
// has a separate allocation area for global-actor-qualified function types.
35-
extern "C"
36-
const FunctionTypeMetadata *
37-
swift_getFunctionTypeMetadataGlobalActorStandalone(
38-
FunctionTypeFlags flags, FunctionMetadataDifferentiabilityKind diffKind,
39-
const Metadata *const *parameters, const uint32_t *parameterFlags,
40-
const Metadata *result, const Metadata *globalActor
41-
) SWIFT_RUNTIME_WEAK_IMPORT;
42-
4323
// Entrypoint called by the compiler when back-deploying concurrency, which
4424
// switches between the real implementation of
4525
// swift_getFunctionTypeMetadataGlobalActor and
@@ -66,10 +46,11 @@ swift::swift_getFunctionTypeMetadataGlobalActorBackDeploy(
6646
static BuilderFn builderFn;
6747
static dispatch_once_t builderToken;
6848
dispatch_once(&builderToken, ^{
69-
if (swift_getFunctionTypeMetadataGlobalActor) {
70-
builderFn = swift_getFunctionTypeMetadataGlobalActor;
49+
// Prefer the function from the Swift runtime if it is available.
50+
builderFn = reinterpret_cast<BuilderFn>(
51+
dlsym(RTLD_DEFAULT, "swift_getFunctionTypeMetadataGlobalActor"));
52+
if (builderFn)
7153
return;
72-
}
7354

7455
builderFn = reinterpret_cast<BuilderFn>(
7556
dlsym(RTLD_DEFAULT,

0 commit comments

Comments
 (0)