Commit Graph

5263 Commits

Author SHA1 Message Date
Karoy Lorentey
0463230e2f [stdlib] _SliceBuffer: Make the order of fields a bit more sensible
Also, move field declarations to the top of the struct.
2018-11-15 09:54:25 +00:00
Karoy Lorentey
ee17e975ca [stdlib] Make protocol _NSArrayCore internal
These shadow protocols don’t add any real type safety, and exposing them in the ABI seems unnecessary.
2018-11-15 09:54:25 +00:00
Karoy Lorentey
c71abaaf51 [stdlib] Make protocol _NSNumber internal 2018-11-15 09:54:25 +00:00
Karoy Lorentey
4f8eeae64e [stdlib] Make _NSSetCore, _NSSet internal
These shadow protocols don’t add any real type safety, and exposing them in the ABI seems unnecessary.
2018-11-15 09:54:25 +00:00
Karoy Lorentey
096903732c [stdlib] Make _NSDictionaryCore, _NSDictionary internal
These shadow protocols don’t add any real type safety, and exposing them in the ABI seems unnecessary.
2018-11-15 09:54:25 +00:00
Maxim Moiseev
51bd2f1856 Fix abi_v7k.swift test
The test seems to rely on the fact that Double.init(_: Int) gets inlined
in -Onone.

