Skip to content

Commit b58818f

Browse files
authored
To be able to correctly exercise Concurrency on freestanding, default to using 'pthread' threading package (#65329)
To be able to correctly exercise Concurrency on freestanding, default to using 'pthread' threading package rdar://102259828
1 parent 1c3667b commit b58818f

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

stdlib/public/runtime/MetadataCache.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ class LockingConcurrentMapStorage {
174174
// TargetGenericMetadataInstantiationCache::PrivateData. On 32-bit archs, that
175175
// space is not large enough to accommodate a Mutex along with everything
176176
// else. There, use a SmallMutex to squeeze into the available space.
177-
using MutexTy = std::conditional_t<sizeof(void *) == 8, Mutex, SmallMutex>;
177+
using MutexTy = std::conditional_t<sizeof(void *) == 8 && sizeof(Mutex) <= 56,
178+
Mutex, SmallMutex>;
178179
StableAddressConcurrentReadableHashMap<EntryType,
179180
TaggedMetadataAllocator<Tag>, MutexTy>
180181
Map;

test/Concurrency/Runtime/actor_counters_freestanding.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
// REQUIRES: concurrency
55
// REQUIRES: freestanding
66

7-
// rdar://101938326
8-
// UNSUPPORTED: freestanding
9-
107
// rdar://76038845
118
// REQUIRES: concurrency_runtime
129
// UNSUPPORTED: back_deployment_runtime

utils/build-presets.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2603,7 +2603,7 @@ swift-stdlib-enable-vector-types=0
26032603
swift-stdlib-experimental-hermetic-seal-at-link=1
26042604
swift-stdlib-disable-instantiation-caches=1
26052605
swift-stdlib-has-type-printing=0
2606-
swift-threading-package=none
2606+
swift-threading-package=pthreads
26072607
build-swift-stdlib-unicode-data=0
26082608
build-swift-stdlib-static-print=1
26092609
darwin-crash-reporter-client=0

utils/check_freestanding_dependencies.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@
4040
"_log2l", "_logf", "_logl", "_nearbyintl", "_remainder", "_remainderf",
4141
"_remainderl", "_rintl", "_roundl", "_sin", "_sinf", "_sinl", "_truncl",
4242
]
43+
threading_package_dependencies = [
44+
"_pthread_mutex_destroy", "_pthread_cond_broadcast",
45+
"_pthread_get_stacksize_np", "_pthread_key_create", "_pthread_self",
46+
"_pthread_equal", "_pthread_mutex_lock", "_pthread_getspecific",
47+
"_pthread_mutex_unlock", "_pthread_cond_wait", "_pthread_setspecific",
48+
"_pthread_get_stackaddr_np"
49+
]
4350
common_expected_dependencies = [
4451
"___bzero", "___divti3", "___error", "___stderrp", "___stdoutp",
4552
"___truncsfhf2", "___udivti3", "_abort", "_arc4random_buf",
@@ -97,7 +104,8 @@
97104
print("Error: Required dependency '{}' missing".format(symbol))
98105
fail = True
99106

100-
allowlist = set(common_expected_dependencies + vendor_specific_dependencies)
107+
allowlist = set(common_expected_dependencies + vendor_specific_dependencies +
108+
threading_package_dependencies)
101109
for symbol in deps:
102110
if symbol not in allowlist:
103111
print("Error: Unexpected dependency '{}'".format(symbol))

0 commit comments

Comments
 (0)