Commit Graph

7767 Commits

Author SHA1 Message Date
Dylan Brown
0e024a694b [Onone][prespecialize] Added iteration through reversed() arrays.
In response to [SR-3334], which pointed out a large cost to iteration over
ReversedRandomAccessCollections at optimization level -Onone. By adding
iteration through a.reversed() in the _Prespecialize struct, we can get to
about the same performance as forward iteration.
2016-12-27 00:00:18 +02:00
Joe Groff
0c9297862f Sema: Handle type-checking for withoutActuallyEscaping.
withoutActuallyEscaping has a signature like `<T..., U, V, W> (@nonescaping (T...) throws<U> -> V, (@escaping (T...) throws<U> -> V) -> W) -> W, but our type system for functions unfortunately isn't quite that expressive yet, so we need to special-case it. Set up the necessary type system when resolving an overload set to reference withoutActuallyEscaping, and if a type check succeeds, build a MakeTemporarilyEscapableExpr to represent it in the type-checked AST.
2016-12-22 17:51:26 -08:00
Joe Groff
1889fde228 Resolve type(of:) by overload resolution rather than parse hackery.
`type(of:)` has behavior whose type isn't directly representable in Swift's type system, since it produces both concrete and existential metatypes. In Swift 3 we put in a parser hack to turn `type(of: <expr>)` into a DynamicTypeExpr, but this effectively made `type(of:)` a reserved name. It's a bit more principled to put `Swift.type(of:)` on the same level as other declarations, even with its special-case type system behavior, and we can do this by special-casing the type system we produce during overload resolution if `Swift.type(of:)` shows up in an overload set. This also lays groundwork for handling other declarations we want to ostensibly behave like normal declarations but with otherwise inexpressible types, viz. `withoutActuallyEscaping` from SE-0110.
2016-12-22 16:28:31 -08:00
Nate Cook
0a0c77ed3f Merge pull request #6275 from natecook1000/nc-revise-pointers
[stdlib] Revise unsafe pointers documentation
2016-12-22 15:19:51 -06:00
Nate Cook
4edccfef63 [stdlib] Change wording in UnsafeBufferPointer discussion 2016-12-22 12:54:26 -06:00
swift-ci
6805ecccae Merge pull request #6311 from natecook1000/nc-fixes-06 2016-12-21 21:28:48 -08:00
Doug Gregor
8afeadc5ee Merge pull request #6309 from DougGregor/as-coercions-bridging
[Type checker] Clean up as/as!/as?/is casting
2016-12-21 15:53:18 -08:00
practicalswift
d88c188d47 Merge pull request #6443 from practicalswift/argument-names
[gardening] Make sure argument names in comments match the actual parameter names
2016-12-21 23:25:29 +01:00
practicalswift
b253b21014 [gardening] Make sure argument names in comments match the actual parameter names 2016-12-21 22:56:01 +01:00
Doug Gregor
3e7bab1b42 Clean up some uses of "as!" that were effectively just uses of "!".
We're going to start diagnosing these for bridging conversions, which
we weren't doing before.
2016-12-21 13:46:13 -08:00
Doug Gregor
255fdb1d61 Fix some bogus bridging casts that were allowed in Swift 3.
Swift 3 unintentionally allowed collection casts from, e.g.,
Set<AnyHashable> to Set<NSObject>, when in fact the object
representation of the AnyHashable might not be an NSObject. Fix up our
tests and overlays that ran afoul of this rule.
2016-12-21 13:46:13 -08:00
practicalswift
ce7a10474f [gardening] Fix accidental double and triple spaces. 2016-12-21 22:13:56 +01:00
Nate Cook
606bf83af3 [stdlib] Modify intro sort to pivot on median of 3
This modifies the _partition function used during sorting to select
the median of the first, middle, and last elements in the range to
be partitioned. Before partitioning begins, those three elements are
sorted, after which the middle element is selected as the pivot. This
change improves performance for sorted or nearly-sorted data.
2016-12-21 13:19:42 -06:00
Saleem Abdulrasool
75533d9dac Merge pull request #6385 from hughbe/runtime
Fix building the runtime from Windows
2016-12-21 10:02:22 -08:00
Max Moiseev
d9013a4b62 Adding endianness related inits and properties to FixedWidthInteger 2016-12-20 15:54:25 -08:00
Philippe Hausler
7d01c5d851 Add a fast-path case for enumeration of keys and objects for bridged Dictionaries 2016-12-20 15:16:48 -08:00
Nate Cook
77fc4948cc [stdlib] Add note about pointer alignment for subtraction 2016-12-20 12:39:01 -06:00
Ben Cohen
11e8a1feda Merge pull request #6388 from airspeedswift/_assertFailure-labels
[stdlib] Adjust _assertionFailed signature for naming guidelines
2016-12-20 08:49:59 -08:00
Max Moiseev
138d9df43e Getting rid of no longer needed minimumSignedRepresentationBitWidth 2016-12-19 16:26:15 -08:00
Max Moiseev
51128d3547 Adding smart shift default implementations to BinaryInteger via an extension 2016-12-19 16:10:24 -08:00
Max Moiseev
4675e12bc6 Implementing non-mutating shifts using mutating ones (for consistency) 2016-12-19 15:28:18 -08:00
Max Moiseev
4c1cc0f885 Moving bitwise operations and shifts to BinaryInteger protocol 2016-12-19 15:19:04 -08:00
Max Moiseev
059f7a53e2 doubleWidth operations on Int64 need special implementation for 32bit platforms 2016-12-19 14:42:33 -08:00
Philippe Hausler
b57752a67f [Foundation] Correct case of over-released data contents when specifying .none as a deallocator 2016-12-19 14:37:24 -08:00
Max Moiseev
3276aa5bcf Merge remote-tracking branch 'origin/master' into new-integer-protocols 2016-12-19 13:15:50 -08:00
Nate Cook
4169635a20 [stdlib] Consistency fixes in Array documentation
- Removed "see other" note from type discussion
- Modified index(_:offsetBy...) to match other collections
- Word choice in reserveCapacity(_:)
2016-12-19 14:16:36 -06:00
Nate Cook
82811c57f0 [stdlib] Improvements to Collection doc comments 2016-12-19 13:05:19 -06:00
Joe Groff
2e0cb9c0a2 Runtime: getDynamicType can't drill into existentials when producing a concrete metatype.
For a value of an opaque generic type `<T> x: T`, the language currently defines `type(of: x)` and `T.self` as both producing a type `T.Type`, and the result of substituting an existential type by `T == P` gives `P.Protocol`, so the `type(of:)` operation on `x` can only give the concrete protocol metatype when `x` is an existential in this case. The optimizer understood this rule, but the runtime did not, causing SR-3304.
2016-12-19 11:03:52 -08:00
Ben Cohen
f089e16c61 kill another FIXME I missed 2016-12-19 09:53:40 -08:00
Ben Cohen
14bbb92466 Adjust _assertionFailed signature for naming guidelines 2016-12-19 08:51:42 -08:00
Hugh Bellamy
7b66b579b1 Add various unreachable annotations to the runtime 2016-12-19 15:54:50 +00:00
Hugh Bellamy
f9671180da Fix build errors compiling ImageInspectionWin32.cpp 2016-12-19 15:54:49 +00:00
Hugh Bellamy
61c83ab5eb Change _MSC_VER conditions to _WIN32 in runtime 2016-12-19 15:54:49 +00:00
SpringsUp
e3c82fb2e3 [CMake] Don't reject AppleClang from building stdlib 2016-12-19 01:45:19 +01:00
Saleem Abdulrasool
b79b743bac Merge pull request #6350 from compnerd/windows-stdlib-improvements
Windows stdlib improvements
2016-12-18 13:31:56 -08:00
Paul Hudson
94ef84b649 Minor style fix: added space before brace. 2016-12-18 19:15:13 +00:00
Michael Gottesman
7f06ef40dc [cmake] Instead of using EMIT_SIB to generate sib output, just generate targets
for sib/sibgen files for libraries without building them by default.

This will let engineers just cd into the build directory and type:

ninja swift-stdlib-sib
ninja swift-stdlib-sibgen

To generate sib and sibgen files respectively.

There are still some dependency issues in between the sib targets, so to get
this to work well, I would suggest doing a full build and then using these
targets.
2016-12-17 18:38:32 -08:00
Saleem Abdulrasool
a367034193 stdlib: use _pipe on windows instead of pipe
Use the ucrt.io module's `_pipe` to provide a wrapper over the unix
pipe(2) function.  Based on the work of Hugh Bellamy!
2016-12-17 16:39:08 -08:00
Saleem Abdulrasool
15a24c1117 stdlib: include Glibc on cygwin
cygwin uses glibc, so we should use the glibc module when working with
cygwin.
2016-12-17 16:38:34 -08:00
Saleem Abdulrasool
96974a2179 Windows: add a ucrt.io module
This module covers the ucrt corecrt_io.h header.  We can further refine
the module if necessary later.
2016-12-17 16:37:41 -08:00
Saleem Abdulrasool
ba81349542 Merge pull request #6271 from hughbe/clang-cl-checks
[CMake] improve support for Clang-CL
2016-12-17 16:07:03 -08:00
practicalswift
9d0b2abfc2 [gardening] Normalize end-of-namespace comments 2016-12-17 22:29:07 +01:00
swift-ci
268c2b668d Merge pull request #6325 from practicalswift/gardening-20161216 2016-12-17 09:19:24 -08:00
practicalswift
38be6125e5 [gardening] C++ gardening: Terminate namespaces, fix argument names, ...
Changes:
* Terminate all namespaces with the correct closing comment.
* Make sure argument names in comments match the corresponding parameter name.
* Remove redundant get() calls on smart pointers.
* Prefer using "override" or "final" instead of "virtual". Remove "virtual" where appropriate.
2016-12-17 00:32:42 +01:00
Max Moiseev
3b7dd4a818 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2016-12-16 14:30:33 -08:00
practicalswift
16d6dce62e [gardening] Fix recently introduced typos. 2016-12-16 21:42:09 +01:00
Hugh Bellamy
8e576ebccd [CMake] improve support for Clang-CL 2016-12-16 16:33:00 +00:00
Max Moiseev
ea8f2209a3 Overflow checks in division/modulo operators + tests 2016-12-15 16:32:07 -08:00
Max Moiseev
d318ec540c Type hints in comparisons 2016-12-15 16:31:19 -08:00
Max Moiseev
9518082c3f Removing dead and commented code 2016-12-15 15:22:54 -08:00