Commit Graph

108 Commits

Author SHA1 Message Date
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
Lance Parker
146fea489b update ABI checker test 2018-11-14 13:23:08 -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
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
Michael Ilseman
9315b3a190 Merge pull request #20438 from milseman/uniterator
[String] Custom Iterators for String Views
2018-11-11 16:14:13 -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
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
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
Karoy Lorentey
d6868edcf9 [test] Confess ABI changes 2018-11-09 10:38:15 +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
David Smith
96691208e9 Bridged Strings should have some different/additional overrides for performance 2018-11-08 11:08:03 -08:00
Richard Wei
b788e55a7d Update ABI test 2018-11-08 10:42:16 -08:00
Richard Wei
394be18449 Merge branch 'master' of github.com:apple/swift into additive-arithmetic 2018-11-08 10:20:13 -08:00
Ben Cohen
35f5ad131e Update ABI file 2018-11-08 07:11:29 -08:00
Ben Cohen
92d2959a46 Regroup ABI expected list by change 2018-11-08 06:45:20 -08:00
Richard Wei
bc8b623b9d Fix test 2018-11-07 20:14:27 -08:00
Richard Wei
44c2f7761a Implement SE-0233 AdditiveArithmetic 2018-11-07 19:43:13 -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
Maxim Moiseev
e107fab25b [stdlib] Internalize _Buffer32 and _Buffer72 2018-11-07 11:25:31 -08:00
Karoy Lorentey
825ac93f17 [test] Describe ABI changes 2018-11-07 14:11:31 +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
Maxim Moiseev
ca51626fd3 [stdlib] Move _stdlib_AtomicInt and friends out of the stdlib 2018-11-06 09:53:58 -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
Michael Ilseman
d112e5f20f [test] Dump in new API and ABI reference point
Put in the new API/ABI from UTF-8 String.
2018-11-04 10:42:44 -08:00
Brent Royal-Gordon
9bd1a26089 Implementation for SE-0228: Fix ExpressibleByStringInterpolation (#20214)
* [CodeCompletion] Restrict ancestor search to brace

This change allows ExprParentFinder to restrict certain searches for parents to just AST nodes within the nearest surrounding BraceStmt. In the string interpolation rework, BraceStmts can appear in new places in the AST; this keeps code completion from looking at irrelevant context.

NFC in this commit, but keeps code completion from crashing once TapExpr is introduced.

* Remove test relying on ExpressibleByStringInterpolation being deprecated

Since soon enough, it won’t be anymore.

* [AST] Introduce TapExpr

TapExpr allows a block of code to to be inserted between two expressions, accessing and potentially mutating the result of its subexpression before giving it to its parent expression. It’s roughly equivalent to this function:

  func _tap<T>(_ value: T, do body: (inout T) throws -> Void) rethrows -> T {
    var copy = value
    try body(&copy)
    return copy
  }

Except that it doesn’t use a closure, so no variables are captured and no call frame is (even notionally) added.

This commit does not include tests because nothing in it actually uses TapExpr yet. It will be used by string interpolation.

* SE-0228: Fix ExpressibleByStringInterpolation

This is the bulk of the implementation of the string interpolation rework. It includes a redesigned AST node, new parsing logic, new constraints and post-typechecking code generation, and new standard library types and members.

* [Sema] Rip out typeCheckExpressionShallow()

With new string interpolation in place, it is no longer used by anything in the compiler.

* [Sema] Diagnose invalid StringInterpolationProtocols

StringInterpolationProtocol informally requires conforming types to provide at least one method with the base name “appendInterpolation” with no (or a discardable) return value and visibility at least as broad as the conforming type’s. This change diagnoses an error when a conforming type does not have a method that meets those criteria.

* [Stdlib] Fix map(String.init) source break

Some users, including some in the source compatibility suite, accidentally used init(stringInterpolationSegment:) by writing code like `map(String.init)`. Now that these intializers have been removed, the remaining initializers often end up tying during overload resolution. This change adds several overloads of `String.init(describing:)` which will break these ties in cases where the compiler previously selected `String.init(stringInterpolationSegment:)`.

* [Sema] Make callWitness() take non-mutable arrays

It doesn’t actually need to mutate them.

* [Stdlib] Improve floating-point interpolation performance

This change avoids constructing a String when interpolating a Float, Double, or Float80. Instead, we write the characters to a fixed-size buffer and then append them directly to the string’s storage.

This seems to improve performance for all three types, but especially for Double and Float80, which cannot always fit into a small string when stringified.

* [NameLookup] Improve MemberLookupTable invalidation

In rare cases usually involving generated code, an overload added by an extension in the middle of a file would not be visible below it if the type had lazy members and the same base name had already been referenced above the extension. This change essentially dirties a type’s member lookup table whenever an extension is added to it, ensuring the entries in it will be updated.

This change also includes some debugging improvements for NameLookup.

* [SILOptimizer] XFAIL dead object removal failure

The DeadObjectRemoval pass in SILOptimizer does not currently remove reworked string interpolations as well as the old design because their effects cannot be described by @_effects(readonly). That causes a test failure on Linux. This change temporarily silences that test. The SILOptimizer issue has been filed as SR-9008.

* Confess string interpolation’s source stability sins

* [Parser] Parse empty interpolations

Previously, the parser had an odd asymmetry which caused the same function to accept foo(), but reject “\()”. This change fixes the issue.

Already tested by test/Parse/try.swift, which uses this construct in one of its throwing interpolation tests.

* [Sema] Fix batch-mode-only lazy var bug

The temporary variable used by string interpolation needs to be recontextualized when it’s inserted into a synthesized getter. Fixes a compilation failure in Alamofire.

I’ll probably follow up on this bug a bit more after merging.
2018-11-02 19:16:03 -07:00
Ben Cohen
dbc2e21522 Remove customization points from Sequence and Collection (#19995) 2018-10-31 18:58:00 -07:00
Karoy Lorentey
3ae170c1c1 [stdlib] Remove SipHash from ABI-visible names
Also, eliminate the (unused) SipHash24 implementation and nest most of Hasher’s internals under Hasher itself.
2018-11-01 00:45:40 +00:00
Karoy Lorentey
68b9b08cdd [stdlib] Add 256 bits of extra state to Hasher 2018-11-01 00:43:53 +00:00
Karoy Lorentey
80ebdfc17c [test] Update expected ABI changes 2018-10-31 12:19:52 +00:00
Ben Cohen
4381735269 Switch Zip2Sequence.init to be internal (#20148) 2018-10-30 18:08:06 -07:00
Ben Cohen
e8e169c11f Add removed methods to expected ABI breakage 2018-10-29 08:00:20 -07:00
Karoy Lorentey
21b75609b6 [test] Confess ABI changes 2018-10-27 01:12:26 +01:00
Karoy Lorentey
3aae412839 [test] Confess ABI changes 2018-10-27 00:17:56 +01:00
Karoy Lorentey
1195fcf0e0 [test] Update tests for _HeapBuffer changes 2018-10-26 23:53:34 +01:00
Karoy Lorentey
79b755c73c [test] Confess ABI changes 2018-10-26 21:49:39 +01:00
Xi Ge
334c46aabd swift-module-digester: update API/ABI baselines after recent format changes. 2018-10-25 15:14:53 -07:00
Ben Cohen
116dac1925 [stdlib] Uninline float description (#20038)
* Uninline float description

* Uninline _floatNNToString
2018-10-25 14:20:24 -07:00
Ben Cohen
f625f466c4 [stdlib] Simplify internal DropFirst/PrefixSequence types (#19970)
* Simplify internal DropFirstSequence type

* Simplify internal PrefixSequence type
2018-10-22 07:53:05 -07:00
Xi Ge
7177f4191b test: regenerate ABI/API stability baselines after recent fixes. 2018-10-08 14:05:17 -07:00