File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -684,7 +684,7 @@ template <class ElemTy> struct ConcurrentReadableHashMap {
684
684
// / Free all the arrays in the free lists if there are no active readers. If
685
685
// / there are active readers, do nothing.
686
686
void deallocateFreeListIfSafe () {
687
- if (ReaderCount.load (std::memory_order_relaxed ) == 0 )
687
+ if (ReaderCount.load (std::memory_order_acquire ) == 0 )
688
688
deallocateFreeList ();
689
689
}
690
690
@@ -857,7 +857,7 @@ template <class ElemTy> struct ConcurrentReadableHashMap {
857
857
ElemTy *elements2;
858
858
do {
859
859
elements = Elements.load (std::memory_order_acquire);
860
- indices = Indices.load (SWIFT_MEMORY_ORDER_CONSUME );
860
+ indices = Indices.load (std::memory_order_acquire );
861
861
elementCount = ElementCount.load (std::memory_order_acquire);
862
862
elements2 = Elements.load (std::memory_order_acquire);
863
863
} while (elements != elements2);
Original file line number Diff line number Diff line change @@ -397,12 +397,13 @@ extension _StringGuts {
397
397
}
398
398
399
399
// 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
402
402
_cocoaStringCopyCharacters (
403
403
from: self . _object. cocoaObject,
404
404
range: start..< end,
405
- into: $0. baseAddress. _unsafelyUnwrappedUnchecked)
405
+ into: buffer. baseAddress. _unsafelyUnwrappedUnchecked)
406
+ initializedCapacity = count
406
407
}
407
408
return cus. withUnsafeBufferPointer {
408
409
return Character ( String . _uncheckedFromUTF16 ( $0) )
You can’t perform that action at this time.
0 commit comments