Commit Graph

7767 Commits

Author SHA1 Message Date
Andrew Trick
42e43f7ea0 Add sliceability tests for Unsafe(Raw)BufferPointer.
Improve the generic sliceability tests to verify that SubSequence indices are
compatible with their parents indices.
2017-04-06 17:12:18 -07:00
Andrew Trick
da0c4db530 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.
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
Philippe Hausler
dad680f0b0 Merge pull request #8543 from phausler/data_subscript_ranges
[Foundation] Ensure data can be subscripted with all range types
2017-04-05 12:49:04 -07:00
Max Moiseev
9feb799c6d Adding an explicit type context 2017-04-05 11:21:50 -07:00
Philippe Hausler
e422db587d [Foundation] Bridged dispatch_data_t to NSData to Data should enumerate bytes with the offset not the length parameter as the byte index 2017-04-05 10:31:43 -07:00
Philippe Hausler
32e461709e [Foundation] Ensure data can be subscripted with all range types 2017-04-05 08:56:07 -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
42095bfbaa Merge branch 'master' into new-integer-protocols 2017-04-04 11:00:47 -07:00
Doug Coleman
7054139c60 [cmake]: Be explicit about overlay platforms for compiling standalone.
The ALL_APPLE_PLATFORMS idiom is wrong because any new platforms that
get added will not have dependencies by default and it's breaking the
standalone overlay script for platforms that use it. Moreover, some of the
overlays list all platforms even though they could have used
ALL_APPLE_PLATFORMS.
2017-04-03 21:00:05 -07:00
Maxim Moiseev
0d521da5fe [overlay] Rename CocoaError.Code.serviceMiscellaneous to serviceMiscellaneousError (#8517)
Fixes: rdar://problem/31108956
2017-04-03 16:25:26 -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
e0c7e7cfb4 [gardening] Fix indentation. 2017-04-03 09:07:20 +02:00
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
86d8fa9e51 [ObjectiveC] Resolve warning about deprecated @objc inference 2017-03-31 21:53:58 -07:00
Doug Gregor
e5267f5d13 [SceneKit] Address deprecated @objc inference warnings. 2017-03-31 21:53:57 -07:00
Doug Gregor
7c7652f3fc [AppKit] Address deprecated @objc inference warnings. 2017-03-31 21:53:57 -07:00
Doug Gregor
e4e9a63298 [Foundation] Address deprecated @objc inference warnings.
Another 15 unnecessary Objective-C entry points eliminated.
2017-03-31 21:53:56 -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
Doug Gregor
5b3fe49cd0 [SE-0160] Log uses of @objc thunks emitted due to deprecated @objc inference.
Introduce a new runtime entry point,
`swift_objc_swift3ImplicitObjCEntrypoint`, which is called from any
Objective-C method that was generated due to `@objc` inference rules
that were removed by SE-0160. Aside from being a central place where
users can set a breakpoint to catch when this occurs, this operation
provides logging capabilities that can be enabled by setting the
environment variable SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT:

  SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT=0 (default): do not log
  SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT=1: log failed messages
  SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT=2: log failed messages with
  backtrace
  SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT=3: log failed messages with
  backtrace and abort the process.

The log messages look something like:

    ***Swift runtime: entrypoint -[t.MyClass foo] generated by
       implicit @objc inference is deprecated and will be removed in
       Swift 4
2017-03-31 21:22:16 -07:00
Doug Gregor
cd811edb14 [Runtime] Add a “swift::warning” entrypoint for runtime warnings.
Like swift::fatalError(), but without the abort or crash logging.
2017-03-31 21:22:16 -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
Daniel Duan
4e5dbed41a Test: use StdlibUnittest in BridgeNonVerbatim
Convert tests in BridgeNonVerbatim.swift to use StdlibUnittest.

Also add a function that compares references in StdlibUnittest.
2017-03-29 01:09:53 -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
Arnold Schwaighofer
67e3d27fd9 Copy-on-write existential performance work (#8369)
* IRGen: Change c-o-w existential implementation functions

* initialzeBufferWith(Copy|Take)OfBuffer value witness implementation for cow existentials

Implement and use initialzeBufferWith(Copy|Take)OfBuffer value witnesses for
copy-on-write existentials.

Before we used a free standing function but the overhead of doing so was
noticable (~20-30%) on micro benchmarks.

* IRGen: Use common getCopyOutOfLineBoxPointerFunction

* Add a runtime function to conditionally make a box unique

* Fix compilation of HeapObject.cpp on i386

* Fix IRGen test case

* Fix test case for i386
2017-03-27 20:51:02 -07:00
Max Moiseev
969b4814e2 Merge branch 'master' into new-integer-protocols 2017-03-27 20:40:15 -07:00
Max Moiseev
2f5fd8e2ed Improving benchmarks 2017-03-27 14:59:27 -07:00
Erik Eckstein
e427ded6c9 Mangling: refactoring: clean up tuple nodes
Replace VariadicTuple and NonVariadicTuple with a single Tuple node.
The variadic property is now part of the tuple element and not of the whole tuple.
2017-03-25 19:07:52 -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