Commit Graph

112 Commits

Author SHA1 Message Date
Dmitri Hrybenko
b158753ae4 stdlib: coding style: add parentheses to one-argument closures for
consistency with the rest of the library

Swift SVN r25036
2015-02-06 05:38:15 +00:00
Maxwell Swadling
4535d51593 [stdlib] Added initializeFrom to array functions
Added to all functions that don't use _expectEnd.

Swift SVN r25017
2015-02-05 21:31:19 +00:00
Maxwell Swadling
7ba5e6a575 [stdlib] added @noescape to Array functions
rdar://problem/19389247

Swift SVN r24970
2015-02-04 19:49:06 +00:00
Maxwell Swadling
8e95156b0b [stdlib] added @noescape to withUnsafeBufferPointer functions
rdar://problem/19389247

Swift SVN r24969
2015-02-04 19:49:05 +00:00
Dave Abrahams
0c17537602 Revert "[stdlib] use initializeTo instead of loops"
This reverts r24743, because it broke some of the tests that Chris
disabled.

Swift SVN r24932
2015-02-04 01:53:11 +00:00
Dmitri Hrybenko
311957061a Stop using Unsafe[Mutable]Pointer.null()
This API will be removed per rdar://19159145 (it is redundant with nil
literals and the default initializer).

Swift SVN r24795
2015-01-28 08:42:26 +00:00
Maxwell Swadling
4ef99c0de5 [stdlib] Added fixmes for missing _expectEnds
Swift SVN r24745
2015-01-27 02:12:26 +00:00
Maxwell Swadling
1587f11064 [stdlib] use initializeTo instead of loops
This improves performance of arrays and buffers.

Swift SVN r24743
2015-01-27 02:12:24 +00:00
Maxwell Swadling
a86572c9a9 [stdlib] Updated APIs to use C.Generator.Element
Swift SVN r24740
2015-01-27 02:12:19 +00:00
Dmitri Hrybenko
bbf79427ac stdlib: remove bitwise operations on Bool
Bitwise operations on Bool are redundant with other logic operations
that stdlib already provides.  The only reason to have them was to avoid
branching in the short-circuiting && and ||.

rdar://19340952

Surprisingly, replacing & and | in the standard library with && and ||
brought performance improvements and no significant performance
regressions:

RecursiveOwnedParameter 1.14
SelectionSort 1.19

Swift SVN r24674
2015-01-23 03:09:55 +00:00
John McCall
3be27ad22b Adopt safe addressors in Swift's Array family of types.
rdar://190323998

Swift SVN r24599
2015-01-21 09:12:49 +00:00
Dave Abrahams
f16a6b0897 [stdlib] Kill some dead code
Swift SVN r24543
2015-01-20 00:53:17 +00:00
Dmitri Hrybenko
730025e939 stdlib: fix spelling of 'Objective-C'
Swift SVN r24437
2015-01-15 02:41:09 +00:00
Andrew Trick
c2f3622ac3 Revert "Mark _copyCollectionToNativeArrayBuffer readonly."
This reverts commit 71eb477aa6d9354cbad7baebae4283936bb1831a.

Per Erik's review.
The correct fix is interprocedural analysis that has visibility
into specialized functions. Let's just wait for that.

Swift SVN r24007
2014-12-18 18:22:01 +00:00
Andrew Trick
361ceea369 Mark _copyCollectionToNativeArrayBuffer readonly.
This fixes one of the issues preventing optimization of RangeAssignment
when it isn't fully inlined. There is still another problem with this benchmark I haven't fixed:
<rdar://problem/19252374> We fail to fully optimize RangeAssignment. Forced inlining achieves 3-4x speedup.

This fix at least unblocks CopyForwarding, which perturbs inlining enough to expose the issue.

Swift SVN r23944
2014-12-15 21:20:03 +00:00
Graham Batty
dc6a776d10 stdlib: Use config directives to work without objective-c.
Swift SVN r23211
2014-11-10 20:06:25 +00:00
Graham Batty
373414864d Revert "Use config directives to carve out a 'portable' kernel stdlib."
This reverts commit r23202 pending further discussion.

Swift SVN r23205
2014-11-10 18:46:42 +00:00
Graham Batty
dfa260fab1 Use config directives to carve out a 'portable' kernel stdlib.
Swift SVN r23202
2014-11-10 18:03:09 +00:00
Dave Abrahams
2794fe3a13 [stdlib] Restore a combination of 11 commits
...but remove all new uses of closures, to make things easier on the
optimizer.

