Skip to content

Commit 4bd5633

Browse files
committed
Avoid incorrectly asserting when we disable pure Swift deallocation on an object that has a side table
1 parent bf7ac27 commit 4bd5633

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

stdlib/public/SwiftShims/RefCount.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,15 @@ class RefCounts {
770770

771771
void setPureSwiftDeallocation(bool nonobjc) {
772772
auto oldbits = refCounts.load(SWIFT_MEMORY_ORDER_CONSUME);
773-
//Immortal and no objc complications share a bit, so don't let setting
774-
//the complications one clear the immmortal one
773+
774+
// Having a side table precludes using bits this way, but also precludes
775+
// doing the pure Swift deallocation path. So trying to turn this off
776+
// on something that has a side table is a noop
777+
if (!nonobjc && oldbits.hasSideTable()) {
778+
return;
779+
}
780+
// Immortal and no objc complications share a bit, so don't let setting
781+
// the complications one clear the immmortal one
775782
if (oldbits.isImmortal(true) || oldbits.pureSwiftDeallocation() == nonobjc){
776783
assert(!oldbits.hasSideTable());
777784
return;

0 commit comments

Comments
 (0)