Commit Graph

13406 Commits

Author SHA1 Message Date
Mike Ash
01b840a488 [Stdlib] Ensure key paths allocate space for the terminating NUL.
rdar://problem/46457346 SR-9404
2018-12-04 14:53:03 -05:00
Michael Ilseman
8530a2c940 [String] Hand-increment loop variable for perf.
Hand-incrementing the loop variable allows us to skip overflow
detection, and will permit more vectorization improvements in the
future. For now, it gives us perf improvements in nano-benchmarks.
2018-12-04 11:51:21 -08:00
Doug Gregor
2c5ecb477a Merge pull request #20858 from DougGregor/mangled-base-protocol-witnesses
[ABI] Use mangled names for base protocol witnesses.
2018-12-04 11:28:27 -08:00
Saleem Abdulrasool
16e9bab7f0 Platform: add setjmp module for VisualC
Add the setjmp module which was missing.  The roughly equivalent
function is `_setjmp`.  Unfortunately, it is not marked as
`__attribute__((__returns_twice__))`.
2018-12-04 09:55:33 -08:00
Saleem Abdulrasool
322a585714 Merge pull request #20994 from compnerd/calling-extension-o
Driver: correct the registrar extension
2018-12-04 08:28:58 -08:00
John McCall
d44851304b Future-proof the ARM64 ABI by not reserving the entire top byte.
Targets that want to use armv8.5a memory tagging will need this.
Hopefully nobody comes up with a brilliant reason they need to use
anything else.
2018-12-04 01:43:08 -05:00
Doug Gregor
f2dd852f94 [ABI] Optimize out the witness table pattern for resilient conformances.
Resilient conformances now put all witnesses into the resilient witness
table, so optimize away the witness table pattern for such cases. Teach
the runtime to fill in the protocol conformance descriptor, because that’s
the only bit of real information that would be in the pattern.

This is a minor optimization enabled by rdar://problem/46282080.
2018-12-03 20:16:18 -08:00
Saleem Abdulrasool
c931d9530e Driver: correct the registrar extension
The object file extension on Windows is `.obj` rather than `.o`.  Ensure
that we get the extension correct when compiling for Windows.
Furthermore, ensure that we install with the correct extension when
installing a cross-compiled image.  As we may be using the homegrown
cross-compilation system, we must explicitly handle the extension
ourselves.  This allows nearly a 100 additional tests to pass on
Windows.
2018-12-03 19:17:06 -08:00
Jon Shier
7fb5905f5f Updates for review comments. 2018-12-03 21:52:21 -05:00
Slava Pestov
60e3373636 Merge pull request #20987 from slavapestov/backward-deployment
Backward deployment fixes and tests
2018-12-03 21:49:00 -05:00
Slava Pestov
f871b0e661 Merge pull request #20948 from Azoy/remove-_getBool
[SILGen][stdlib] Remove _getBool
2018-12-03 21:00:31 -05:00
Slava Pestov
213d089c28 Runtime: Don't crash when overriding a weak-imported method that's not available 2018-12-03 20:36:03 -05:00
Doug Gregor
c0519c7185 [ABI] Put mangled inherited protocol witnesses into the resilient witness table
Emit mangled inherited protocol witnesses into the resilient witness table,
and realize them when we instantiate the resilient witness table. Don’t
put mangled inherited protocol witnesses into non-resilient witness tables:
there is no efficient way to make sure they are realized, so keep the
previous instantiation-function approach.

Implements the rest of rdar://problem/46282080.
2018-12-03 17:29:33 -08:00
Michael Ilseman
c0c530aef8 [String] Speed up constant factors on comparison.
Include some tuning and tweaking to reduce the constant factors
involved in string comparison. This yields considerable improvement on
our micro-benchmarks, and allows us to make less inlinable code and
have a smaller ABI surface area.

