Commit Graph

4464 Commits

Author SHA1 Message Date
Lance Parker
fd808f3ea7 [stdlib] De-gyb Arrays.swift.gyb (#16230)
De-gyb Array
2018-05-30 14:11:32 -07:00
swift-ci
fdbcfbca65 Merge remote-tracking branch 'origin/master' into master-next 2018-05-30 10:29:01 -07:00
Saleem Abdulrasool
477d43ef1c Merge pull request #16142 from compnerd/irgen-dllstorage
IRGen: the runtime is compacted into the stdlib
2018-05-30 10:27:29 -07:00
swift-ci
394ee32470 Merge remote-tracking branch 'origin/master' into master-next 2018-05-30 09:08:58 -07:00
Saleem Abdulrasool
283c00e41e IRGen: special case the handling for the stdlib
Because the runtime is compacted into the standard library, functions
which are normally imported are actually local definitions.  Use module
level named metadata to identify the module as being the swift standard
library.  Refactor the condition slightly to improve code readability.

This addresses SR-7107!
2018-05-29 15:39:32 -07:00
Erik Eckstein
47383e2f8e stdlib: let the construction of a small string literal compile down to 2 constant loads.
The main part of this is to rewrite the small string literal-constructor to work with values (= shifting bytes) instead of setting bytes in memory.
This allows the compiler to fold away everything and end up with the optimal code for small string literals.
2018-05-29 11:21:28 -07:00
Erik Eckstein
50f7ea5bb9 stdlib: improve existential collection performance for -Osize.
Making sure that makeIterator is always inlined, enables devirutalization of the iterator calls.
Inlining was not done with -Osize which resulted in pretty bad performance when iterating over an existential collection.
2018-05-29 11:01:03 -07:00
Erik Eckstein
72038b58a3 stdlib: change the representation of UnsafeBufferPointer from start+end pointers to start-pointer + count.
This saves a few instructions for some operations, like getting the count.
Also, it avoids the check for unwrapping the optional end pointer. For example, iterating over an unsafe buffer now has no overhead.

Also remove the _unboundedStartingAt initializer, which is not needed anymore.
2018-05-29 11:01:03 -07:00
Erik Eckstein
233c9c4f67 stdlib: use existing decodeCString for initializing a String with a null-terminated C string.
And remove the now unused _SentinelCollection utility.
2018-05-29 11:01:03 -07:00
swift-ci
13bd713a03 Merge remote-tracking branch 'origin/master' into master-next 2018-05-25 13:29:00 -07:00
Michael Ilseman
3ee17102ed [String.Index] Restore compound offsets.
Move the shifts to index creation time rather than index comparison
time. This seems to benefit micro benchmarks and cover up
inefficiencies in our generic index distance calculations.
2018-05-25 09:54:35 -07:00
Michael Ilseman
4ec98bb25c [String] Plumb more Substring.*View APIs through Slice
Rather than rely on (potentially inefficient) generic specializations,
plumb all Slice APIs explicitly from Substring.*View to
Slice<String.*View>.
2018-05-24 14:47:04 -07:00
Michael Ilseman
ebdd5e6d98 [string] Fast-path for small string comparison
Promote small-string to small-string comparison into the fast path for
equality and less-than.

Small ASCII strings that are not binary equal do not compare equal,
allowing us to early exit. Small ASCII strings otherwise compare
lexicographically, which we can call prior to jumping through a few
intermediaries.
2018-05-24 14:47:04 -07:00
Michael Ilseman
614016fecd [String.Index] Simplify and prepare for more resilience.
Simplify String.Index by sinking transcoded offsets into the .utf8
variant. This is in preparation for a more resilient index type
capable of supporting existential string indices.
2018-05-24 14:47:04 -07:00
Michael Ilseman
ba65638244 [string] Shrink String.Index to 2 words.
String.Index is 3 words in size, which means that Range<String.Index>
is 6, and Substring is 8 words total. This is pretty wasteful, so make
a very minor adjustment to the index cache's UTF-8 buffer to bring it
down to 2 words total.

Do other simplifications too.
2018-05-24 14:47:04 -07:00
swift-ci
ea76f95d25 Merge remote-tracking branch 'origin/master' into master-next 2018-05-19 09:09:28 -07:00
Michael Ilseman
1fe5fb717d [string] Skip allocation in reserveCapacity if smol
If the requested capacity is small enough to fit in our small string
representation, don't allocate a UTF-16 buffer, instead just return
early.
2018-05-18 21:26:59 -07:00
swift-ci
9736e559d4 Merge remote-tracking branch 'origin/master' into master-next 2018-05-18 10:09:40 -07:00
Nate Cook
7a4e0a32f6 [stdlib] Revise documentation
This includes various revisions to the APIs landing in Swift 4.2, including:
- Random and other randomness APIs
- Hashable changes
- MemoryLayout.offset(of:)
2018-05-18 11:31:54 -05:00
swift-ci
3913ec0465 Merge remote-tracking branch 'origin/master' into master-next 2018-05-17 16:49:27 -07:00
swift-ci
336e42ee2c Merge remote-tracking branch 'origin/master' into master-next 2018-05-17 15:09:01 -07:00
Ben Langmuir
628b6a1fc7 Revert "Turn on ‘as’ bridging on Linux." 2018-05-17 14:54:35 -07:00
swift-ci
e0c8c31b0b Merge remote-tracking branch 'origin/master' into master-next 2018-05-17 14:29:05 -07:00
Erik Eckstein
0868f2864b stdlib: make Sequence -> String inlinable
As this function is generic, it makes a big difference when it can be specialized for concrete sequences, like arrays or unsafe buffers.
This fixes a performance regression of String(decoding:as:), e.g. when constructing a String from a byte buffer.
2018-05-17 13:44:51 -07:00
Lily Vulcano
7b8db8f1fd Remove last vestige of printf debugging. 2018-05-17 10:03:40 -07:00
Lily Vulcano
b9455930ee Turn on ‘as’ bridging on Darwin. 2018-05-17 09:59:39 -07:00
Frederick Pietschmann
a0ea2d326d Fix typo and punctuation mark 2018-05-16 23:03:28 +02:00
swift-ci
32fff5e9c7 Merge remote-tracking branch 'origin/master' into master-next 2018-05-14 12:48:58 -07:00
Michael Ilseman
b2ad5b6f8a [string] Kill _StringGuts.Iterator
_StringGuts is not meant to be an abstraction across all the forms a
String may take. It's meant to abstract the book-keeping and the
visitor is a parameterization over operations.
2018-05-14 07:01:44 -07:00
Michael Ilseman
00e214ec50 [string] Clean up String.UTF8View
Extract slow paths into non-inlinable functions so that fast-paths can
be faster and we don't pay the large code bloat for the Unicode
parsers.

Some tests proactively extended to highlight UTF8View of multiple
kinds of Strings.
2018-05-14 07:01:38 -07:00
swift-ci
1c2dcbf398 Merge remote-tracking branch 'origin/master' into master-next 2018-05-13 16:46:06 -07:00
Michael Ilseman
6b7d316f50 [string] Fix 32-bit small string compilation failure 2018-05-13 07:38:55 -07:00
Michael Ilseman
4a368ab46c [string] Drop many @inlinable from big API.
Drop append-related @inlinable annotations for String, StringGuts,
StringStorage, and the Views. Drop several for larger operations, such
as case conversion. Drop as many as we can from StringGuts for now.
2018-05-13 07:38:55 -07:00
Michael Ilseman
b62241aba4 [string] Cleanup and remove init-from-CString inlinability 2018-05-13 07:38:55 -07:00
Michael Ilseman
459833725e [String] Streamline more String creation logic.
Streamline and de-genericize non-inlinable internal functions to
create a String from UTF-8 efficiently.
2018-05-13 07:38:55 -07:00
swift-ci
fbc685494f Merge remote-tracking branch 'origin/master' into master-next 2018-05-12 07:10:06 -07:00
Stephen Canon
f9f2fc34d9 Streamline integer-range randomElement. (#16501)
This is a small performance win; mainly I'm interested in simplifying the code so that there are fewer weird corners for bugs to creep in. Nonetheless, it seems to be about 5% faster with the (fast, dumb) LCG generator.
2018-05-12 07:06:46 -07:00
swift-ci
f58a0f2454 Merge remote-tracking branch 'origin/master' into master-next 2018-05-12 02:49:52 -07:00
Slava Pestov
89e48ff2e8 stdlib: change a var to a let to squash a warning 2018-05-12 01:48:29 -07:00
Slava Pestov
5385db2519 stdlib: Even more old spellings of @inlinable / @usableFromInline have snuck in 2018-05-12 01:48:24 -07:00
swift-ci
bed7dc124d Merge remote-tracking branch 'origin/master' into master-next 2018-05-10 16:09:03 -07:00
Andrew Trick
6a48b2d02d Merge pull request #16491 from atrick/enforce-keypath-exclusivity-as-error
Enforce keypath exclusivity as an error.
2018-05-10 16:03:01 -07:00
swift-ci
76c225ea0e Merge remote-tracking branch 'origin/master' into master-next 2018-05-10 10:49:15 -07:00
ravikandhadai
1c0d598a84 [stdlib] update the fatal error message displayed during invalid int-to-int conversions (<rdar://39542040>) (#16480) 2018-05-10 10:30:39 -07:00
swift-ci
8733e2bdaf Merge remote-tracking branch 'origin/master' into master-next 2018-05-10 09:49:16 -07:00
Saleem Abdulrasool
f4c24d6e2e Merge pull request #16403 from lanza/inspect-arch-sdk
Configure the swiftImageInspectionShared to generate arch & sdk speci…
2018-05-10 09:42:35 -07:00
swift-ci
6ac4a46348 Merge remote-tracking branch 'origin/master' into master-next 2018-05-10 09:29:08 -07:00
Doug Gregor
7cb8c18838 SE-0210: improve documentation comments per @natecook1000's comments. 2018-05-10 09:18:28 -07:00
swift-ci
b88aa1dfd0 Merge remote-tracking branch 'origin/master' into master-next 2018-05-10 03:49:16 -07:00
Karoy Lorentey
d282b1c541 Merge pull request #16413 from Azoy/random-unification
[stdlib] Random unification
2018-05-10 11:41:48 +01:00