Skip to content

Commit 961d29b

Browse files
committed
Try an experiment
1 parent ac78421 commit 961d29b

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,15 @@ internal struct _ContiguousArrayBuffer<Element>: _ArrayBufferProtocol {
274274
realMinimumCapacity._builtinWordValue, Element.self)
275275

276276
let storageAddr = UnsafeMutableRawPointer(Builtin.bridgeToRawPointer(_storage))
277-
if let allocSize = _mallocSize(ofAllocation: storageAddr) {
278-
let endAddr = storageAddr + allocSize
279-
let realCapacity = endAddr.assumingMemoryBound(to: Element.self) - firstElementAddress
280-
_initStorageHeader(
281-
count: uninitializedCount, capacity: realCapacity)
282-
} else {
277+
// if let allocSize = _mallocSize(ofAllocation: storageAddr) {
278+
// let endAddr = storageAddr + allocSize
279+
// let realCapacity = endAddr.assumingMemoryBound(to: Element.self) - firstElementAddress
280+
// _initStorageHeader(
281+
// count: uninitializedCount, capacity: realCapacity)
282+
// } else {
283283
_initStorageHeader(
284284
count: uninitializedCount, capacity: realMinimumCapacity)
285-
}
285+
// }
286286
}
287287
}
288288

stdlib/public/core/StringStorage.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,17 @@ fileprivate func _allocate<T: AnyObject>(
206206
let totalTailBytes = total - numHeaderBytes
207207

208208
let object = tailAllocator(totalTailBytes)
209-
if let allocSize = _mallocSize(ofAllocation:
210-
UnsafeRawPointer(Builtin.bridgeToRawPointer(object))) {
211-
_internalInvariant(allocSize % MemoryLayout<Int>.stride == 0)
212-
213-
let realNumTailBytes = allocSize - numHeaderBytes
214-
_internalInvariant(realNumTailBytes >= numTailBytes)
215-
216-
return (object, realNumTailBytes)
217-
} else {
209+
// if let allocSize = _mallocSize(ofAllocation:
210+
// UnsafeRawPointer(Builtin.bridgeToRawPointer(object))) {
211+
// _internalInvariant(allocSize % MemoryLayout<Int>.stride == 0)
212+
//
213+
// let realNumTailBytes = allocSize - numHeaderBytes
214+
// _internalInvariant(realNumTailBytes >= numTailBytes)
215+
//
216+
// return (object, realNumTailBytes)
217+
// } else {
218218
return (object, totalTailBytes)
219-
}
219+
// }
220220
}
221221

222222
fileprivate func _allocateStringStorage(

0 commit comments

Comments
 (0)