Swift SVN r23183
2014-11-08 20:04:29 +00:00
Joe Groff
af0121f8e6 IRGen: Don't nonlazily realize classes (unless they ask).
We lazily realize classes when we access their metadata now, so there's no need to force the ObjC runtime to do this greedily anymore, except for classes that the runtime statically references. For those cases, add an @objc_non_lazy_realization class attribute that will put that class reference in the nlclslist section.

Swift SVN r23105
2014-11-05 00:19:37 +00:00
Dave Abrahams
c77d7e353c Revert a combination of 11 commits
These commits are suspected of causing performance regressions:

r22995, "[stdlib] Array nil state elimination, part trois"
r22994, "[stdlib] Array nil-state elimination II"
r22993, "[stdlib] Array nil-state elimination I"
r22992, "[stdlib] Still more nil buffer elimination"
r22991, "[stdlib] Nix an unneeded typealias"
r22988, "[stdlib] Nix _ContiguousArrayBuffer._base, part deux"
r22986, "[stdlib] Kill _ContiguousArrayBuffer._base, part I"
r22985, "[stdlib] destroy redundant property"
r22975, "[stdlib] More array nil-state destruction"
r22974, "[stdlib] Construct HeapBuffer without AnyObject"
r22959, "[stdlib] non-nil ContiguousArray"

Swift SVN r23001
2014-10-29 02:57:45 +00:00
Dave Abrahams
f7bf9bf16d [stdlib] Still more nil buffer elimination
Swift SVN r22992
2014-10-28 18:00:55 +00:00
Dave Abrahams
8ced867315 [stdlib] Nix an unneeded typealias
Swift SVN r22991
2014-10-28 18:00:51 +00:00
Dave Abrahams
7a1463e4ec [stdlib] Nix _ContiguousArrayBuffer._base, part deux
This commit eliminates (finally) the nil state from
_ContiguousArrayBuffer.

Swift SVN r22988
2014-10-28 03:58:41 +00:00
Dave Abrahams
838fc13011 [stdlib] Drop unused operators
Swift SVN r22987
2014-10-28 03:58:40 +00:00
Dave Abrahams
cc0c66df75 [stdlib] destroy redundant property
Swift SVN r22985
2014-10-28 03:58:39 +00:00
Dave Abrahams
7c8364fb52 [stdlib] More array nil-state destruction
Baby steps.

Swift SVN r22975
2014-10-27 22:36:24 +00:00
Dave Abrahams
84a955d987 [stdlib] Construct HeapBuffer without AnyObject
The existential was causing the optimizer problems.

Swift SVN r22974
2014-10-27 21:48:38 +00:00
Dave Abrahams
1adda3e81b [stdlib] non-nil ContiguousArray
This is the barest-minimum change required to ensure that the buffer is
never nil.  Codegen problems were crushing all more-ambitious
efforts (radar to follow)

Swift SVN r22959
2014-10-27 05:02:44 +00:00
Dave Abrahams
f07b42ee9a [stdlib] replace an assign with a swap
Theoretically, this should cut down retain/release traffic

Swift SVN r22957
2014-10-27 04:45:46 +00:00
Dave Abrahams
60e79b7560 [stdlib] Replace an unsafeBitCast
Swift SVN r22956
2014-10-27 04:45:45 +00:00
Dave Abrahams
f8f82a9061 [stdlib] ContiguousArrayBuffer: tiny logic cleanup
Swift SVN r22951
2014-10-26 21:37:40 +00:00
Dave Abrahams
6786969209 [stdlib] Introduce _SwiftDeferredNSArray
This is mostly just a renaming of _SwiftNativeNSArray, except that we
want to add another NSArray subclass for verbatim-bridged elements, so
we want a common base class.  _SwiftNativeNSArray is the name of that
new base class, to parallel the other _SwiftNativeNSXXX classes.

Swift SVN r22913
2014-10-24 15:48:48 +00:00
Dave Abrahams
418aa75eb2 [stdlib] Rename _NSSwiftXXX => _SwiftNativeNSXXX
...to better reflect the purpose of these classes

Swift SVN r22911
2014-10-24 15:48:46 +00:00
Dave Abrahams
4a1d2e67ec [stdlib] ContiguousArrayBuffer: truthful types
The buffer stored in a _ContiguousArrayBuffer<T> is not always
_ContiguousArrayStorage<T>.  It might in fact be the special empty
buffer class.

