Skip to content

Commit 50429f3

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-rebranch
2 parents 229ec1f + a350fb7 commit 50429f3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

include/swift/Runtime/Concurrent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ template <class ElemTy> struct ConcurrentReadableHashMap {
684684
/// Free all the arrays in the free lists if there are no active readers. If
685685
/// there are active readers, do nothing.
686686
void deallocateFreeListIfSafe() {
687-
if (ReaderCount.load(std::memory_order_relaxed) == 0)
687+
if (ReaderCount.load(std::memory_order_acquire) == 0)
688688
deallocateFreeList();
689689
}
690690

@@ -857,7 +857,7 @@ template <class ElemTy> struct ConcurrentReadableHashMap {
857857
ElemTy *elements2;
858858
do {
859859
elements = Elements.load(std::memory_order_acquire);
860-
indices = Indices.load(SWIFT_MEMORY_ORDER_CONSUME);
860+
indices = Indices.load(std::memory_order_acquire);
861861
elementCount = ElementCount.load(std::memory_order_acquire);
862862
elements2 = Elements.load(std::memory_order_acquire);
863863
} while (elements != elements2);

stdlib/public/core/UnicodeHelpers.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,13 @@ extension _StringGuts {
397397
}
398398

399399
// TODO(String performance): Stack buffer if small enough
400-
var cus = Array<UInt16>(repeating: 0, count: count)
401-
cus.withUnsafeMutableBufferPointer {
400+
let cus = Array<UInt16>(unsafeUninitializedCapacity: count) {
401+
buffer, initializedCapacity in
402402
_cocoaStringCopyCharacters(
403403
from: self._object.cocoaObject,
404404
range: start..<end,
405-
into: $0.baseAddress._unsafelyUnwrappedUnchecked)
405+
into: buffer.baseAddress._unsafelyUnwrappedUnchecked)
406+
initializedCapacity = count
406407
}
407408
return cus.withUnsafeBufferPointer {
408409
return Character(String._uncheckedFromUTF16($0))

0 commit comments

Comments
 (0)