Skip to content

Commit 1898b01

Browse files
committed
[Runtime] Rename ClientRetainRelease library to SwiftDirectRuntime.
This library will likely become home to other fast-path-in-client functions, so give it a more general name.
1 parent b01436d commit 1898b01

File tree

17 files changed

+89
-85
lines changed

17 files changed

+89
-85
lines changed

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,16 @@ option(SWIFT_BUILD_STDLIB_CXX_MODULE
271271
"If not building stdlib, controls whether to build the Cxx module"
272272
TRUE)
273273

274-
# The swiftClientRetainRelease library is currently only available for Darwin
274+
# The swiftSwiftDirectRuntime library is currently only available for Darwin
275275
# platforms.
276276
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
277277
# Off by default everywhere for now.
278-
option(SWIFT_BUILD_CLIENT_RETAIN_RELEASE
279-
"Build the swiftClientRetainRelease library"
278+
option(SWIFT_BUILD_SWIFT_DIRECT_RUNTIME
279+
"Build the swiftSwiftDirectRuntime library"
280280
FALSE)
281281
else()
282-
option(SWIFT_BUILD_CLIENT_RETAIN_RELEASE
283-
"Build the swiftClientRetainRelease library"
282+
option(SWIFT_BUILD_SWIFT_DIRECT_RUNTIME
283+
"Build the swiftSwiftDirectRuntime library"
284284
FALSE)
285285
endif()
286286

include/swift/AST/IRGenOptions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,8 @@ class IRGenOptions {
556556
// Whether to emit mergeable or non-mergeable traps.
557557
unsigned MergeableTraps : 1;
558558

559-
/// Enable the use of swift_retain/releaseClient functions.
560-
unsigned EnableClientRetainRelease : 1;
559+
/// Enable the use of swift_retain/releaseDirect functions.
560+
unsigned EnableSwiftDirectRuntime : 1;
561561

562562
/// The number of threads for multi-threaded code generation.
563563
unsigned NumThreads = 0;
@@ -686,7 +686,7 @@ class IRGenOptions {
686686
EmitAsyncFramePushPopMetadata(true), EmitTypeMallocForCoroFrame(true),
687687
AsyncFramePointerAll(false), UseProfilingMarkerThunks(false),
688688
UseCoroCCX8664(false), UseCoroCCArm64(false), MergeableTraps(false),
689-
EnableClientRetainRelease(false),
689+
EnableSwiftDirectRuntime(false),
690690
DebugInfoForProfiling(false), CmdArgs(),
691691
SanitizeCoverage(llvm::SanitizerCoverageOptions()),
692692
TypeInfoFilter(TypeInfoDumpFilter::All),

include/swift/Option/FrontendOptions.td

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,12 +1477,12 @@ def mergeable_traps :
14771477
Flag<["-"], "mergeable-traps">,
14781478
HelpText<"Emit mergeable traps even in optimized builds">;
14791479

1480-
def enable_client_retain_release :
1481-
Flag<["-"], "enable-client-retain-release">,
1482-
HelpText<"Enable use of swift_retain/releaseClient functions">;
1483-
def disable_client_retain_release :
1484-
Flag<["-"], "disable-client-retain-release">,
1485-
HelpText<"Disable use of swift_retain/releaseClient functions">;
1480+
def enable_direct_retain_release :
1481+
Flag<["-"], "enable-direct-retain-release">,
1482+
HelpText<"Enable use of swift_retain/releaseDirect functions">;
1483+
def disable_direct_retain_release :
1484+
Flag<["-"], "disable-direct-retain-release">,
1485+
HelpText<"Disable use of swift_retain/releaseDirect functions">;
14861486

14871487
def enable_new_llvm_pass_manager :
14881488
Flag<["-"], "enable-new-llvm-pass-manager">,

include/swift/Runtime/RuntimeFunctions.def

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ FUNCTION(NativeStrongRelease, Swift, swift_release, C_CC, AlwaysAvailable,
221221
UNKNOWN_MEMEFFECTS)
222222

223223
// void *swift_retain(void *ptr);
224-
FUNCTION(NativeStrongRetainClient, Swift, swift_retainClient, SwiftClientRR_CC, AlwaysAvailable,
224+
FUNCTION(NativeStrongRetainDirect, Swift, swift_retainDirect, SwiftDirectRR_CC, AlwaysAvailable,
225225
RETURNS(RefCountedPtrTy),
226226
ARGS(RefCountedPtrTy),
227227
ATTRS(NoUnwind, FirstParamReturned, WillReturn),
228228
EFFECT(RuntimeEffect::RefCounting),
229229
UNKNOWN_MEMEFFECTS)
230230

231231
// void swift_release(void *ptr);
232-
FUNCTION(NativeStrongReleaseClient, Swift, swift_releaseClient, SwiftClientRR_CC, AlwaysAvailable,
232+
FUNCTION(NativeStrongReleaseDirect, Swift, swift_releaseDirect, SwiftDirectRR_CC, AlwaysAvailable,
233233
RETURNS(VoidTy),
234234
ARGS(RefCountedPtrTy),
235235
ATTRS(NoUnwind),
@@ -436,18 +436,18 @@ FUNCTION(BridgeObjectStrongRelease, Swift, swift_bridgeObjectRelease,
436436
EFFECT(RuntimeEffect::RefCounting, RuntimeEffect::Deallocating),
437437
UNKNOWN_MEMEFFECTS)
438438

439-
// void *swift_bridgeObjectRetainClient(void *ptr);
440-
FUNCTION(BridgeObjectStrongRetainClient, Swift, swift_bridgeObjectRetainClient,
441-
SwiftClientRR_CC, AlwaysAvailable,
439+
// void *swift_bridgeObjectRetainDirect(void *ptr);
440+
FUNCTION(BridgeObjectStrongRetainDirect, Swift, swift_bridgeObjectRetainDirect,
441+
SwiftDirectRR_CC, AlwaysAvailable,
442442
RETURNS(BridgeObjectPtrTy),
443443
ARGS(BridgeObjectPtrTy),
444444
ATTRS(NoUnwind, FirstParamReturned),
445445
EFFECT(RuntimeEffect::RefCounting),
446446
UNKNOWN_MEMEFFECTS)
447447

448-
// void *swift_bridgeObjectReleaseClient(void *ptr);
449-
FUNCTION(BridgeObjectStrongReleaseClient, Swift, swift_bridgeObjectReleaseClient,
450-
SwiftClientRR_CC, AlwaysAvailable,
448+
// void *swift_bridgeObjectReleaseDirect(void *ptr);
449+
FUNCTION(BridgeObjectStrongReleaseDirect, Swift, swift_bridgeObjectReleaseDirect,
450+
SwiftDirectRR_CC, AlwaysAvailable,
451451
RETURNS(VoidTy),
452452
ARGS(BridgeObjectPtrTy),
453453
ATTRS(NoUnwind),

lib/Frontend/CompilerInvocation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3993,10 +3993,10 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
39933993

39943994
Opts.MergeableTraps = Args.hasArg(OPT_mergeable_traps);
39953995

3996-
Opts.EnableClientRetainRelease =
3997-
Args.hasFlag(OPT_enable_client_retain_release,
3998-
OPT_disable_client_retain_release,
3999-
Opts.EnableClientRetainRelease);
3996+
Opts.EnableSwiftDirectRuntime =
3997+
Args.hasFlag(OPT_enable_direct_retain_release,
3998+
OPT_disable_direct_retain_release,
3999+
Opts.EnableSwiftDirectRuntime);
40004000

40014001
Opts.EnableObjectiveCProtocolSymbolicReferences =
40024002
Args.hasFlag(OPT_enable_objective_c_protocol_symbolic_references,

lib/IRGen/GenHeap.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -999,9 +999,9 @@ void IRGenFunction::emitNativeStrongRetain(llvm::Value *value,
999999
// Emit the call.
10001000
FunctionPointer function;
10011001
if (atomicity == Atomicity::Atomic &&
1002-
IGM.TargetInfo.HasSwiftClientRRLibrary &&
1003-
getOptions().EnableClientRetainRelease)
1004-
function = IGM.getNativeStrongRetainClientFunctionPointer();
1002+
IGM.TargetInfo.HasSwiftSwiftDirectRuntimeLibrary &&
1003+
getOptions().EnableSwiftDirectRuntime)
1004+
function = IGM.getNativeStrongRetainDirectFunctionPointer();
10051005
else if (atomicity == Atomicity::Atomic)
10061006
function = IGM.getNativeStrongRetainFunctionPointer();
10071007
else
@@ -1264,9 +1264,9 @@ void IRGenFunction::emitNativeStrongRelease(llvm::Value *value,
12641264
return;
12651265
llvm::Constant *function;
12661266
if (atomicity == Atomicity::Atomic &&
1267-
IGM.TargetInfo.HasSwiftClientRRLibrary &&
1268-
getOptions().EnableClientRetainRelease)
1269-
function = IGM.getNativeStrongReleaseClientFn();
1267+
IGM.TargetInfo.HasSwiftSwiftDirectRuntimeLibrary &&
1268+
getOptions().EnableSwiftDirectRuntime)
1269+
function = IGM.getNativeStrongReleaseDirectFn();
12701270
else if (atomicity == Atomicity::Atomic)
12711271
function = IGM.getNativeStrongReleaseFn();
12721272
else
@@ -1366,9 +1366,9 @@ void IRGenFunction::emitBridgeStrongRetain(llvm::Value *value,
13661366
Atomicity atomicity) {
13671367
llvm::Constant *function;
13681368
if (atomicity == Atomicity::Atomic &&
1369-
IGM.TargetInfo.HasSwiftClientRRLibrary &&
1370-
getOptions().EnableClientRetainRelease)
1371-
function = IGM.getBridgeObjectStrongRetainClientFn();
1369+
IGM.TargetInfo.HasSwiftSwiftDirectRuntimeLibrary &&
1370+
getOptions().EnableSwiftDirectRuntime)
1371+
function = IGM.getBridgeObjectStrongRetainDirectFn();
13721372
else if (atomicity == Atomicity::Atomic)
13731373
function = IGM.getBridgeObjectStrongRetainFn();
13741374
else
@@ -1380,9 +1380,9 @@ void IRGenFunction::emitBridgeStrongRelease(llvm::Value *value,
13801380
Atomicity atomicity) {
13811381
llvm::Constant *function;
13821382
if (atomicity == Atomicity::Atomic &&
1383-
IGM.TargetInfo.HasSwiftClientRRLibrary &&
1384-
getOptions().EnableClientRetainRelease)
1385-
function = IGM.getBridgeObjectStrongReleaseClientFn();
1383+
IGM.TargetInfo.HasSwiftSwiftDirectRuntimeLibrary &&
1384+
getOptions().EnableSwiftDirectRuntime)
1385+
function = IGM.getBridgeObjectStrongReleaseDirectFn();
13861386
else if (atomicity == Atomicity::Atomic)
13871387
function = IGM.getBridgeObjectStrongReleaseFn();
13881388
else

lib/IRGen/IRGenModule.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
566566
DereferenceableID = getLLVMContext().getMDKindID("dereferenceable");
567567

568568
C_CC = getOptions().PlatformCCallingConvention;
569-
SwiftClientRR_CC = llvm::CallingConv::PreserveMost;
569+
SwiftDirectRR_CC = llvm::CallingConv::PreserveMost;
570570
// TODO: use "tinycc" on platforms that support it
571571
DefaultCC = SWIFT_DEFAULT_LLVM_CC;
572572

@@ -1733,9 +1733,9 @@ void IRGenModule::addLinkLibraries() {
17331733
registerLinkLibrary(
17341734
LinkLibrary{"objc", LibraryKind::Library, /*static=*/false});
17351735

1736-
if (TargetInfo.HasSwiftClientRRLibrary &&
1737-
getOptions().EnableClientRetainRelease)
1738-
registerLinkLibrary(LinkLibrary{"swiftClientRetainRelease",
1736+
if (TargetInfo.HasSwiftSwiftDirectRuntimeLibrary &&
1737+
getOptions().EnableSwiftDirectRuntime)
1738+
registerLinkLibrary(LinkLibrary{"swiftSwiftDirectRuntime",
17391739
LibraryKind::Library, /*static=*/true});
17401740

17411741
// If C++ interop is enabled, add -lc++ on Darwin and -lstdc++ on linux.

lib/IRGen/IRGenModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ class IRGenModule {
921921
llvm::CallingConv::ID SwiftCC; /// swift calling convention
922922
llvm::CallingConv::ID SwiftAsyncCC; /// swift calling convention for async
923923
llvm::CallingConv::ID SwiftCoroCC; /// swift calling convention for callee-allocated coroutines
924-
llvm::CallingConv::ID SwiftClientRR_CC; /// swift client retain/release calling convention
924+
llvm::CallingConv::ID SwiftDirectRR_CC; /// swift direct retain/release calling convention
925925

926926
/// What kind of tail call should be used for async->async calls.
927927
llvm::CallInst::TailCallKind AsyncTailCallKind;

lib/IRGen/SwiftTargetInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ static void configureARM64(IRGenModule &IGM, const llvm::Triple &triple,
7171
// half for the kernel.
7272
target.SwiftRetainIgnoresNegativeValues = true;
7373

74-
// ARM64 Darwin has swiftClientRetainRelease, but not in Embedded mode. JIT
74+
// ARM64 Darwin has swiftSwiftDirectRuntime, but not in Embedded mode. JIT
7575
// mode can't load the static library, so disable it there as well.
7676
if (triple.isOSDarwin() &&
7777
!IGM.getSwiftModule()->getASTContext().LangOpts.hasFeature(
7878
Feature::Embedded) &&
7979
!IGM.getOptions().UseJIT)
80-
target.HasSwiftClientRRLibrary = true;
80+
target.HasSwiftSwiftDirectRuntimeLibrary = true;
8181

8282
target.UsableSwiftAsyncContextAddrIntrinsic = true;
8383
}

lib/IRGen/SwiftTargetInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ class SwiftTargetInfo {
114114
/// "negative" pointer values.
115115
bool SwiftRetainIgnoresNegativeValues = false;
116116

117-
/// True if the swiftClientRetainRelease static library is available.
118-
bool HasSwiftClientRRLibrary = false;
117+
/// True if the swiftSwiftDirectRuntime static library is available.
118+
bool HasSwiftSwiftDirectRuntimeLibrary = false;
119119

120120
bool UsableSwiftAsyncContextAddrIntrinsic = false;
121121
};

0 commit comments

Comments
 (0)