Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,10 @@ option(SWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION
"Enable experimental SwiftParser validation by default"
FALSE)

option(SWIFT_ENABLE_DIRECT_RETAIN_RELEASE
"Enable use of direct refcounting calls by default"
FALSE)

cmake_dependent_option(SWIFT_BUILD_SOURCEKIT
"Build SourceKit" TRUE
"SWIFT_ENABLE_DISPATCH" FALSE)
Expand Down
4 changes: 2 additions & 2 deletions include/swift/AST/IRGenOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ class IRGenOptions {
unsigned MergeableTraps : 1;

/// Enable the use of swift_retain/releaseDirect functions.
unsigned EnableSwiftDirectRuntime : 1;
unsigned EnableSwiftDirectRetainRelease : 1;

/// The number of threads for multi-threaded code generation.
unsigned NumThreads = 0;
Expand Down Expand Up @@ -689,7 +689,7 @@ class IRGenOptions {
EmitAsyncFramePushPopMetadata(true), EmitTypeMallocForCoroFrame(true),
AsyncFramePointerAll(false), UseProfilingMarkerThunks(false),
UseCoroCCX8664(false), UseCoroCCArm64(false), MergeableTraps(false),
EnableSwiftDirectRuntime(false),
EnableSwiftDirectRetainRelease(SWIFT_ENABLE_DIRECT_RETAIN_RELEASE),
DebugInfoForProfiling(false), CmdArgs(),
SanitizeCoverage(llvm::SanitizerCoverageOptions()),
TypeInfoFilter(TypeInfoDumpFilter::All),
Expand Down
2 changes: 2 additions & 0 deletions include/swift/Config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@

#cmakedefine01 SWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION

#cmakedefine01 SWIFT_ENABLE_DIRECT_RETAIN_RELEASE

#endif // SWIFT_CONFIG_H
4 changes: 2 additions & 2 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4034,10 +4034,10 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,

Opts.MergeableTraps = Args.hasArg(OPT_mergeable_traps);

Opts.EnableSwiftDirectRuntime =
Opts.EnableSwiftDirectRetainRelease =
Args.hasFlag(OPT_enable_direct_retain_release,
OPT_disable_direct_retain_release,
Opts.EnableSwiftDirectRuntime);
Opts.EnableSwiftDirectRetainRelease);

Opts.EnableObjectiveCProtocolSymbolicReferences =
Args.hasFlag(OPT_enable_objective_c_protocol_symbolic_references,
Expand Down
8 changes: 4 additions & 4 deletions lib/IRGen/GenHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ void IRGenFunction::emitNativeStrongRetain(llvm::Value *value,
FunctionPointer function;
if (atomicity == Atomicity::Atomic &&
IGM.TargetInfo.HasSwiftSwiftDirectRuntimeLibrary &&
getOptions().EnableSwiftDirectRuntime)
getOptions().EnableSwiftDirectRetainRelease)
function = IGM.getNativeStrongRetainDirectFunctionPointer();
else if (atomicity == Atomicity::Atomic)
function = IGM.getNativeStrongRetainFunctionPointer();
Expand Down Expand Up @@ -1265,7 +1265,7 @@ void IRGenFunction::emitNativeStrongRelease(llvm::Value *value,
llvm::Constant *function;
if (atomicity == Atomicity::Atomic &&
IGM.TargetInfo.HasSwiftSwiftDirectRuntimeLibrary &&
getOptions().EnableSwiftDirectRuntime)
getOptions().EnableSwiftDirectRetainRelease)
function = IGM.getNativeStrongReleaseDirectFn();
else if (atomicity == Atomicity::Atomic)
function = IGM.getNativeStrongReleaseFn();
Expand Down Expand Up @@ -1373,7 +1373,7 @@ void IRGenFunction::emitBridgeStrongRetain(llvm::Value *value,
llvm::Constant *function;
if (atomicity == Atomicity::Atomic &&
IGM.TargetInfo.HasSwiftSwiftDirectRuntimeLibrary &&
getOptions().EnableSwiftDirectRuntime)
getOptions().EnableSwiftDirectRetainRelease)
function = IGM.getBridgeObjectStrongRetainDirectFn();
else if (atomicity == Atomicity::Atomic)
function = IGM.getBridgeObjectStrongRetainFn();
Expand All @@ -1387,7 +1387,7 @@ void IRGenFunction::emitBridgeStrongRelease(llvm::Value *value,
llvm::Constant *function;
if (atomicity == Atomicity::Atomic &&
IGM.TargetInfo.HasSwiftSwiftDirectRuntimeLibrary &&
getOptions().EnableSwiftDirectRuntime)
getOptions().EnableSwiftDirectRetainRelease)
function = IGM.getBridgeObjectStrongReleaseDirectFn();
else if (atomicity == Atomicity::Atomic)
function = IGM.getBridgeObjectStrongReleaseFn();
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/IRGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ void IRGenModule::addLinkLibraries() {
LinkLibrary{"objc", LibraryKind::Library, /*static=*/false});

if (TargetInfo.HasSwiftSwiftDirectRuntimeLibrary &&
getOptions().EnableSwiftDirectRuntime)
getOptions().EnableSwiftDirectRetainRelease)
registerLinkLibrary(LinkLibrary{"swiftSwiftDirectRuntime",
LibraryKind::Library, /*static=*/true});

Expand Down