Commit Graph

5263 Commits

Author SHA1 Message Date
Jordan Rose
e7dd1c17b2 Merge pull request #20384 from jrose-apple/witless
Require @usableFromInline on associated type witnesses
2018-11-08 16:36:48 -08:00
Azoy
309f46ebba condense index to one line 2018-11-08 17:50:16 -06:00
David Smith
96691208e9 Bridged Strings should have some different/additional overrides for performance 2018-11-08 11:08:03 -08:00
Richard Wei
394be18449 Merge branch 'master' of github.com:apple/swift into additive-arithmetic 2018-11-08 10:20:13 -08:00
Richard Wei
57facc8daa Update comments 2018-11-08 10:18:31 -08:00
Johannes Weiss
2d9fa20c6b implement ManagerBuffer.reallocated to allow realloc'ing the storage 2018-11-08 18:18:23 +00:00
John McCall
87e9fb5560 Use @_borrowed on a few declarations in the stdlib and overlays.
Most of the stdlib's properties don't need @_borrowed because they're
@inlinable, but I did find one place in an overlay where it's probably
sensible to make the operation use generalized accessors even if
they're resilient.
2018-11-08 12:19:09 -05:00
Ben Cohen
92d2959a46 Regroup ABI expected list by change 2018-11-08 06:45:20 -08:00
Ben Cohen
b1038e9b9b Misc inlinability fixes 2018-11-08 06:45:20 -08:00
Max Moiseev
cc9c4fafe4 Merge pull request #20413 from moiseev/no-guards
[stdlib] Fix the abi checker test for both assert and no-assert builds
2018-11-07 21:43:12 -08:00
Richard Wei
44c2f7761a Implement SE-0233 AdditiveArithmetic 2018-11-07 19:43:13 -08:00
Michael Ilseman
019919d667 Merge pull request #20381 from milseman/oldOS
[test] Fixup some tests for older OSes and other inconsequential changes
2018-11-07 17:30:18 -08:00
Maxim Moiseev
938094cdd6 [stdlib] Fix the abi checker test for both assert and no-assert builds
A few internal functions were defined within the #if
INTERNAL_CHECKS_ENABLED block, which made the results different between
stdlib configurations with assertions enabled and without. Since these
fucntions are internal and are not @inlinable, it is OK to have them
unconditionally.

