Commit Graph

3245 Commits

Author SHA1 Message Date
Michael Ilseman
7a05d867e5 [stdlib] Disable Unicode 9 test on Linux, depends on ICU version 2017-05-10 15:25:24 -07:00
Michael Ilseman
6903dd3256 [stdlib] Add Unicode 9 grapheme break tests for flags, emoji, etc. 2017-05-10 15:21:09 -07:00
Michael Ilseman
0c0d08369d [stdlib] Introduce Thread Local Storage
Introduces a _ThreadLocalStorage struct to hold thread-local, but
global resources. Set it up to host a UBreakIterator and a cache key
for resetting text.

UBreakIterators are extremely expensive to create on the fly, so we
store one for each thread. UBreakIterators are also expensive to bind
to new text, so we cache the text it's currently bound to in order to
help avoid it.

The struct can be expanded with more functionality in the future, but
the standard library should only ever use a single key, and thus
everything should go on this struct. The _ThreadLocalStorage struct is
not meant to be copyable, creatable (by anyone else except the
once-per-thread initialize routine), and should accessed through the
pointers it provides.

Future immediate directions could include cashing multiple
UBreakIterators (e.g. avoid a text reset for mutual character
iteration patterns, etc).

Test added in test/stdlib/ThreadLocalStorage.swift.
2017-05-10 15:21:08 -07:00
Vivian Kong
053832914e Fix for initFromArray test on big endian 2017-05-10 09:29:12 -04:00
swift-ci
c352f98ae9 Merge pull request #9428 from practicalswift/gardening-20170509b 2017-05-09 15:01:08 -07:00
practicalswift
49ed8579c4 [gardening] Use American English. 2017-05-09 20:44:30 +02:00
Joe Groff
63c8123a22 Remove workarounds for 31725007 from KeyPathImplementation test. 2017-05-09 10:52:57 -07:00
Erik Eckstein
dfa6582df6 runtime: make the objc runtime mangling of AnyObject compatible to the swift 3 mangling 2017-05-08 17:58:43 -07:00
swift-ci
b0d138eb94 Merge pull request #9390 from moiseev/flatMap 2017-05-08 14:46:55 -07:00
Erik Eckstein
07cc2831df runtime: Add support for objc runtime mangling of ProtocolListWithClass and ProtocolListWithAnyObject nodes 2017-05-08 11:35:08 -07:00
Max Moiseev
e6b0e3c7fb [stdlib] Removing the deprecated flatMap overload
The following code behaves incorrectly due to the presence of this
overload.

let a: Int = 1
let b: Int? = 2
let c: Int? = nil
let result: [Any] = [a, b, c].flatMap { $0 }