Swift SVN r22835
2014-10-20 05:13:21 +00:00
Dave Abrahams
b9bdbb87b6 Revert "[stdlib] ContiguousArrayBuffer: truthful types"
This reverts commit r22824, which I suspect of causing the
closure_multivalue failure at

Swift SVN r22834
2014-10-20 03:20:46 +00:00
Dave Abrahams
f765ffdc45 [stdlib] ContiguousArrayBuffer: truthful types
The buffer stored in a _ContiguousArrayBuffer<T> is not always
_ContiguousArrayStorage<T>.  It might in fact be the special empty
buffer class.

Swift SVN r22823
2014-10-18 04:49:00 +00:00
Dave Abrahams
69194280a7 [stdlib] Nix an unused protocol and rename another
Swift SVN r22791
2014-10-16 03:46:34 +00:00
Dave Abrahams
4bdb9462c7 [stdlib] ArrayBufferType: identity is base address
Buffer identity is only used by tests.  The switch to an identity
representation that accounts for the buffer length was actually
incorrect for the way many tests used it.

Swift SVN r22771
2014-10-15 20:27:57 +00:00
Dave Abrahams
ab69e26656 [stdlib] Actually run the ArrayCore test
Fixes rdar://problem/18646425

Running the test uncovered avoidable inefficiencies in Array copying, so
dispatch of _copyToNativeArrayBuffer was revamped.  It's reasonable to
expect some speedups from this.

Also, the internal Array API requestNativeBuffer was highly error prone
when the source was a Slice, because it could return an array buffer
that represented more than the entire slice.  That capability was
probably used for optimization once, but is no longer, and the error
prone API probably caused bugs, so it was reformed.

Swift SVN r22746
2014-10-15 03:24:47 +00:00
Dave Abrahams
2d850421bc [stdlib] Internalize HeapBuffer[Storage], OnHeap
They were never really useful to users, because their APIs were
insufficiently public.  They have been replaced with a single class,
ManagedBuffer<Value,Element>, which is really designed for user
consumption.

Swift SVN r22636
2014-10-09 21:45:44 +00:00
Dave Abrahams
1f38b125f4 [stdlib] Fix typos in sanity check strings
Swift SVN r22627
2014-10-09 18:25:24 +00:00
Dave Abrahams
add753905b [stdlib] Use a lifetime-managed "with" construct
...instead of an internal API that releases an UnsafeBufferPointer into the wild.

Swift SVN r22561
2014-10-07 01:08:35 +00:00
Dave Abrahams
41fe3896d8 [stdlib] Synchronization-free empty array buffer
Now that <rdar://problem/18540783> is fixed, we can stop allocating the
empty array buffer dynamically and go back to using the one that is
statically laid out in GlobalObjects.cpp, thereby avoiding the
atomic instructions required to make it threadsafe.

Swift SVN r22545
2014-10-06 18:40:06 +00:00
Dave Abrahams
eac8ca27f9 [stdlib] Use a universal empty array buffer
NFC, and no significant performance change expected.  This is part one
of a move to eliminate nil checks from the array implementation.

Swift SVN r22526
2014-10-05 17:55:11 +00:00
Dave Abrahams
b740ad0df9 Revert "[stdlib] Use a universal empty array buffer"
This reverts commit r22495, because it wroke havoc with SIL and the perf
test suite somehow.

Swift SVN r22499
2014-10-03 18:52:11 +00:00
Dave Abrahams
f2f068c3dc [stdlib] Use a universal empty array buffer
NFC, and no significant performance change expected.  This is part one
of a move to eliminate nil checks from the array implementation.

Swift SVN r22495
2014-10-03 16:01:50 +00:00
Dave Abrahams
c93f32a4b3 [stdlib] Eliminate needless intermediate class
Swift SVN r22415
2014-09-30 23:43:25 +00:00
Dave Abrahams
156020de19 [stdlib] Rename 'countElements' => 'count'
The name was not only long and unwieldy, but inconsistent with our
conscious decision to avoid the use of "elements" in APIs as mostly
redundant.

Swift SVN r22408
2014-09-30 22:00:26 +00:00
Dave Abrahams
f4a7812065 [stdlib] Propagate SequenceType docs to models
235 undocumented public APIs remain in core

Swift SVN r22210
2014-09-23 10:40:37 +00:00