Skip to content

Commit 9a208ae

Browse files
Merge pull request #5423 from swiftwasm/release/5.8
[pull] swiftwasm-release/5.8 from release/5.8
2 parents 4a98bfb + f1d2768 commit 9a208ae

File tree

9 files changed

+91
-19
lines changed

9 files changed

+91
-19
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ set(SWIFT_ANALYZE_CODE_COVERAGE FALSE CACHE STRING
268268
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
269269
# can be reused when a new version of Swift comes out (assuming the user hasn't
270270
# manually set it as part of their own CMake configuration).
271-
set(SWIFT_VERSION "5.8")
271+
set(SWIFT_VERSION "5.8.1")
272272

273273
set(SWIFT_VENDOR "" CACHE STRING
274274
"The vendor name of the Swift compiler")

include/swift/Basic/TaggedUnion.h

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,24 @@ class TaggedUnionBase<KindHelper, Members,
5757

5858
TaggedUnionBase(Kind theKind) : TheKind(theKind) {}
5959

60+
template <typename T>
61+
static constexpr const bool constructible =
62+
TaggedUnionImpl::is_member_constructible<Members, T>();
63+
6064
public:
6165
/// Construct the union with a value of the given type, which must
6266
/// (ignoring references) be one of the declared members of the union.
6367
template <class T>
6468
TaggedUnionBase(T &&value,
65-
typename std::enable_if<
66-
TaggedUnionImpl::is_member_constructible<Members, T>(),
67-
TaggedUnionImpl::Empty>::type = {}) {
69+
typename std::enable_if<constructible<T>,
70+
TaggedUnionImpl::Empty>::type = {}) {
6871
using TargetType = TaggedUnionImpl::simplify_member_type<T>;
6972
TheKind = StorageType::template kindForMember<TargetType>();
7073
Storage.template emplace<TargetType>(TheKind, std::forward<T>(value));
7174
}
7275

7376
template <class T>
74-
typename std::enable_if<TaggedUnionImpl::is_member_constructible<Members, T>(),
75-
TaggedUnionBase &>::type
77+
typename std::enable_if<constructible<T>, TaggedUnionBase &>::type
7678
operator=(T &&value) {
7779
using TargetType = TaggedUnionImpl::simplify_member_type<T>;
7880
TheKind = StorageType::template kindForMember<TargetType>();
@@ -155,12 +157,15 @@ class TaggedUnionBase<KindHelper, Members, /*NonTrivial*/ true, /*HasVoid*/ fals
155157

156158
TaggedUnionBase(typename super::Kind kind) : super(kind) {}
157159

160+
template <typename T>
161+
static constexpr const bool constructible =
162+
TaggedUnionImpl::is_member_constructible<Members, T>();
163+
158164
public:
159165
template <class T>
160166
TaggedUnionBase(T &&value,
161-
typename std::enable_if<
162-
TaggedUnionImpl::is_member_constructible<Members, T>(),
163-
TaggedUnionImpl::Empty>::type = {})
167+
typename std::enable_if<constructible<T>,
168+
TaggedUnionImpl::Empty>::type = {})
164169
: super(std::forward<T>(value)) {}
165170

166171
// We want to either define or delete all the special members.
@@ -236,12 +241,15 @@ class TaggedUnionBase<KindHelper, Members, NonTrivial, /*HasVoid*/ true>
236241
return super::StorageType::template kindForMember<void>();
237242
}
238243

244+
template <typename T>
245+
static constexpr const bool constructible =
246+
TaggedUnionImpl::is_member_constructible<Members, T>();
247+
239248
public:
240249
template <class T>
241250
TaggedUnionBase(T &&value,
242-
typename std::enable_if<
243-
TaggedUnionImpl::is_member_constructible<Members, T>(),
244-
TaggedUnionImpl::Empty>::type = {})
251+
typename std::enable_if<constructible<T>,
252+
TaggedUnionImpl::Empty>::type = {})
245253
: super(std::forward<T>(value)) {}
246254