Adds more extensive testing of corner cases in our existing
fast-paths.
2018-12-03 15:49:38 -08:00
Michael Ilseman
1706d4c02d [String] Refactor and fast-path normalization
Refactor some normalization queries into StringNormalization.swift,
and add more latiny (<0x300) fast-paths.
2018-12-03 13:22:57 -08:00
Michael Ilseman
8d2af454e4 [String] Normalization-boundary-before UTF-8 fast path.
All latiny (<0x300) scalars have normalization boundaries before them,
so when asking if memory containing a scalar encoded in valid UTF-8
has a boundary before it, check if the leading byte definitely encodes
a scalar less than 0x300.
2018-12-03 13:20:39 -08:00
Karoy Lorentey
bb81b24248 Merge pull request #20918 from lorentey/dictionary-modify-layering
[stdlib] Refactor Dictionary.subscript._modify for better layering
2018-12-03 20:57:55 +00:00
Michael Ilseman
94942c5b3b [String] Fix corner case in comparison fast-path. (#20937)
When in a post-binary-prefix-scan fast-path, we need to make sure we
are comparing a full-segment scalar, otherwise we miss situations
where a combining end-of-segment scalar would be reordered with a
prior combining scalar in the same segment under normalization in one
string but not the other.

This was hidden by the fact that many combining scalars are not
NFC_QC=maybe, but those which are not present in any precomposed form
have NFC_QC=yes. Added tests.
2018-12-03 10:41:45 -08:00
swift-ci
3376f9fbe8 Merge pull request #20952 from xwu/stdlib-style-fixes 2018-12-03 09:03:37 -08:00
Karoy Lorentey
04586e3916 [stdlib] AutoreleasingUnsafeMutablePointer: Switch subscripts to _read accessors 2018-12-03 16:22:33 +00:00
Dale Buckley
6ef7cca298 Added decodable error handling and changed from operator constructors to uncheckedBounds constructor 2018-12-03 08:44:04 +00:00
Jon Shier
33dcfc462f Add update Result type to standard library. 2018-12-02 22:15:02 -05:00
Xiaodi Wu
9fe28c6e55 [gardening] Fix header comments [NFC] 2018-12-02 15:38:41 -05:00
Xiaodi Wu
f9e8b6363e [gardening] Make edits for stdlib style [NFC] 2018-12-02 15:26:35 -05:00
Azoy
a2dafc3d26 Remove _getBool 2018-12-01 18:51:25 -06:00
Saleem Abdulrasool
98d71ff38f SwiftPrivateThreadExtras: clean up using WinSDK SDK overlay
Use the constants rather than hardcoding values.
2018-12-01 11:04:13 -08:00
swift-ci
19eed120ee Merge pull request #20906 from compnerd/sdk-overlay 2018-12-01 10:27:33 -08:00
Michael Ilseman
b01ee7267a [String] Custom iterator for UTF16View (#20929)
Defining a custom iterator for the UTF16View avoid some redundant
computation over the indexing model. This speeds up iteration by
around 40% on non-ASCII strings.
2018-12-01 09:35:27 -08:00
Saleem Abdulrasool
84e94f563c SDK: add SDK overlay for Windows
Introduce a WinSDK overlay for Windows.  This allows us to define some
shared constants that are not correctly imported right now.  This cleans
up the logic in the swift side of things and aids in the bring up.

Now that we have a SDK overlay for Windows, we should structure the tree
according to the OS family.
2018-11-30 16:55:42 -08:00
Harlan Haskins
615b8be990 [stdlib] Silence warnings related to uninhabited types
PR #20528 was merged yesterday, which inserts an `unreachable` in
functions with uninhabited parameters. Unfortunately this means any
statement in the function body, even ones that themselves are
never-returning or don't have any executable code, cause the warning.

Silence the warnings by deleting the bodies of these functions.
2018-11-30 13:50:16 -08:00
Stephen Canon
28962b5754 Move most of the simd operators into an optional module (#20914)
* Move most of the simd operators into an optional module

Adding simd to the stdlib caused some typechecker regressions. We can resolve them in the near-term by making the types universally available, but moving the arithmetic operators into a separate module that must be explicitly imported.

* Move two fuzzing tests back to fixed.

* Add SIMDOperators as a dependency for MediaPlayer.

* Move the .-prefixed operator declarations back into the stdlib.
2018-11-30 16:30:15 -05:00
Mike Ash
4b3c821aff Merge pull request #20836 from mikeash/anyhashable-cast-leak-fix
[Runtime] Fix leak when casting to AnyHashable.
2018-11-30 15:36:30 -05:00
Harlan Haskins
01bfdc162e Merge pull request #20835 from nordicio/stdlib-NSStringGetCString-nullability
[stdlib] adds nullability type specifier to NSStringGetCStringTrampoline
2018-11-30 11:24:55 -08:00
Saleem Abdulrasool
cc49e686cd Merge pull request #20908 from compnerd/thread-corrections
SwiftPrivateThreadExtras: fix windows build
2018-11-30 10:38:09 -08:00
David Smith
ce82e80ec2 Merge pull request #20911 from Catfish-Man/dictionary-cast-builder
Use _DictionaryBuilder instead of Dictionary for casts
2018-11-30 10:18:46 -08:00
Karoy Lorentey
d32fd283b0 [stdlib] Refactor Dictionary.subscript._modify for better layering
This may also reduce ARC traffic by a little bit.
2018-11-30 17:47:08 +00:00
Karoy Lorentey
e94361e642 Merge pull request #20705 from lorentey/rawrepresentable-hashing
Add default Hashable implementations for RawRepresentable types
2018-11-30 14:21:37 +00:00
Karoy Lorentey
1ef6cf4813 Merge pull request #20866 from lorentey/deprecate-hashValue-1
[test] Modernize hashing throughout the test suite
2018-11-30 14:21:04 +00:00
David Smith
17e7c5ff5f Use _DictionaryBuilder instead of Dictionary for casting 2018-11-30 02:15:29 -08:00
Saleem Abdulrasool
c32daed203 SwiftPrivateThreadExtras: fix windows build
Missed casts and a let vs var issue.  This was missed in the last bundle
of patches.
2018-11-29 22:19:00 -08:00
Saleem Abdulrasool
94173e9cdb SwiftPrivateThreadExtras: correct dependency for Windows
We need the MSVCRT module, add a dependency.
2018-11-29 19:26:59 -08:00
Michael Ilseman
c3c6fdc77f [String] ASCII fast-path for UTF16View (#20848)
Add an isASCII fast-path for many UTF16View operations. These are
heavily utilized in random-access scenarios, allowing us to both be
more efficient and skip generating breadcrumbs for ASCII strings.
2018-11-29 18:19:32 -08:00
Greg Parker
70bbeaab78 [runtime] Register a hook for class name lookup from libobjc (#20650)
libobjc needs to look up classes by name. Some Swift classes, such as
instantiated generics and their subclasses, are created only on demand.
Now a by-name lookup from libobjc counts as a demand for those classes.

rdar://problem/27808571
2018-11-29 17:06:28 -08:00
Doug Gregor
19941d3494 [Runtime] Have the runtime copy instantiation arguments into private data.
Rather than having the witness table instantiation function copy the 
instantiation arguments that corresponding to conditional requirements
into the private area, have the runtime do it. We’re going to depend on
these lining up anyway (and the witness table can of course have *more*
private slots that it manages some other way), so centralize the code.

More of rdar://problem/46282080.
2018-11-29 17:05:05 -08:00
Doug Gregor
3ef38ab94e [Runtime] Eagerly realize mangled base protocol witnesses.
If the witness for a base protocol is a mangled name, eagerly turn that name
into a witness table via swift_getAssociatedConformanceWitness(). This
allows the compiler to emit base protocol witnesses as mangled names
(as it does for associated conformances).
2018-11-29 17:04:41 -08:00
Karoy Lorentey
26e8966348 Merge pull request #20872 from lorentey/deprecate-hashValue-4
[ObjectiveC] Selector: Synthesize Equatable and Hashable
2018-11-30 00:46:51 +00:00
Karoy Lorentey
3b16c392eb Merge pull request #20873 from lorentey/deprecate-hashValue-5
[CoreGraphics] CGFloat: Implement better hashing
2018-11-29 23:19:04 +00:00
Karoy Lorentey
4e2dfb7899 [ObjectiveC] Replace Selector.== and hashValue with compiler-synthesized versions
`Selector.==` currently calls `sel_isEqual`, which is documented to be the same as == on the direct pointer values. We can safely replace the explicit implementation with the compiler-generated one.

`Selector.hashValue` is deprecated as a Hashable requirement, and the preferred method to implement is `hash(into:)`. Implementing the proper function improves hashing performance by eliminating nested Hasher sessions.

By removing the previous definition of `hashValue`, we allow the compiler to synthesize the correct `hash(into:)` (and `hashValue`) implementations.
2018-11-29 23:16:05 +00:00
Ted Kremenek
deb0f1f884 Merge pull request #20862 from futurejones/master-aarch64-VarArgs
[stdlib][SR-2239]: add support for AArch64 variadics
2018-11-29 15:05:35 -08:00
Stephen Canon
fb8b9e143d SIMD into stdlib
Implements SE-0229.

Also updates simd module types in the Apple SDKs to use the new types, and updates a couple tests to work with the new types and protocols.
2018-11-29 17:09:01 -05:00