Commit Graph

2952 Commits

Author SHA1 Message Date
Andrew Trick
8668f9bd72 Add init(rebasing:) to UnsafeBufferPointer.
This is required for consistency with UnsafeRawBufferPointer.
2017-04-06 17:12:18 -07:00
Andrew Trick
c12740a8a2 Add UnsafeRawBuffer(rebasing:) initializers.
Allows converting a raw slice into a zero-based raw buffer,
which is a common operation on flat memory.

Add and update UnsafeRawBufferPointer unit tests.
2017-04-06 17:12:18 -07:00
Andrew Trick
3782925a29 Give UnsafeRawBufferPointer a distinct slice type.
SubSequence = RandomAccessSlice<Self>
2017-04-06 17:12:18 -07:00
Joe Groff
631bb632d0 KeyPaths: Dummy out an AnyKeyPath._kvcKeyPathString property for ObjC interop in overlays. 2017-04-06 13:40:04 -07:00
Andrew Trick
849421799a Revert "SE-0138: Proposed amendment to SE-0138: Normalize UnsafeRawBufferPointer Slices (#8222)"
This reverts commit 1d32586d28.
2017-04-06 10:38:52 -07:00
Max Moiseev
8fe28b4e32 Merge branch 'master' into new-integer-protocols 2017-04-06 10:22:37 -07:00
Andrew Trick
1d32586d28 SE-0138: Proposed amendment to SE-0138: Normalize UnsafeRawBufferPointer Slices (#8222)
* Add sliceability tests for Unsafe(Raw)BufferPointer.

Improve the generic sliceability tests to verify that SubSequence indices are
compatible with their parents indices.

* Fix and enable testing stdlib Collection instances.

Top-level entry points fully testing a collection instance:
check${Traversal}Collection

One level of recursion into all slices of the collection instance
O(n^2). (Not combinatorial).

Previously, checkCollection() did nothing. So much of the testing infrastructure was inactive. Now it runs all forward collection tests.

Fixes a bug in subscriptRangeTests.

The UnsafeRawBufferPointer and Data collection testing is disabled and
will be fixed in the following commit.

* Give UnsafeRawBufferPointer a distinct slice type.

SubSequence = RandomAccessSlice<Self>

* Fix raw buffer pointer tests after changing the API

* Add UnsafeRawBuffer(rebasing:) initializers.

Allows converting a raw slice into a zero-based raw buffer,
which is a common operation on flat memory.

Add and update UnsafeRawBufferPointer unit tests.

* Do not run recursive O(n^2) collection slice testing on large collections.

Now, even with collection unit testing wired up, the validation tests
take the same amount of time to execute.

* Add init(rebasing:) to UnsafeBufferPointer.

This is required for consistency with UnsafeRawBufferPointer.

* Update CHANGELOG.md for SE-0138 amendment: UnsafeRawBufferPointer slice type.
2017-04-06 10:08:09 -07:00
Max Moiseev
4b201754c1 Replacing @_transparent with @inline(__always)
Mandatory inlining of a few very frequently used functions caused the
SIL size explosion, which in turn made the inliner use up to 6Gb of
memory to compile the standard library. @inline(__always) helps avoid
that without affecting benchmark results.

Related to: <rdar://problem/31375011>
2017-04-05 15:51:38 -07:00
Max Moiseev
9feb799c6d Adding an explicit type context 2017-04-05 11:21:50 -07:00
Joe Groff
d42f2049f7 KeyPaths: Implement in-place instantiation of invariant key paths.
For key paths without generic or subscript parameterization, we can turn the compiler-generated key path pattern into a global object in-place.
2017-04-05 08:46:45 -07:00
Max Moiseev
a1682a887c Speeding up the build by breaking complex expressions into smaller pieces 2017-04-04 16:29:54 -07:00
Joe Groff
f929c29bdf IRGen: Lower keypath instructions to patterns for the runtime to instantiate. 2017-04-04 11:31:15 -07:00
Joe Groff
f45abc0122 KeyPaths: Move layout constants to a shims header for sharing with compiler/runtime. 2017-04-04 11:31:15 -07:00
Joe Groff
5ed6bd831e KeyPaths: Dynamic appending between possibly-mismatched types.
Make the `appending` operation between `AnyKeyPath` and `PartialKeyPath` values work. Add a test checking the combinations.
2017-04-04 11:31:15 -07:00
Joe Groff
895ce94ae5 KeyPaths: implement "appending" 2017-04-04 11:31:15 -07:00
Joe Groff
04a6d23f7e KeyPaths: Equatable/Hashable implementation. 2017-04-04 11:31:15 -07:00
Joe Groff
cdbdb7a6e8 stdlib: Skeleton implementation of proposed KeyPath API.
Handles projection of stored struct and class properties. Most other functionality TODO.
2017-04-04 11:31:15 -07:00
Max Moiseev
10f0c9e89a Merge branch 'master' into new-integer-protocols 2017-04-03 11:49:56 -07:00
codestergit
aa9e9edc8a [Stdlib] Improves sort and sorted to accept throwing clousre
This commit resolves https://bugs.swift.org/browse/SR-715
2017-04-03 16:59:02 +05:30
practicalswift
ca72b12287 [gardening] Remove accidental \t:s 2017-04-02 16:03:54 +02:00
Nate Cook
e5eeb19726 [docs] Improve example hashValue implementation
The naive implementation in the original had even worse performance
than anticipated.
2017-04-01 15:07:04 -04:00
swift-ci
3c77cb7b07 Merge pull request #8379 from DougGregor/se-0160 2017-03-31 22:31:20 -07:00
Doug Gregor
cc225eb9fa [Stdlib] Silence all warnings about deprecated @objc inference.
This eliminates 26 Objective-C entry points that we never intended to expose, but that came “for free” with the @objc inference rules.
2017-03-31 21:53:55 -07:00
swift-ci
c8d2f179e7 Merge pull request #8464 from eeckstein/array-append-contentof 2017-03-31 17:59:36 -07:00
Philippe Hausler
ef7026a23e Merge pull request #8283 from phausler/characterset_perf
[Foundation] Rework the backing storage for CharacterSet to be more performant and bridge correctly to objective-c and CF
2017-03-31 15:49:32 -07:00
Erik Eckstein
9ce3df106e Add two new array semantics functions.
array.append_element(newElement: Element)
array.append_contentsOf(contentsOf newElements: S)

And allow early inlining of them.
Those functions will be needed to optimize Array.append(contentsOf)
2017-03-31 15:31:57 -07:00
Philippe Hausler
6c26b80e6e [Foundation] Rework the backing storage for CharacterSet to be more performant and bridge correctly to objective-c and CF
Some cases of using isSuperset can cause crashes, this was caused by improper subclassing callouts; this pr resolves those failures (and provides unit tests for that case)
The cases where the bridge was traversed too much now only causes a single bridge out call (without needing to reallocate or thrash retain/release)
String.components(separatedBy: CharacterSet) should be considerably faster now not only for more apporpriate bridging calls but also no longer needing to bridge arrays back and forth.

Resolves the following issues:
rdar://problem/17281998
rdar://problem/26611771
rdar://problem/29738989
2017-03-31 11:06:38 -07:00
Max Moiseev
3cbcd716f5 Merge branch 'master' into new-integer-protocols 2017-03-31 10:03:20 -07:00
Max Moiseev
b0c45481bf Adding an explicit type context for == 2017-03-30 12:30:03 -07:00
Max Moiseev
cd98994b9d Improving the performance of String.UTF8View 2017-03-30 10:22:30 -07:00
Philippe Hausler
bb674fe75a Merge pull request #6421 from phausler/dictionary_bridge_perf
Add a fast-path case for enumeration of keys and objects for bridged Dictionaries
2017-03-28 08:36:55 -07:00
Max Moiseev
2f5fd8e2ed Improving benchmarks 2017-03-27 14:59:27 -07:00
Max Moiseev
ec8e286b5c Merge branch 'master' into new-integer-protocols 2017-03-24 14:14:00 -07:00
Slava Pestov
2141c1515b stdlib: Remove obsolete FIXME: comment 2017-03-23 22:20:08 -07:00
Max Moiseev
2c9be47551 Merge branch 'master' into new-integer-protocols 2017-03-23 16:46:01 -07:00
Doug Gregor
2e283118e6 [Stdlib] Eliminate a warning about a redundant conformance 2017-03-22 17:35:15 -07:00
Doug Gregor
388f0c505e [Stdlib] Eliminate explicit constraints made redundant by inferred ones. 2017-03-22 17:35:12 -07:00
Max Moiseev
b9fb3badc8 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-03-22 12:30:24 -07:00
Dave Abrahams
1e8d069f75 [stdlib] SequenceWrapper: forward all requirements
One wants to take advantage of any optimization the Base Sequence may implement, especially because it will often be a Collection!
2017-03-18 13:20:03 -07:00
Dave Abrahams
365ef19cd4 [stdlib] SequenceWrapper: make it compile
Not sure why my local tests were compiling without this change, but clearly it is needed.
2017-03-18 12:28:55 -07:00
Dave Abrahams
7cfddace23 [stdlib] SequenceWrapper: ++principled simplicity
Not sure why the earlier version even compiled; the `Iterator.Element` types need to match up for most of these operations, and the `Iterator` types themselves need to match for some.
2017-03-18 12:05:54 -07:00
Dave Abrahams
639b04f7db [stdlib] _SequenceWrapper proposed simplification
I think the complexity of these condition extensions is unneeded, and may be vestigial from a time when the compiler was less cooperative.   Test this theory using CI
2017-03-18 11:47:32 -07:00
swift-ci
3e085fca4b Merge pull request #7946 from DougGregor/all-conformance-constraint-sources 2017-03-18 01:30:27 -07:00
Doug Gregor
13c4ae0168 [Standard library] Eliminate redundant conformance constraints.
Eliminate all of the redundant conformance constraints in the standard
library that were identified by the newly-introduced warning for
redundant, explicitly-specified conformances.
2017-03-17 20:15:09 -10:00
Roman Levenstein
2c811b82a1 Adjust some tests to pass in non-resilient and resilient modes. 2017-03-16 19:46:11 -07:00
Roman Levenstein
29ad714bb7 Annotate stdlib functions to get a good performance even in resilient mode, when -sil-serialize-all is disabled
This commit mostly improves the performance of arrays and ranges.
It does not cover Strings, Dictionaries and Sets yet.
2017-03-16 19:46:11 -07:00
Robert Widmann
81968e21ff Remove erroneous drop(while:) optimization
Calling drop(while: ) after prefix() on a pure Sequence loses the
prefix, because in the internal drop(while: ) override grabs the
underlying base iterator from _PrefixSequence and wraps it in a
_DropWhileSequence.
2017-03-15 17:01:13 -04:00
swift-ci
f89e3869f5 Merge pull request #8079 from samirGuerdah/fixTypo 2017-03-14 08:52:30 -07:00
samirMSTF
9d9cd82c59 Fix typo 2017-03-14 14:16:59 +01:00
Michael Gottesman
6d7b11c8eb [stdlib] Cleanup usage of Builtin.castToNativeObject(...).
Previously often times when casting a value, we would just pass along the
cleanup of the uncasted value. With semantic SIL this is no longer correct since
the cleanup now needs to be on the cast result.

This caused problems for certain usages of Builtin.castToNativeObject(...) by
the stdlib. Specifically, the stdlib was using this on AnyObject values that
were not necessarily native. Since we were recreating the cleanup on the native
value, a swift native release was being used =><=.

In this commit I solve this problem by:

1. Adding an assert in Builtin.castToNativeObject(...) that ensures that any value
passed to Builtin.castToNativeObject() is known conservatively to use swift
native reference counting.

2. I changed all uses where we do not have a precondition of a native ref
counting type to use Builtin.castToUnknownObject(...).

3. I added a new Builtin called Builtin.unsafeCastToNativeObject(...) that does
not have the compile time check. I used this to rewrite callsites in the stdlib
where we know via preconditions that an AnyObject will dynamically always be
native.

rdar://29791263
2017-03-14 00:10:16 -07:00