Skip to content

Subsume SWIFT_STDLIB_USE_NONATOMIC_RC into SWIFT_STDLIB_SINGLE_THREADED_RUNTIME #33643

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 1 commit into from
Aug 27, 2020
Merged
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
10 changes: 1 addition & 9 deletions stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,10 @@ option(SWIFT_RUNTIME_MACHO_NO_DYLD
"Build stdlib assuming the runtime environment uses Mach-O but does not support dynamic modules."
FALSE)

option(SWIFT_STDLIB_USE_NONATOMIC_RC
"Build the standard libraries and overlays with nonatomic reference count operations enabled"
FALSE)

option(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME
"Build the standard libraries assuming that they will be used in an environment with only a single thread. If set, also forces SWIFT_STDLIB_USE_NONATOMIC_RC to On."
"Build the standard libraries assuming that they will be used in an environment with only a single thread."
FALSE)

if(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME)
set(SWIFT_STDLIB_USE_NONATOMIC_RC TRUE)
endif()

#
# End of user-configurable options.
#
Expand Down
4 changes: 0 additions & 4 deletions stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,6 @@ function(_add_target_variant_c_compile_flags)
list(APPEND result "-DSWIFT_RUNTIME_MACHO_NO_DYLD")
endif()

if(SWIFT_STDLIB_USE_NONATOMIC_RC)
list(APPEND result "-DSWIFT_STDLIB_USE_NONATOMIC_RC")
endif()