Fixes: <rdar://problem/45306568>
2018-11-14 16:20:09 -08:00
Brent Royal-Gordon
e0a267064a Improve an explanatory comment in Dictionary (#20540)
It took me a little while to figure out why we were fatalError()ing in such a convoluted way in Dictionary.init(uniqueKeysWithValues:); the next person to look at this code won’t waste that time.
2018-11-14 14:47:03 -08:00
swift-ci
b02e48f168 Merge pull request #20566 from weissi/jw-uni-decoder-doc-fix 2018-11-14 14:44:27 -08:00
Lance Parker
d08f49d561 audit ArrayCasts @inlinable attributes 2018-11-14 13:22:51 -08:00
Maxim Moiseev
cbf83ac04f [NFC][stdlib] Add FIXME markers to simplify audit 2018-11-14 11:58:42 -08:00
Ben Cohen
df2307e035 [stdlib][DNM] Collapse sequence and collection wrappers (#20221)
* Concretize dropFirst/Last/sufix/prefix from Sequence

Remove split customization point

Eliminate SubSequence from Sequence protocol

Collapse LazyCollection

Collapse LazyMapCollection

Eliminate _SequenceWrapper

Collapse LazyFilterCollection

Collapse LazyDrop/PrefixWhileCollection

Fix tests, ABI stability update

Collapse FlattenSequence

* Add entries to source/ABI compatible expected results.

* Update tests to avoid pre-10.14 objc runtime bug

* Expunge _preprocessingPass
2018-11-14 10:05:58 -08:00
Johannes Weiss
11b6bb3417 fix documentaion for the Unicode.ParseResult
The previous documentation was not accurate. It said that the length of
the error returned would be the length of the valid prefix. In case of
no valid prefix however the code will still return 1, contrary to the
documentation.
I fixed the documentation by adding the guarantee that the error length
will always be positive and removing the information about the valid
prefix as we might want to change the precise algorithm in the future.
2018-11-14 12:13:42 +00:00
Slava Pestov
eb147d9ec6 Merge pull request #20531 from slavapestov/inline-always-is-not-inlinable
@inline(__always) should not imply @inlinable
2018-11-13 20:39:35 -05:00
Slava Pestov
f6c2caf64b stdlib: Add @inlinable to @inline(__always) declarations
These should be audited since some might not actually need to be
@inlinable, but for now:

- Anything public and @inline(__always) is now also @inlinable
- Anything @usableFromInline and @inline(__always) is now @inlinable
2018-11-13 15:15:07 -05:00
Karoy Lorentey
735b6ea142 Merge pull request #20519 from lorentey/collection-layout-fixedness
[stdib] Audit @_fixed_layout on collection storage classes
2018-11-13 10:37:02 +00:00
Doug Gregor
7b8bbcd473 [Keypaths] Start using mangled type names for non-dependent types.
When a type in keypath metadata is non-dependent, use a mangled type name
rather than a symbolic reference to an accessor function.

Part of rdar://problem/38038799.
2018-11-12 21:15:20 -08:00
Doug Gregor
b192cedf8d [Keypaths] Use mangled names to reference type and witness table accessors.
Switch key path metadata over to mangled names for each of the places it
refers to either a type metadata accessor or a witness table accessor. For
now, the mangled name is a symbolic reference to the existing accessors.

Part of rdar://problem/38038799.
2018-11-12 21:15:20 -08:00
Karoy Lorentey
ca09281b34 [stdlib] Let’s try leaving Set/Dictionary storage non-fixed as an experiment
The current ivars are all defined in the parent class, so (provided my mental model of how this works is correct) this may make some actual sense.
2018-11-12 21:01:23 +00:00
Karoy Lorentey
671de071c6 [stdlib] Audit @_fixed_layout usage in collection storage classes
- Remove __SwiftNativeNSEnumerator from the ABI. (It’s only used in internal classes and in the Objective-C runtime.)
- Remove inlinability of init() and deinit for all the __SwiftNativeNSFoo superclasses except Array’s and Data’s.
2018-11-12 20:53:10 +00:00
Karoy Lorentey
08c813769a [stdlib] Make _Unwrappable internal and rename func unwrap() to _unwrap()
_Unwrappable isn’t used in inlinable context.
2018-11-12 16:57:59 +00:00
Dale Buckley
15e8fd2b0f Split Range Codable extensions down to Encodable and Decodable extensions 2018-11-12 14:58:11 +00:00
Michael Ilseman
9315b3a190 Merge pull request #20438 from milseman/uniterator
[String] Custom Iterators for String Views
2018-11-11 16:14:13 -08:00
John McCall
44e0f44040 Merge pull request #20493 from rjmccall/keypath-compiler-abi
Change the compiler ABI of keypaths.
2018-11-10 14:18:44 -05:00
Max Moiseev
9d0c97e05d Merge pull request #20470 from moiseev/bridge-inlinable
[stdlib] Audit inlinability in BridgeObjectiveC [WIP]
2018-11-10 10:37:52 -08:00
John McCall
3e5165d1ab Change the compiler ABI of keypaths.
Previously, the stdlib provided:

- getters for AnyKeyPath and PartialKeyPath, which have remained;

- a getter for KeyPath, which still exists alongside a new read
  coroutine; and

- a pair of owned mutable addressors that provided modify-like behavior
  for WritableKeyPath and ReferenceWritableKeyPath, which have been
  replaced with modify coroutines and augmented with dedicated setters.

SILGen then uses the most efficient accessor available for the access
it's been asked to do: for example, if it's been asked to produce a
borrowed r-value, it uses the read accessor.

Providing a broad spectrum of accessor functions here seems acceptable
because the code-size hit is fixed-size: we don't need to generate
extra code per storage declaration to support more alternatives for
key paths.

Note that this is just the compiler ABI; the implementation is still
basically what it was.  That means the implementation of the setters
and the read accessor is pretty far from optimal.  But we can improve
the implementation later; we can't improve the ABI.

The coroutine accessors have to be implemented in C++ and used via
hand-rolled declarations in SILGen because it's not currently possible
to declare independent coroutine accessors in Swift.
2018-11-10 02:08:04 -05:00
John McCall
09cfb81571 Fix a bug with key paths that could lead to exclusivity crashes. 2018-11-10 02:08:04 -05:00
Maxim Moiseev
ef1050f3fd [stdlib] Audit inlinability in BridgeObjectiveC
<rdar://problem/45949961>
2018-11-09 21:26:07 -08:00
Richard Wei
aeadc14f32 Merge branch 'master' into additive-arithmetic 2018-11-09 17:27:22 -08:00
Michael Ilseman
b19f8ccda6 Merge pull request #20480 from milseman/fixed_nixed
[stdlib] Expunge FixedArray from ABI
2018-11-09 16:15:29 -08:00
swift-ci
40f45f7c67 Merge pull request #20477 from eeckstein/stringswitch-abi 2018-11-09 15:35:14 -08:00
Michael Ilseman
24a95992f9 Merge branch 'master' into uniterator 2018-11-09 15:08:25 -08:00
swift-ci
8e4503abed Merge pull request #20479 from milseman/dce 2018-11-09 14:42:46 -08:00
Richard Wei
c0268518df Merge branch 'master' into additive-arithmetic 2018-11-09 14:28:36 -08:00
Erik Eckstein
1a02650c25 stdlib: remove all FIXME(sil-serialize-all) attributes in StringSwitch.swift
Those attributes were generated automatically, but are not needed.
All the annotated declarations are only used stdlib internally

rdar://problem/45927899
2018-11-09 14:27:29 -08:00
Karoy Lorentey
faa535ffb2 Merge pull request #20463 from lorentey/remove-random-fill
[stdib] Remove RandomNumberGenerator._fill(bytes:)
2018-11-09 21:51:35 +00:00
Michael Ilseman
08d83d0678 [stdlib] Expunge FixedArray from ABI 2018-11-09 13:47:22 -08:00
Michael Ilseman
4ddfd30787 [stdlib] Remove dead code 2018-11-09 13:39:59 -08:00
Harlan Haskins
703c5715cf Merge pull request #20320 from Azoy/random-readability
[QoI][stdlib] Improve some random call sites
2018-11-09 11:31:43 -08:00
Richard Wei
4e2147e6f8 Merge branch 'master' into additive-arithmetic 2018-11-09 10:17:58 -08:00
Michael Ilseman
103861b31f Merge branch 'master' into uniterator 2018-11-09 10:17:05 -08:00
Karoy Lorentey
51be8c7650 [stdib] Remove RandomNumberGenerator._fill(bytes:)
This hidden customization point isn’t used in the stdlib anymore.
2018-11-09 17:37:25 +00:00
Johannes Weiss
17e5fa3506 Merge pull request #19421 from weissi/jw-managed-buffer-realloc
implement ManagerBuffer.reallocated to allow realloc'ing the storage
2018-11-09 17:14:08 +00:00
Ben Cohen
6aab1c8b0d Remove last addressWithNativeOwner use (#20448) 2018-11-09 06:22:13 -08:00
Karoy Lorentey
adb5627bc2 [stdlib] AnyHashable: Audit remaining inlinability fixmes 2018-11-09 10:37:20 +00:00
Karoy Lorentey
713ff13d58 [stdlib] ManagedBufferPointer: inlinability audit & slight reorganization 2018-11-09 10:37:20 +00:00
Karoy Lorentey
e3a5750aa3 [stdlib] ManagedBufferPointer: Remove _My typealias. 2018-11-09 10:37:20 +00:00
Karoy Lorentey
5efa3755f3 [stdlib] Leave _SwiftNewtypeWrapper hashing/bridging methods inlinable
Newtypes are paper-thin wrappers, so it makes sense for their methods to be inlinable.
2018-11-09 10:37:20 +00:00
Michael Ilseman
75943350d2 [String] Give String a custom iterator
Gives us modest wins on complex grapheme strings, but up to 40% on
heavy-ASCII strings.
2018-11-08 18:25:01 -08:00
Michael Ilseman
abe101c5b9 [String] Custom iterator for UnicodeScalarView
Provide a custom iterator rather than relying a the IndexingIterator,
as an indexing model is less efficient for stateful processing of
strings. Provides around a 30% speedup.
2018-11-08 18:00:39 -08:00
Richard Wei
da50193c93 Update ABI test 2018-11-08 17:07:16 -08:00