Commit Graph

4494 Commits

Author SHA1 Message Date
Nate Cook
653a4d89d2 [stdlib] Revise documentation comments
- Clarify RawValue requirement for OptionSet
- Make Bool counterexample more clearly an error
- Add clarifying note about unsafe arithmetic methods
- Add/refine complexity docs for sequence/collection
- Remove docs from obsoleted symbols
- Standardize on unicode.org for links about Unicode
- More complexity annotations
- Expand dictionary defaulted subscript docs
- Fix error in Dictionary.init(minimumCapacity:) docs
- Improve accuracy of prime number listing
2018-06-14 19:19:19 -05:00
swift-ci
ddb1e72c79 Merge remote-tracking branch 'origin/master' into master-next 2018-06-12 18:29:16 -07:00
swift-ci
875a0d797f Merge pull request #17064 from compnerd/bridge 2018-06-12 18:13:28 -07:00
Bob Wilson
796122fa45 Merge remote-tracking branch 'origin/master' into master-next 2018-06-12 15:06:47 -07:00
Doug Gregor
0f2de235c5 Merge pull request #15917 from DougGregor/evaluator
Introduce a simple request evaluator.
2018-06-12 10:41:08 -07:00
Saleem Abdulrasool
8409d29ca3 stdlib: unify AnyObject downcast
Now that bridging is enabled, unify the ObjC and non-ObjC paths.  Expand
the comment with how to efficiently grab the object reference and when
it can be enabled.
2018-06-12 09:50:54 -07:00
swift-ci
e7b949e94e Merge remote-tracking branch 'origin/master' into master-next 2018-06-09 23:49:27 -07:00
Slava Pestov
4e0e462d23 Rename a few remaining @_inlineable => @inlinable, @_versioned => @usableFromInline 2018-06-09 22:41:54 -07:00
swift-ci
83f5d1b79c Merge remote-tracking branch 'origin/master' into master-next 2018-06-07 16:29:38 -07:00
Erik Eckstein
063e5792b8 stdlib: small improvements for StringObject.
1) don't use stringObjectOr for plain integer bits masks
2) no need to clear the extra bits on initialization.
2018-06-07 13:43:34 -07:00
swift-ci
5dcf36afba Merge remote-tracking branch 'origin/master' into master-next 2018-06-07 11:09:40 -07:00
Dave Abrahams
0c7a091390 Use _halfStablePartition to implement partition and removeAll(where:) 2018-06-07 08:43:08 -07:00
swift-ci
b87ea23124 Merge remote-tracking branch 'origin/master' into master-next 2018-06-06 17:29:44 -07:00
Erik Little
863f3a19ff Rename @effects to @_effects
@effects is too low a level, and not meant for general usage outside
the standard library. Therefore it deserves to be underscored like
other such attributes.
2018-06-06 12:53:03 -04:00
swift-ci
5b16aad7c7 Merge remote-tracking branch 'origin/master' into master-next 2018-06-05 22:28:58 -07:00
Alejandro
f4a81d1368 Remove a warning, some doc fixes (#16863)
usableFromInline -> inlinable

More doc fixes

Add some more inlines
2018-06-06 00:13:14 -05:00
swift-ci
f11b43dd7a Merge remote-tracking branch 'origin/master' into master-next 2018-06-05 15:49:22 -07:00
Huon Wilson
46db3a1ecc Merge pull request #16662 from fredpi/patch-1
Fix typo and punctuation mark
2018-06-05 15:38:39 -07:00
swift-ci
4c4b778702 Merge remote-tracking branch 'origin/master' into master-next 2018-06-04 14:49:23 -07:00
Karoy Lorentey
325a63a1bd Merge pull request #16938 from lorentey/hashing-inlinable-audit
[stdlib] Audit inlinability of Hashable implementations
2018-06-04 14:36:20 -07:00
Doug Gregor
03aa3f189e [Standard library] Remove incorrect FIXME. 2018-06-01 08:56:18 -07:00
swift-ci
cf1bbe261d Merge remote-tracking branch 'origin/master' into master-next 2018-05-31 19:29:38 -07:00
Jordan Rose
cd5acad1b5 Remove unused property from _AnyHashableBox (#16926)
No functionality change.
2018-05-31 19:28:38 -07:00
Karoy Lorentey
bd802226fc [stdlib] Arrays: remove hashValue implementations
Remove hashValue implementations that can be generated by the compiler. (Modulo inlinability.)
2018-05-31 18:26:22 -07:00
Karoy Lorentey
07c1b74cc4 [stdlib] Audit inlinability of Hashable implementations
As a general rule, it is safe to mark the implementation of hash(into:) and _rawHashValue(seed:) for @_fixed_layout structs as inlinable.

However, some structs (like String guts, Character, KeyPath-related types) have complicated enough hashing that it seems counterproductive to inline them. Mark these with @effects(releasenone) instead.
2018-05-31 18:24:59 -07:00
swift-ci
568855a33c Merge remote-tracking branch 'origin/master' into master-next 2018-05-31 09:29:52 -07:00
Lily Vulcano
63348bce6f Merge pull request #16736 from millenomi/LinuxAsBridging_2
Turn on 'as' bridging for Linux (2)
2018-05-31 09:23:45 -07:00
Lily Vulcano
f7a28a8054 Strongly reduce the number of _typeByName() calls — cache the Foundation type, remove assertions. 2018-05-30 17:52:00 -07:00
Lily Vulcano
1377ab7d7e Turn on ‘as’ bridging on Darwin. 2018-05-30 15:07:22 -07:00
swift-ci
a8b1c204e1 Merge remote-tracking branch 'origin/master' into master-next 2018-05-30 14:29:08 -07:00
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