<rdar://problem/45880586>
2018-11-07 15:59:30 -08:00
Max Moiseev
547b0a9f08 Merge pull request #20382 from moiseev/runtime-buffers
[stdlib] Internalize _Buffer32 and _Buffer72
2018-11-07 15:17:43 -08:00
Lance Parker
864de1d01e Merge pull request #20371 from lancep/ContiguousArrayInlinableAudit
[stdlib]@inlinable audit for ContiguousArray
2018-11-07 14:48:06 -08:00
Lance Parker
71f2ddde29 Merge pull request #20377 from lancep/SliceBufferInlinableAudit
[stdlib]@inlinable audit for SliceBuffer
2018-11-07 14:47:26 -08:00
Maxim Moiseev
e107fab25b [stdlib] Internalize _Buffer32 and _Buffer72 2018-11-07 11:25:31 -08:00
Karoy Lorentey
43f3431d9f [stdlib] Fix 32-bit oversight 2018-11-07 14:53:22 +00:00
Karoy Lorentey
50bd37b49a [stdlib] Eliminate _HasherCore protocol 2018-11-07 13:45:56 +00:00
Nate Cook
e5c1567957 [stdlib] Switch to a stable sort algorithm (#19717)
This switches the standard library's sort algorithm from an in-place
introsort to use a modified timsort, a stable, adaptive sort that
merges runs using a temporary buffer. This implementation performs
straight merges instead of adopting timsort's galloping strategy.

In addition to maintaining the relative order of equal/non-comparable
elements, this algorithm outperforms the introsort on data with any
intrinsic structure, such as runs of ascending or descending elements
or a significant number of equality collisions.
2018-11-07 00:05:04 -06:00
Jordan Rose
65fe556c1a [stdlib] Mark associated type witnesses as @usableFromInline
Inlinable code is permitted to rely on these associated types, so we
need to make sure their declarations are printed in the parseable
interface.

Part of rdar://problem/43824052
2018-11-06 17:00:46 -08:00
Michael Ilseman
e19e07fb0e [string] Undo workaround; NFC 2018-11-06 16:31:23 -08:00
Lance Parker
1938378b3d All the @inlinables in SliceBuffer are good 2018-11-06 14:57:21 -08:00
Max Moiseev
d3e7d59ff4 Merge pull request #20290 from moiseev/atomic-int
[stdlib] Move _stdlib_AtomicInt and friends out of the stdlib
2018-11-06 14:48:46 -08:00
Lance Parker
90fd4ba4d7 All the @inlinables in ContigArray are good 2018-11-06 14:38:09 -08:00
Michael Ilseman
d6206d5094 Merge pull request #20338 from milseman/hot_cocoa
[String] Add _CocoaString typealias to all build configurations.
2018-11-06 10:09:09 -08:00
Maxim Moiseev
ca51626fd3 [stdlib] Move _stdlib_AtomicInt and friends out of the stdlib 2018-11-06 09:53:58 -08:00
Maxim Moiseev
f14e9aabd7 Stop using _stdlib_AtomicInt in ThreadLocalStorage 2018-11-06 09:53:58 -08:00
Joe Groff
bf0e3bf8fa Merge pull request #20326 from jckarter/key-path-true-const
IRGen/Runtime: Make key path pattern format true-const.
2018-11-05 20:24:01 -08:00
Michael Ilseman
62549c81e8 [String] Add _CocoaString typealias to all build configurations.
Conditionally compiling out _CocoaString from 32-bit string will be
way too unweidly. Fixes Android bots.
2018-11-05 16:48:05 -08:00
Maxim Moiseev
90106444d3 [stdlib] Remove a bunch of unused functions from Runtime.swift.gyb
<rdar://problem/45746339>
2018-11-05 15:03:19 -08:00
Joe Groff
65a4531467 IRGen/Runtime: Make key path pattern format true-const.
Use relative references instead of pointers so that the pattern can be true-const. Instead of trying
to instantiate a constant key path literal in-place, point to a cache variable that we can store
a pointer to the shared instance into when instantiated. Now that the pattern format has diverged
significantly from the instance format, simplify and refactor the instantiation code using a walker
for the pattern format instead of trying to reuse the code for working with instantiated instances.
rdar://problem/42674576
2018-11-05 12:30:49 -08:00
Michael Ilseman
fee2787eb6 [String] Invalidate breadcrumbs on mutation. 2018-11-05 06:48:56 -08:00
Azoy
68a2a2ca3d remember to use the generator 2018-11-04 23:24:54 -06:00
Azoy
7af435c22a clean up some random generator calls 2018-11-04 22:38:34 -06:00
Michael Ilseman
ec6729a3a3 [String] Assertion logic and isASCII bug fix.
Fix bugs in assertion logic and properly update the isASCII bit on
RRC. RRC tests added.
2018-11-04 10:42:44 -08:00
Michael Ilseman
1939d165ae Make corelibs-foundation build
Expose the old SPIs again so corelibs-foundation can build. We'll want
to wean them off of these and establish proper APIs soon.
2018-11-04 10:42:44 -08:00
Michael Ilseman
c04dcf3b38 [String] More efficient breadcrumb-scanning code.
Rather than rely on the UTF16View, scan between breadcrumbs by hand
for a decent 20% speedup. This code will also make it more obvious how
to slot in a vectorized solution later.
2018-11-04 10:42:44 -08:00
Karoy Lorentey
3820393ea2 [stdlib] Ensure that reserved capacity survives CoW copies (#46)
This shouldn’t really be necessary, but it makes sense to wait until we can reclaim memory like this consistently across the entire stdlib.
2018-11-04 10:42:44 -08:00
Michael Ilseman
53ccd9e054 [string] Less inlining for code size.
Less inlining for hashing and comparison. Saves code size on very
frequent String comparison in exchange for costing us in some of our
ridiculuous micro-benchmarks.

Also adds in more _effects for better codegen
2018-11-04 10:42:42 -08:00
Michael Ilseman
948655e850 [String] Cleanups, comments, documentation
After rebasing on master and incorporating more 32-bit support,
perform a bunch of cleanup, documentation updates, comments, move code
back to String declaration, etc.
2018-11-04 10:42:42 -08:00
Karoy Lorentey
40aae6b235 [String] 32-bit platform support
Add support for 32-bit platforms for UTF-8 backed String.
2018-11-04 10:42:41 -08:00
Michael Ilseman
cb0fbc6fc7 [String] 5X Faster getCharacters implementation
Rather than bounce through the UTF-16 view, implement custom
transcoding for getCharacters. This speeds it up by around 5X. Adds
tests.
2018-11-04 10:42:41 -08:00
Michael Ilseman
e2c2e479bb [test] Test the breadcrumbing String<->Cocoa interface 2018-11-04 10:42:41 -08:00
Michael Ilseman
75728ebee3 [String] Implement in-place generic RRC 2018-11-04 10:42:41 -08:00
Michael Ilseman
d5da6fdbfd [String] More comparison speedups and cleanup 2018-11-04 10:42:41 -08:00
Michael Ilseman
9135c07cac [String] Perform small string append in-register 2018-11-04 10:42:41 -08:00
Michael Ilseman
a37d110adf [String] Constant-fold small strings from literals.
Tweak and adjust code so that the SIL optimizer can constant-fold
small strings from literals. Also some cleanup.
2018-11-04 10:42:41 -08:00
Lance Parker
bacc7eecd5 fix the normalization unit tests 2018-11-04 10:42:41 -08:00
Michael Ilseman
7aea40680d [String] NFC iterator fast-paths
Refactor and rename _StringGutsSlice, apply NFC-aware fast paths to a
new buffered iterator.

Also, fix bug in _typeName which used to assume ASCIIness and better
SIL optimizations on StringObject.
2018-11-04 10:42:41 -08:00