Skip to content

Commit

Permalink
Check if existing capacity is enough even on non-objc.
Browse files Browse the repository at this point in the history
Fixes rdar://problem/20089729

Swift SVN r26109
  • Loading branch information
stormbrew committed Mar 13, 2015
1 parent c852697 commit 388f0dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions stdlib/public/core/HashedCollections.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -2697,18 +2697,18 @@ internal enum _Variant${Self}Storage<${TypeParametersDecl}> : _HashStorageType {
switch self {
case .Native:
let oldCapacity = native.capacity
#if _runtime(_ObjC)
if isUniquelyReferenced() && oldCapacity >= minimumCapacity {
#if _runtime(_ObjC)
// Clear the cache of bridged elements.
switch self {
case .Native(let owner):
owner.deinitializeHeapBufferBridged()
case .Cocoa:
_sanityCheckFailure("internal error: not backed by native storage")
}
#endif
return (reallocated: false, capacityChanged: false)
}
#endif

let oldNativeStorage = native
let newNativeOwner = NativeStorageOwner(minimumCapacity: minimumCapacity)
Expand Down
4 changes: 0 additions & 4 deletions validation-test/stdlib/SwiftPrivateSerializationMsgPack.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
// RUN: %target-run-simple-swift

// UNSUPPORTED: OS=linux-gnu
// FIXME: on Linux, this test does not finish in reasonable time because of:
// <rdar://problem/20089729> Dictionary reallocates storage on every mutation

import SwiftPrivateSerialization
import StdlibUnittest

Expand Down

0 comments on commit 388f0dd

Please sign in to comment.