Commit Graph

3744 Commits

Author SHA1 Message Date
Nate Cook
5afeecb246 [stdlib] Remove MutableCollection.sorted methods (#14005)
* [stdlib] Remove MutableCollection.sorted methods

This removes the implementations of sorted() and sorted(by:) on Mutable-
Collection, which only changed some minor wording in the docs.

This also adds documentation to the partition(by:) implementations so that
they will appear downstream.

* [stdlib] De-gyb CollectionAlgorithms.swift

* Update tests for MutableCollection.sorted() changes
2018-01-23 14:17:32 -08:00
Michael Ilseman
f3c691f019 Merge pull request #14077 from milseman/arc_bridge
[string] Hack around more ARC.
2018-01-23 09:40:29 -08:00
Karoy Lorentey
de2add8047 [stdlib] Set, Dictionary terminology: Distinguish capacity from bucket count.
"Capacity" in the public Set/Dictionary API means the maximum number of items that a collection instance may hold without reallocation. In implementation details, the same word was also used for the capacity of the underlying storage buffer, which is usually higher due to the maximum load factor.

Having the same name for two different values has led to bugs where the logical/effective capacity is passed directly to a function expecting the raw storage capacity, or vice versa. This change updates internal names to clearly distinguish between the two senses, introducing "bucketCount" as the name for the storage buffer capacity, and reserving "capacity" for the maximum logical item count.
2018-01-23 17:22:31 +00:00
swift-ci
16c93f834c Merge pull request #14076 from lattner/fastar-print 2018-01-23 00:06:31 -08:00
Michael Ilseman
ef926c9031 [string] Hack around more ARC.
Utilize pre-existing CFStringGetLength hack. Gives about 20%
performance improvement bridging in contiguous NSStrings from
ObjectiveC.
2018-01-22 21:29:39 -08:00
Michael Ilseman
51c560f74c Merge pull request #14052 from milseman/ascii_view
[string] Hoist UTF8View fast-path for known ASCII
2018-01-22 21:11:06 -08:00
Chris Lattner
1287d62f8f Stop pessimizing print performance for no reason.
As pointed out in Ole Begeman's blog:
https://oleb.net/blog/2016/09/playground-print-hook/

The playground print hook is being initialized a a non-null noop hook,
which causes the fast paths in the print functions to be unused, and
forcing the creation of a tee stream for things that have nothing to
do with playgrounds.  It is sad that no one noticed this...
2018-01-22 19:56:37 -08:00
Mishal Shah
dc0be0e0da Merge pull request #14060 from milseman/vacuous_singleton
[string] Workaround fail emptySingleton check.
2018-01-22 12:27:27 -08:00
Michael Ilseman
9a87d24bc7 [string] Workaround fail emptySingleton check.
This is a temporary workaround for some situations where the empty
singleton is not being formed correctly (and this seems to be highly
configuration dependent). Work around that for now for also checking
for empty non-storage-backed Strings.

This is probably too expensive a check for us to do long-term, but it
works for now.
2018-01-22 11:07:52 -08:00
Max Moiseev
b1e37b9b0c Merge pull request #14035 from moiseev/compact-message
[stdlib] Improve the flatMap deprecation message
2018-01-22 10:29:46 -08:00
Michael Ilseman
d14b8abc8b [string] Force specialization for small Character 2018-01-22 01:06:09 -08:00
Michael Ilseman
744f5a6486 [string] Hoist UTF8View fast-path for known ASCII 2018-01-21 23:34:33 -08:00
Michael Ilseman
c7eefc1ca5 Merge pull request #14046 from milseman/string_guts_squash
StringGuts: New 2-word representation for String
2018-01-21 21:28:15 -08:00
Michael Ilseman
b61b53330f [Builtin] Add _isValidAddress pointer-value check.
And adopt it for StringGuts, as it is more robust on 32-bit systems.
2018-01-21 12:40:35 -08:00
Karoy Lorentey
b8d8949166 String & String views: Add bounds checking to range subscripts. 2018-01-21 12:40:21 -08:00
Michael Ilseman
6d1866f846 [StringGuts] Clean-up in preparation for merge.
Clean up a lot of the scattered utility functions, FIXMEs, etc in
preparation for the merge to master.
2018-01-21 12:38:49 -08:00
Karoy Lorentey
90e894729a [StringGuts] Linux support
Add support for compiling StringGuts without the Objective-C runtime.
2018-01-21 12:37:36 -08:00
Karoy Lorentey
f2a96496a0 [StringGuts] Support for 32-bit platforms
Add 32-bit support to the new StringGuts.
2018-01-21 12:36:09 -08:00
Karoy Lorentey
5cf9fd7414 Remove _StringBuffer 🎉🎉🎉 2018-01-21 12:35:15 -08:00
Karoy Lorentey
b360bd6d69 Remove _LegacyStringCore 🎉🎉🎉 2018-01-21 12:35:15 -08:00
Michael Ilseman
3be2faf5d3 [String] Initial implementation of 64-bit StringGuts.
Include the initial implementation of _StringGuts, a 2-word
replacement for _LegacyStringCore. 64-bit Darwin supported, 32-bit and
Linux support in subsequent commits.
2018-01-21 12:32:26 -08:00
Michael Ilseman
75463e30f3 [stdlib] Rename _StringCore to _LegacyStringCore. NFC.
In grand LLVM tradition, the first step to redesigning _StringCore is
to first rename it to _LegacyStringCore. Subsequent commits will
introduce the replacement, and eventually all uses of the old one will
be moved to the new one.

NFC.
2018-01-21 12:28:56 -08:00
Slava Pestov
834a121b10 AST: @objc_non_lazy_realization should be underscored and UserInaccessible 2018-01-21 01:31:44 -08:00
Max Moiseev
a4aea08bce Merge pull request #13892 from xwu/better-homes-and-logarithms
[stdlib] Improve _binaryLogarithm implementation and add tests [NFCI]
2018-01-19 16:18:07 -08:00
Max Moiseev
aceb63e058 [stdlib] Improve the flatMap deprecation message
<rdar://problem/36555646>
2018-01-19 15:29:46 -08:00
Erik Eckstein
2e4ecb425e stdlib: make the destructor of _SwiftNativeNSArrayWithContiguousStorage inlinable on linux
... as it is for ObjC runtimes.
This is need for the optimizer to do certain optimizations, like object outlining.

rdar://problem/34758773
2018-01-19 11:32:35 -08:00
Karoy Lorentey
3b1bae9ca2 [stdlib] Set, Dictionary: Take the max load factor into account in .init(minimumCapacity:)
rdar://problem/36619317
2018-01-19 17:38:16 +00:00
eeckstein
b126b62256 Revert "Optimization changes to completely fold OptionSet literals" 2018-01-18 22:05:07 -08:00
swift-ci
cdaba608dc Merge pull request #13863 from moiseev/map-map 2018-01-18 20:34:00 -08:00
Erik Eckstein
228bf53f27 stdlib: make the destructor of _SwiftNativeNSArrayWithContiguousStorage inlinable on linux
... as it is for ObjC runtimes.
This is need for the optimizer to do certain optimizations, like object outlining.

rdar://problem/34758773
2018-01-18 18:27:17 -08:00
Max Moiseev
958043cbf4 [stdlib] Fold multiple layers of LazyFilterSequence/LazyFilterCollection 2018-01-18 14:54:22 -08:00
Max Moiseev
f7e2238e91 [stdlib] Fold multiple layers of LazyMapSequence/LazyMapCollection 2018-01-18 14:54:22 -08:00
Xiaodi Wu
7e03829aab Improve _binaryLogarithm implementation and add tests 2018-01-18 16:45:41 -06:00
Max Moiseev
6ac167dad4 Merge pull request #13707 from moiseev/strideable-pointer-perf
🛑[stdlib] Attempt to dispatch pointer + via Strideable conformance
2018-01-17 14:46:47 -08:00
Mark Lacey
be6d83ce74 Restore ImplicitlyUnwrappedOptional extension conforming to _ObjectiveCBridgeable.
Partial revert of 26f6a751c4.

Removing this breaks bridging these values to Objective C. Once IUOs
are removed from the type system and ImplicitlyUnwrappedOptional<T> is
removed from the library, we'll be strictly using Optional<T> which
has this conformance as well.

Fixes: rdar://problem/36477954, https://bugs.swift.org/browse/SR-6764
2018-01-16 23:12:27 -08:00
Ben Cohen
ca6c6b1d36 [stdlib] Cleanup DefaultIndices, delete dead code (#13952)
* Remove a bunch of Default(Bidirectional|RandomAccess)Indices usage from stdlib and test

* Remove some DefaultRandomAccessIndices and IndexDistance usage from Foundation

* Remove no-longer-used internal type in Existentials.swift

* Get rid of indicesForTraversal
2018-01-15 13:48:08 -08:00
Ben Cohen
e2cc88269e Remove underscore from ArrayProtocol 2018-01-14 20:23:20 -08:00
Ben Cohen
7b7ef56097 Fix some warnings about use of DefaultRandomAccessIndices 2018-01-13 19:49:39 -08:00
swift-ci
9b58ed0ad7 Merge pull request #13884 from DougGregor/runtime-substitution-mangled-to-metadata 2018-01-12 13:43:10 -08:00
Slava Pestov
6faf99b97b stdlib: The runtime counters types don't need fixed layout 2018-01-12 00:06:03 -08:00
Doug Gregor
cd1bd20fce [Runtime mangling -> meadata] Support type parameter substitutions.
Extend _typeByMangledName with support for user-provided type parameter
substitutions, where type parameters that occur in the mangling can be
replaced with specific types.
2018-01-11 11:08:57 -08:00
Max Moiseev
5650f80937 [stdlib] Annotate types with @_fixed_layout
This will allows us to build the standard library in resilient mode by
default, hopefully, without performance regression.

<rdar://problem/36362648>
2018-01-09 14:46:30 -08:00
Max Moiseev
c8b12ee282 [stdlib] Adding derived equality/comparison operators to concrete integer types 2018-01-08 17:19:12 -08:00
Max Moiseev
531a5eb582 [stdlib] Dispatch pointer arithmetic operators via Strideable conformance 2018-01-08 15:46:28 -08:00
Max Moiseev
3dbbd07d72 Merge pull request #13782 from xwu/generic-conversions
[stdlib] [SE-0067] Implement generic conversions to floating point
2018-01-08 11:14:53 -08:00
Max Moiseev
6513571487 Merge pull request #13653 from xwu/patch-3
[stdlib] Fix bug in String(_:radix:uppercase:)
2018-01-08 11:11:58 -08:00
Doug Gregor
f1821c6f9a [Runtime] Remove the older _getTypeByName entry point.
_getTypeByMangledName() is more general and will be the way forward. Use
that instead. Note that we're still keeping around Foundation-only SPI
function _typeByName() in the Swift standard library, until we settle
on what the standard library API should be like for this functionality.
2018-01-07 00:01:33 -08:00
Xiaodi Wu
a1779df06b Revise implementation and tests for NaN conversions 2018-01-07 01:25:25 -06:00
Xiaodi Wu
d965a13c44 Implement generic conversions to floating point 2018-01-06 19:03:23 -06:00
Pavel Yaskevich
a1f4c48d57 Merge pull request #13775 from xedin/rdar-36333688
[CSRanking] Fix self types to be unrelated when comparing operator decls
2018-01-06 01:40:37 -08:00