Fixes: <rdar://problem/31910642>
2017-05-08 11:26:31 -07:00
Philippe Hausler
ffc594bd20 [Foundation] Performance improvements for IndexPath bridging and comparison (#9339)
* [Foundation] Refactor the backing of IndexPath to favor stack allocations

The previous implementation of IndexPath would cause a malloc of the underlying array buffer upon bridging from ObjectiveC. This impacts graphical APIs (such as UICollectionView or AppKit equivalents) when calling delegation patterns. Since IndexPath itself can be a tagged pointer and most often just a pair of elements it can  be represented as an enum of common cases. Those common cases of empty, single, or pair can be represented respectively as no associated value, a single Int, and a tuple of Ints. These cases will be exclusively stack allocations, which is markably faster than the allocating code-path. IndexPaths that have a count greater than 2 will still fall into the array storage case. As an added performance benefit, accessing count and subscripting is now faster by aproximately 30% due to more tightly coupled inlining potential under whole module optimizations. Accessing count is also faster since it has better cache-line effeciency (lesson learned: the branch predictor is more optimized than pointer indirection chasing).

Benchmarks performed on x86_64, arm and arm64 still pending results but should be applicable across the board.

Resolves the following issues:
https://bugs.swift.org/browse/SR-3655
https://bugs.swift.org/browse/SR-2769

Resolves the following radars:
rdar://problem/28207534
rdar://problem/28209456

* [Foundation] remove temp IndexPath hashing that required bridging to ref types

* [Foundation] IndexPath does not guarentee hashing to be the same as objc
2017-05-06 12:39:45 -07:00
swift-ci
85e20af4f5 Merge pull request #7429 from phausler/correct_unconditionally_bridge 2017-05-05 18:41:25 -07:00
Max Moiseev
b72e95f5f7 Adding tests for the removed < overloads 2017-05-05 10:51:32 -07:00
Joe Groff
cb26cd76bf Reenable KeyPath.appending tests that were crashing the type checker.
rdar://problem/31724834 appears to have been fixed.
2017-05-05 09:11:14 -07:00
Ted Kremenek
cb7ad7d785 Merge pull request #9162 from phausler/safe_nsnumber
[Foundation] Implementation of SE-0170 for safer NSNumber bridging
2017-05-04 13:30:31 -07:00
Philippe Hausler
a9600338c8 [Foundation] Disable more NSNumber test failures due to incorrect float representations 2017-05-04 11:03:20 -07:00
Jordan Rose
c8d3506e55 Revert "[Mangling] Uniformly use "So" for imported decls." (#9233)
This reverts commit 25985cb764. For now,
we're trying to avoid spurious non-structural changes to the mangling,
so that the /old/ mangling doesn't appear to change. That doesn't mean
no changes at all, but we can save this one for later.
2017-05-03 16:13:29 -07:00
Philippe Hausler
0011117a20 [Foundation] Work-around ambiguity of initializers by avoiding using bitPattern in literal cases that could be claimed as double values 2017-05-03 12:56:03 -07:00
Erik Eckstein
c4002a9398 Use the old mangling for generic ObjC runtime names, which are generated at runtime.
To be backward compatible to existing archives created by the NSKeyedArchiver for generic classes
2017-05-03 10:52:54 -07:00
Joe Groff
7913e9821b Merge pull request #9214 from jckarter/keypaths-32-bit
Support key paths on 32-bit platforms.
2017-05-02 20:36:07 -07:00
Joe Groff
525001f7a7 Support key paths on 32-bit platforms.
I had optimistically written the code here optimistically hoping #7837 would land in time for me to merge, but that didn't happen, so adjust some things to match the current 12-byte object header size on 32-bit, and introduce some ABI constants for the expected 32- and 64-bit object header sizes we can assert against so that we have some robustness when it eventually changes again. Implements rdar://problem/31768303.
2017-05-02 18:19:07 -07:00
swift-ci
cd04e2680f Merge pull request #9205 from huonw/keypath-syntax 2017-05-02 16:52:30 -07:00
Huon Wilson
a6f5f167e7 [test] Fix #keyPath2/\ validation tests. 2017-05-02 14:52:34 -07:00
Philippe Hausler
d9ae358b05 Rename NSNumber bridge tests to be clear on what they do 2017-05-02 09:30:35 -07:00
Joe Groff
224120f54b SIL: Don't DFE functions referenced from KeyPath patterns.
Fixes rdar://problem/31776015.
2017-05-01 17:32:50 -07:00
Maxim Moiseev
bba33f345f Merge pull request #9154 from moiseev/joined-string
[stdlib] New overload for joined()
2017-05-01 16:26:24 -07:00
Philippe Hausler
5b4d913a54 Merge branch 'master' into correct_unconditionally_bridge 2017-05-01 15:17:36 -07:00
Bob Wilson
32ff6de1cb Change REQUIRES arguments to work with recent LLVM versions
With more recent versions of LLVM (e.g., used with master-next) the
argument of REQUIRES is parsed as an expression. Do not use "rdar"
URLS for these since it confuses lit.
2017-05-01 15:15:22 -07:00
Max Moiseev
288eee0b1b [stdlib] New overload for joined()
Now that `String` conforms to the `BidirectionalCollection` protocol, in
the expression `let x = [""].joined()` the best matching overload for
`joined` is no longer the one returning `String`.

Fixes: <rdar://problem/31899440>
2017-05-01 12:41:57 -07:00
swift-ci
2dce594005 Merge pull request #9143 from apple/revert-9139-revert_8710 2017-04-30 18:49:17 -07:00
Robert Widmann
29fa10b4c0 Merge pull request #9141 from CodaFi/float-on
Un-XFAIL floating point test in resilient mode
2017-04-30 21:32:16 -04:00
swift-ci
8790997723 Merge pull request #9140 from airspeedswift/xfail-resilient-range 2017-04-30 17:37:17 -07:00
Ben Cohen
38903764df Revert "Revert "[stdlib] One-sided ranges and RangeExpression (#8710)"" 2017-04-30 16:47:23 -07:00
Robert Widmann
53ea193134 Un-XFAIL floating point test in resilient mode 2017-04-30 19:13:51 -04:00
ben-cohen
a7cf116e8f XFAIL RangeTraps.CountablePartialRangeFrom in resilient mode 2017-04-30 16:11:35 -07:00
Arnold Schwaighofer
7d5d63eaf8 Revert "[stdlib] One-sided ranges and RangeExpression (#8710)"
This reverts commit 946b776e37.
2017-04-30 15:51:16 -07:00
Nate Cook
ad8d5a97ec [stdlib] Stop precounting lazily filtered collections (#8038)
This eliminates the counting step for a lazy filtered collection
when converting it into an array by treating the collection
as a sequence when copying elements. FlattenCollections already
have this behavior. (SR-4164)
2017-04-30 13:37:28 -07:00
Itai Ferber
d177bdf748 Add preliminary {JSON,Plist}Encoder tests 2017-04-28 23:38:27 -07:00
Ted Kremenek
749e05ba13 Merge pull request #8861 from tkremenek/ver-4-bump
Bump Swift version to 4.0
2017-04-28 14:03:55 -07:00
Ben Cohen
946b776e37 [stdlib] One-sided ranges and RangeExpression (#8710)
* One-sided ranges and RangeExpression

* Remove redundant ClosedRange methods from String

* Fix up brittle tests

* Account for Substring update

* XFAIL range diagnostics on Linux
2017-04-28 12:59:04 -07:00
Erik Eckstein
b7ba524607 Add a test case for non-ascii module names.
With the old remangler this test crashed at runtime when trying to create the mangled name for a class with a non-ascii module name.

rdar://problem/31875699
2017-04-28 08:56:47 -07:00
Ted Kremenek
ef98f2bd2a Merge branch 'master' into ver-4-bump 2017-04-27 23:19:14 -07:00
Maxim Moiseev
41b00c57ab Merge pull request #9044 from moiseev/substring-in
[stdlib] Substring
2017-04-26 19:25:59 -07:00
Max Moiseev
13da5f5c5f Removing warning in test 2017-04-26 12:31:35 -07:00
Max Moiseev
e1f502f6cd Swift 3 compatible String and Substring range subscripts 2017-04-26 12:13:43 -07:00
Michael Ilseman
111d6200eb Merge pull request #8979 from milseman/parse_my_tweets_faster
[stdlib] Parse my tweets faster! 2x forwards, 3x reverse
2017-04-26 07:36:18 -07:00
Michael Ilseman
fa61a665c5 [stdlib] Fix relative-offset computing bug in grapheme breaking.
Many of StringCore private APIs, when the StringCore is itself a
substring, expect relative offsets rather than absolute offsets. This
fixes a bug in the sub-0x300 fast path where we were using absolute
offsets. Test cases added.
2017-04-25 16:51:35 -07:00
Ted Kremenek
758d5d465a Resolve merge conflict. 2017-04-25 16:21:56 -07:00
Greg Parker
d7c5b31f32 Revert "[test] Temporarily disable test stdlib/Mirror.swift on armv7s."
This reverts commit 9681fbc59d.

This was a workaround for an LLVM bug that is now fixed.
2017-04-25 15:49:51 -07:00