247255
/// Construct the union in the empty state.

stdlib/public/runtime/WeakReference.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,9 @@ class WeakReference {
175175
HeapObject *nativeTakeStrongFromBits(WeakReferenceBits bits) {
176176
auto side = bits.getNativeOrNull();
177177
if (side) {
178+
auto obj = side->tryRetain();
178179
side->decrementWeak();
179-
return side->tryRetain();
180+
return obj;
180181
} else {
181182
return nullptr;
182183
}

stdlib/toolchain/Compatibility56/Concurrency/Actor.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#include "swift/Runtime/Casting.h"
99
#include "Runtime/Threading/ThreadLocal.h"
1010

11+
#include <Availability.h>
12+
#include <TargetConditionals.h>
13+
1114
#include <atomic>
1215
#include <new>
1316

@@ -146,3 +149,47 @@ void swift::adoptTaskVoucher(AsyncTask *task) {
146149
void swift::restoreTaskVoucher(AsyncTask *task) {
147150
ExecutorTrackingInfo::current()->restoreVoucher(task);
148151
}
152+
153+
static swift_once_t voucherDisableCheckOnce;
154+
static bool vouchersDisabled;
155+
156+
namespace {
157+
struct _SwiftNSOperatingSystemVersion{
158+
intptr_t majorVersion;
159+
intptr_t minorVersion;
160+
intptr_t patchVersion;
161+
};
162+
}
163+
164+
extern "C"
165+
_SwiftNSOperatingSystemVersion
166+
_swift_stdlib_operatingSystemVersion() __attribute__((const));
167+
168+
static void _initializeVouchersDisabled(void *ctxt) {
169+
auto osVersion = _swift_stdlib_operatingSystemVersion();
170+
#if TARGET_OS_WATCH
171+
vouchersDisabled = (
172+
osVersion.majorVersion == 8 &&
173+
osVersion.minorVersion >= 0 && osVersion.minorVersion < 3
174+
);
175+
#elif TARGET_OS_IPHONE
176+
vouchersDisabled = (
177+
osVersion.majorVersion == 15 &&
178+
osVersion.minorVersion >= 0 && osVersion.minorVersion < 2
179+
);
180+
#elif TARGET_OS_OSX
181+
vouchersDisabled = (
182+
osVersion.majorVersion == 12 &&
183+
osVersion.minorVersion >= 0 && osVersion.minorVersion < 1
184+
);
185+
#else
186+
vouchersDisabled = false;
187+
#endif
188+
}
189+
190+
bool VoucherManager::vouchersAreDisabled() {
191+
swift_once(&voucherDisableCheckOnce,
192+
&_initializeVouchersDisabled,
193+
nullptr);
194+
return vouchersDisabled;
195+
}

stdlib/toolchain/Compatibility56/include/Concurrency/VoucherSupport.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ class VoucherManager {
3131
/// async work.
3232
llvm::Optional<voucher_t> OriginalVoucher;
3333

34+
/// Determine whether vouchers are disabled entirely. This evaluates
35+
/// true on platforms whose concurrency library does not support the
36+
/// propagation of vouchers, in which case all of the operations of
37+
/// this class must be no-ops.
38+
static bool vouchersAreDisabled();
39+
3440
public:
3541
VoucherManager() {
3642
SWIFT_TASK_DEBUG_LOG("[%p] Constructing VoucherManager", this);
@@ -41,6 +47,9 @@ class VoucherManager {
4147
/// VoucherManager object is destroyed. It may also be called in other
4248
/// places to restore the original voucher and reset the VoucherManager.
4349
void leave() {
50+
if (vouchersAreDisabled())
51+
return;
52+
4453
if (OriginalVoucher) {
4554
SWIFT_TASK_DEBUG_LOG("[%p] Restoring original voucher %p", this,
4655
*OriginalVoucher);
@@ -62,6 +71,9 @@ class VoucherManager {
6271
/// this is permanent. For Tasks, the voucher must be restored using
6372
/// restoreVoucher if the task suspends.
6473
void swapToJob(Job *job) {
74+
if (vouchersAreDisabled())
75+
return;
76+
6577
SWIFT_TASK_DEBUG_LOG("[%p] Swapping jobs to %p", this, job);
6678
assert(job);
6779
assert(job->Voucher != SWIFT_DEAD_VOUCHER);
@@ -99,6 +111,9 @@ class VoucherManager {
99111
// Take the current thread's adopted voucher and place it back into the task
100112
// that previously owned it, re-adopting the thread's original voucher.
101113
void restoreVoucher(AsyncTask *task) {
114+
if (vouchersAreDisabled())
115+
return;
116+
102117
SWIFT_TASK_DEBUG_LOG("[%p] Restoring %svoucher on task %p", this,
103118
OriginalVoucher ? "" : "missing ", task);
104119
assert(OriginalVoucher);

test/Serialization/Recovery/types-5-to-4.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import Lib
1616
func requiresConformance(_: B_RequiresConformance<B_ConformsToProto>) {}
1717
func requiresConformance(_: B_RequiresConformance<C_RelyOnConformanceImpl.Assoc>) {}
1818

19-
class Sub: Base {} // expected-error {{cannot inherit from class 'Base' (compiled with Swift 5.8) because it has overridable members that could not be loaded in Swift 4.1.50}}
20-
class Impl: Proto {} // expected-error {{type 'Impl' cannot conform to protocol 'Proto' (compiled with Swift 5.8) because it has requirements that could not be loaded in Swift 4.1.50}}
19+
class Sub: Base {} // expected-error {{cannot inherit from class 'Base' (compiled with Swift 5.8.1) because it has overridable members that could not be loaded in Swift 4.1.50}}
20+
class Impl: Proto {} // expected-error {{type 'Impl' cannot conform to protocol 'Proto' (compiled with Swift 5.8.1) because it has requirements that could not be loaded in Swift 4.1.50}}
2121

2222
#else // TEST
2323

test/SourceKit/Misc/compiler_version.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
// CHECK: key.version_major: 5
44
// CHECK: key.version_minor: 8
5-
// CHECK: key.version_patch: 0
5+
// CHECK: key.version_patch: 1

utils/build-script-impl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2689,12 +2689,13 @@ for host in "${ALL_HOSTS[@]}"; do
26892689
fi
26902690

26912691
with_pushd "${LIBICU_BUILD_DIR}" \
2692-
call env CXXFLAGS=-fPIC "${LIBICU_SOURCE_DIR}"/icu4c/source/runConfigureICU Linux \
2692+
call env CXXFLAGS=-fPIC LDFLAGS='-Wl,-rpath=\$$ORIGIN' \
2693+
"${LIBICU_SOURCE_DIR}"/icu4c/source/runConfigureICU Linux \
26932694
${icu_build_variant_arg} --prefix=${ICU_TMPINSTALL} \
26942695
${libicu_enable_debug} \
26952696
--enable-renaming --with-library-suffix=swift \
26962697
--libdir=${ICU_TMPLIBDIR} \
2697-
--enable-shared --enable-static --enable-rpath \
2698+
--enable-shared --enable-static \
26982699
--enable-strict --disable-icuio \
26992700
--disable-plugins --disable-dyload --disable-extras \
27002701
--disable-samples --disable-layoutex --with-data-packaging=auto

utils/build_swift/build_swift/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
CMAKE_GENERATOR = 'Ninja'
4747

4848
COMPILER_VENDOR = 'none'
49-
SWIFT_USER_VISIBLE_VERSION = Version('5.8')
49+
SWIFT_USER_VISIBLE_VERSION = Version('5.8.1')
5050
CLANG_USER_VISIBLE_VERSION = Version('13.0.0')
5151
SWIFT_ANALYZE_CODE_COVERAGE = 'false'
5252

0 commit comments

Comments
 (0)