Skip to content

Commit

Permalink
Remove a noescape and bitcast that were causing extra thunks to hang …
Browse files Browse the repository at this point in the history
…around

We were generating two reabstraction thunks from
(Generator.Element, Generator.Element) -> Bool
back to
(Generator.Element, Generator.Element) -> Bool
for the let bitcast.

rdar://21022339

Swift SVN r28778
  • Loading branch information
aschwaighofer committed May 19, 2015
1 parent 4875a12 commit 1cf4974
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions stdlib/public/core/CollectionAlgorithms.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ ${sortIsUnstableForPredicate}
///
${orderingRequirementForPredicate}
final public func _prext_sort(
@noescape isOrderedBefore: (Generator.Element, Generator.Element) -> Bool
isOrderedBefore: (Generator.Element, Generator.Element) -> Bool
) -> [Generator.Element] {
var result = ContiguousArray(self)
result._prext_sortInPlace(isOrderedBefore)
Expand Down Expand Up @@ -226,7 +226,7 @@ ${sortIsUnstableForPredicate}
///
${orderingRequirementForPredicate}
final public mutating func _prext_sortInPlace(
@noescape isOrderedBefore: (Generator.Element, Generator.Element) -> Bool
isOrderedBefore: (Generator.Element, Generator.Element) -> Bool
) {
let didSortUnsafeBuffer: Void? =
_withUnsafeMutableBufferPointerIfSupported {
Expand All @@ -237,9 +237,7 @@ ${orderingRequirementForPredicate}
if didSortUnsafeBuffer == nil {
typealias IsOrderedBefore =
(Generator.Element, Generator.Element) -> Bool
let escapableIsOrderedBefore =
unsafeBitCast(isOrderedBefore, IsOrderedBefore.self)
_introSort(&self, self.indices, escapableIsOrderedBefore)
_introSort(&self, self.indices, isOrderedBefore)
}
}
}
Expand Down

0 comments on commit 1cf4974

Please sign in to comment.