When a user violates the inout rules by "re-entering" an array that is
currently undergoing mutation, it must not admit a memory-safety
violation. To ensure that it doesn't, temporarily make the buffer being
operated on inaccessible through the original array.
Swift SVN r19532
This does not yet handle variables with inferred types, since those don't
have TypePatterns.
There is some nasty propagation of @public into the stdlib because of this
one, mainly because Foundation needs access to some of the implementation
details of Array and Dictionary. We may want to try to improve this later
(or just build Foundation with -disable-access-control if it comes to that).
Swift SVN r19432
...unless the type has less accessibility than the protocol, in which case
they must be as accessible as the type.
This restriction applies even with access control checking disabled, but
shouldn't affect any decls not already marked with access control modifiers.
Swift SVN r19382
- Follow LLVM conventions for emacs mode specification
- Use local variables suffix to make the output read-only (at least on
Emacs)
- But drop the admonitions not to edit the generated files;
line-directive mostly takes care of that problem now.
Swift SVN r19381
As before, there may be more things marked @public than we actually want
public. Judicious use of the frontend option -disable-access-control may
help reduce the public surface area of the stdlib.
Swift SVN r19353
This one shows the unfortunate consequence that we need
Lazy[Forward|Bidirectional|RandomAccess]Collection. There's gonna be a
whole lotta gyb'bing going on...
Swift SVN r19316
This API exposes unmediated access to memory, and most users will never
see the UnsafeArray argument that's passed to the closure, so best to be
explicit.
Swift SVN r19243
Until we get an optimizer pass to remove get/set pairs, passing a
property that is a protocol requirement as inout from generic code is
always going to cause an extra retain, causing many unintended Array
copies.
Because this dropped reference counts to 1 in some cases, it exercised
previously-untested code paths and uncovered bugs, particularly in the
handling of subrange replacement on Slice<T>.
There are still differences in speed for short arrays of CGPoint that bear
investigation, but at least as things scale up, the ratio of time goes
to 1.
Fixes <rdar://problem/17040913> append and += on an array have
completely different performance
Swift SVN r19228
Because _demandUniqueMutableBuffer returns nil if the buffer already
exists, rename to _createUniqueMutableBuffer.
Because _requestUniqueMutableBuffer may return native backing storage
for a slice whose bounds don't exactly match the backing storage, rename
to _requestUniqueMutableBackingBuffer
Swift SVN r19214
Keep calm: remember that the standard library has many more public exports
than the average target, and that this contains ALL of them at once.
I also deliberately tried to tag nearly every top-level decl, even if that
was just to explicitly mark things @internal, to make sure I didn't miss
something.
This does export more than we might want to, mostly for protocol conformance
reasons, along with our simple-but-limiting typealias rule. I tried to also
mark things private where possible, but it's really going to be up to the
standard library owners to get this right. This is also only validated
against top-level access control; I haven't fully tested against member-level
access control yet, and none of our semantic restrictions are in place.
Along the way I also noticed bits of stdlib cruft; to keep this patch
understandable, I didn't change any of them.
Swift SVN r19145
Revert "[stdlib] Use an enum for ArrayBuffer storage"
This reverts commit r18996.
This reverts commit r18954.
The optimizer is not ready yet to handle this change especially given
the time until Beta 3. After speaking with DaveA, we agreed to revert
this and take such large changes onto private branches until we are sure
that the optimizer is ready to handle them rather than risking
performance regressions due to hitting the "optimization cliff".
Swift SVN r19026
This enables testing of other growth factors, per
<rdar://problem/17230502>. See the radar for basic performance test
results confirming (to the degree practical) that 2x growth is better
than 1.5x in our current system.
Swift SVN r18990
instead of reinterpretCasting all over the place. This should make it
easier on the ARC optimizer.
Addresses <rdar://problem/17312221>
Swift SVN r18954
Sorting was a bit of a mess; we had sort functions doing in-place
mutation /and/ returing the value, and people were confused by the
asymmetry of Array's sort() method with other higher-level methods.
Fixes <rdar://problem/17185815> sort([]T, f) mutates the original array
<rdar://problem/17225190> The Array.sort() method should return a sorted array
Swift SVN r18922
This helps array append's performance by ~ 2x. The generic max with a variadic
argument creates a temporary array then iterates over the array.
rdar://17140639 rdar://17073827
Swift SVN r18764
By beating the compiler into submission with a "bouncing through
non-methods" method, I have made it accept my crazed intention that
Array and friends should interoperate with all Sequences and
Collections! Filing <rdar://problem/16954833> to document the failure
of the method method.
Swift SVN r18378
This entry point is used when T is bridged verbatim and U is bridged
non-verbatim. It attempts to bridge each T from Objective-C to a U,
and returns nil if any of the elements cannot be bridged back to a U.
For now, only _convertNSArrayToArray and Array.bridgeFromObjectiveC
depend on this. It will soon be used for checked casts from, e.g.,
AnyObject[] to String[].
This is part of <rdar://problem/16952771> and general array bridging.
Swift SVN r18369