if(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME)
list(APPEND result "-DSWIFT_STDLIB_SINGLE_THREADED_RUNTIME")
endif()
Expand Down
2 changes: 1 addition & 1 deletion stdlib/cmake/modules/SwiftSource.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ function(_compile_swift_files
list(APPEND swift_flags "-enable-library-evolution")
endif()

if(SWIFT_STDLIB_USE_NONATOMIC_RC)
if(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME)
list(APPEND swift_flags "-Xfrontend" "-assume-single-threaded")
endif()

Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/runtime/MetadataImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ template <class Impl, class T> struct RetainableBoxBase {
static constexpr size_t stride = sizeof(T);
static constexpr bool isPOD = false;
static constexpr bool isBitwiseTakable = true;
#ifdef SWIFT_STDLIB_USE_NONATOMIC_RC
#ifdef SWIFT_STDLIB_SINGLE_THREADED_RUNTIME
static constexpr bool isAtomic = false;
#else
static constexpr bool isAtomic = true;
Expand Down
4 changes: 2 additions & 2 deletions test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ if "@SWIFT_AST_VERIFIER@" == "TRUE":
if "@SWIFT_OPTIMIZED@" == "TRUE":
config.available_features.add("optimized_stdlib")

if "@SWIFT_STDLIB_USE_NONATOMIC_RC@" == "TRUE":
config.available_features.add("nonatomic_rc")
if "@SWIFT_STDLIB_SINGLE_THREADED_RUNTIME@" == "TRUE":
config.available_features.add("single_threaded_runtime")

if "@SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS@" == "TRUE":
config.available_features.add('runtime_function_counters')
Expand Down
15 changes: 0 additions & 15 deletions utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,6 @@ skip-test-ios-simulator
skip-test-tvos-simulator
skip-test-watchos-simulator

[preset: buildbot,tools=RA,stdlib=RD,single-thread]
mixin-preset=
mixin_buildbot_tools_RA_stdlib_RD

dash-dash

# Enable non-atomic build of the stdlib
swift-stdlib-use-nonatomic-rc=true

# Don't run host tests for iOS, tvOS and watchOS platforms to make the build
# faster.
skip-test-ios-host
skip-test-tvos-host
skip-test-watchos-host

[preset: buildbot,tools=R,stdlib=RD]
mixin-preset=
mixin_buildbot_tools_R_stdlib_RD
Expand Down
2 changes: 0 additions & 2 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ KNOWN_SETTINGS=(
swift-primary-variant-sdk "" "default SDK for target binaries"
swift-runtime-enable-leak-checker "0" "Enable leaks checking routines in the runtime"
swift-stdlib-enable-assertions "1" "enable assertions in Swift"
swift-stdlib-use-nonatomic-rc "0" "build the Swift stdlib and overlays with nonatomic reference count operations enabled"
swift-tools-enable-lto "" "enable LTO compilation of Swift tools. *NOTE* This does not include the swift standard library and runtime. Must be set to one of 'thin' or 'full'"
extra-swift-args "" "Extra arguments to pass to swift modules which match regex. Assumed to be a flattened cmake list consisting of [module_regexp, args, module_regexp, args, ...]"
report-statistics "0" "set to 1 to generate compilation statistics files for swift libraries"
Expand Down Expand Up @@ -1755,7 +1754,6 @@ for host in "${ALL_HOSTS[@]}"; do
-DSWIFT_ANALYZE_CODE_COVERAGE:STRING=$(toupper "${SWIFT_ANALYZE_CODE_COVERAGE}")
-DSWIFT_STDLIB_BUILD_TYPE:STRING="${SWIFT_STDLIB_BUILD_TYPE}"
-DSWIFT_STDLIB_ASSERTIONS:BOOL=$(true_false "${SWIFT_STDLIB_ENABLE_ASSERTIONS}")
-DSWIFT_STDLIB_USE_NONATOMIC_RC:BOOL=$(true_false "${SWIFT_STDLIB_USE_NONATOMIC_RC}")
-DSWIFT_ENABLE_COMPATIBILITY_OVERRIDES:BOOL=$(true_false "${SWIFT_ENABLE_COMPATIBILITY_OVERRIDES}")
-DSWIFT_STDLIB_SINGLE_THREADED_RUNTIME:BOOL=$(true_false "${SWIFT_STDLIB_SINGLE_THREADED_RUNTIME}")
-DSWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS:BOOL=$(true_false "${SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS}")
Expand Down
2 changes: 1 addition & 1 deletion validation-test/Runtime/weak-reference-racetests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %target-run-simple-swift
// REQUIRES: executable_test
// REQUIRES: stress_test
// UNSUPPORTED: nonatomic_rc
// UNSUPPORTED: single_threaded_runtime

import StdlibUnittest

Expand Down
2 changes: 1 addition & 1 deletion validation-test/SILOptimizer/string_switch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
// REQUIRES: stress_test
// REQUIRES: executable_test
// UNSUPPORTED: nonatomic_rc
// UNSUPPORTED: single_threaded_runtime

import StdlibUnittest

Expand Down
2 changes: 1 addition & 1 deletion validation-test/StdlibUnittest/AtomicInt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// RUN: %target-run %t.out
// REQUIRES: executable_test
// REQUIRES: stress_test
// UNSUPPORTED: nonatomic_rc
// UNSUPPORTED: single_threaded_runtime

import SwiftPrivate
import StdlibUnittest
Expand Down
2 changes: 1 addition & 1 deletion validation-test/StdlibUnittest/RaceTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %target-build-swift -Xfrontend -disable-access-control -module-name a %s -o %t.out
// RUN: %target-run %t.out | %FileCheck %s
// REQUIRES: stress_test
// UNSUPPORTED: nonatomic_rc
// UNSUPPORTED: single_threaded_runtime

import SwiftPrivate
import StdlibUnittest
Expand Down
4 changes: 2 additions & 2 deletions validation-test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ if "@SWIFT_OPTIMIZED@" == "TRUE":
if "@SWIFT_ENABLE_SOURCEKIT_TESTS@" == "TRUE":
config.available_features.add('sourcekit')

if "@SWIFT_STDLIB_USE_NONATOMIC_RC@" == "TRUE":
config.available_features.add("nonatomic_rc")
if "@SWIFT_STDLIB_SINGLE_THREADED_RUNTIME@" == "TRUE":
config.available_features.add("single_threaded_runtime")

if "@SWIFT_BUILT_STANDALONE@" == "TRUE":
config.available_features.add('standalone_build')
Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/ArrayBridging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// REQUIRES: objc_interop
// REQUIRES: executable_test
// REQUIRES: stress_test
// UNSUPPORTED: nonatomic_rc
// UNSUPPORTED: single_threaded_runtime

import StdlibUnittest
import Foundation
Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/CommandLine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// RUN: %target-run %t/CommandLineStressTest foo bar baz qux quux corge grault garply waldo fred plugh xyzzy and thud
// REQUIRES: executable_test
// REQUIRES: stress_test
// UNSUPPORTED: nonatomic_rc
// UNSUPPORTED: single_threaded_runtime

// This file is an empty stub to call into the command line stress test which
// houses `main`.
2 changes: 1 addition & 1 deletion validation-test/stdlib/DictionaryBridging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// REQUIRES: stress_test

// REQUIRES: objc_interop
// UNSUPPORTED: nonatomic_rc
// UNSUPPORTED: single_threaded_runtime

import StdlibUnittest
import Foundation
Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/ErrorProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// REQUIRES: executable_test
// REQUIRES: stress_test
// REQUIRES: objc_interop
// UNSUPPORTED: nonatomic_rc
// UNSUPPORTED: single_threaded_runtime

import SwiftPrivate
import StdlibUnittest
Expand Down