Commit Graph

12522 Commits

Author SHA1 Message Date
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
Karoy Lorentey
b58d3d1665 [CoreGraphics] CGFloat: Also add _rawHashValue(seed:)
This makes for a small speedup, bringing CGFloat hashing to the same speed as direct Float/Double.
2018-11-29 19:14:44 +00:00
Karoy Lorentey
7327d5dc15 [CoreGraphics] CGFloat.hash(into:): Add explicit definition
This replaces the previously compiler-synthesized implementation with one that directly feeds the wrapped value to the hasher. The new definition is functionally equivalent, but warning-free and faster.
2018-11-29 19:10:45 +00:00
David Smith
b9d0f8a0b1 Merge pull request #20853 from Catfish-Man/no-tify
Disable KVO auto-subclassing of internal Swift bridging types
2018-11-29 10:48:49 -08:00
Mike Ash
f1f83968d6 [Runtime] Fix leak in tryDynamicCastBoxedSwiftValue.
The call to swift_unboxFromSwiftValueWithType needs to destroy the value on success when requested in the flags.

rdar://problem/44686587
2018-11-29 12:59:44 -05:00
Saleem Abdulrasool
c9cf8fcd20 Merge pull request #20719 from compnerd/threading-extras
port SwiftPrivatePthreadExtras to Windows
2018-11-29 08:45:57 -08:00
Karoy Lorentey
8e77a2655a [test] StdlibUnittest: Add missing hash(into:) implementations 2018-11-29 15:55:17 +00:00
futurejones
4a03b3c304 add support for AArch64 variadics 2018-11-29 22:30:28 +09:00
Doug Gregor
1cc67dc6a8 Merge pull request #20856 from Catfish-Man/master
Fix mis-merge
2018-11-28 21:44:35 -08:00
David Smith
ee02182c28 Fix mis-merge 2018-11-28 21:34:42 -08:00
swift-ci
c2a6021630 Merge pull request #20839 from airspeedswift/reduce-into-owned 2018-11-28 20:57:35 -08:00
John McCall
91a7c7635e Merge pull request #20415 from rjmccall/stdlib-borrowed-storage
Use @_borrowed on a few declarations in the stdlib and overlays
2018-11-28 21:29:27 -05:00
David Smith
ba2af14ffd Disable KVO auto-subclassing of internal Swift bridging types 2018-11-28 18:25:00 -08:00
Ben Cohen
da614764ed Make reduce(inout:) take its initial value owned 2018-11-28 17:19:39 -08:00
swift-ci
e012655e57 Merge pull request #20623 from Catfish-Man/bridgecleanup 2018-11-28 17:03:49 -08:00
David Smith
8b57921905 Assorted bridging changes:
• Convert _AbstractStringStorage to a protocol, and the free functions used to deduplicate implementations to extensions on that protocol.
• Move 'start' into the abstract type and use that to simplify some code
• Move the ASCII fast path for length into UTF16View.
• Add a weirder but faster way to check which (if any) of our NSString subclasses a given object is, and adopt it
2018-11-28 16:04:34 -08:00
Michael Ilseman
c2280ab37b Merge pull request #16425 from milseman/ppc_abi_tla
[ABI] Define generic 64-bit address space and spare bits.
2018-11-28 15:22:43 -08:00
Andreas Jönsson
452230ae33 [stdlib] adds nullability type specifier to NSStringGetCStringTrampoline 2018-11-28 21:08:58 +01:00
Mike Ash
331f0d2394 [Runtime] Fix leak when casting to AnyHashable.
_dynamicCastToAnyHashable assumed that _swift_convertToAnyHashableIndirect takes its argument at +1, but that is no longer the case.

rdar://problem/44686587
2018-11-28 14:54:13 -05:00
Michael Ilseman
9a96666ef8 [ABI] Define generic 64-bit address space and spare bits.
Define a generic 64-bit address space ABI which is capped at 56
bits. Switch ppc64 and s390x over to it.

This also allows String to have (roughly) the same representation
across 64-bit platforms.
2018-11-28 09:48:03 -08:00
swift-ci
806cf57687 Merge pull request #20825 from DougGregor/runtime-override-conforms-to-swift-protocol 2018-11-28 00:36:47 -08:00
Doug Gregor
da772e9155 [Runtime] Make swift::swift_conformsToSwiftProtocol overridable.
This is a funnel point for looking up the protocol conformance descriptor
for a given conforming type + conformance. Make it overridable in case we
need to back-deploy changes or fixes.

Implements rdar://problem/46281660.
2018-11-27 23:37:11 -08:00
swift-ci
d3bd4c5817 Merge pull request #20812 from milseman/sliced_guts 2018-11-27 17:45:23 -08:00
Doug Gregor
f9797b4eeb [Runtime] Add dummy "module name" parameter to swift::_conformsToSwiftProtocol.
We know we're going to want this parameter to handle lookup of
retroactive conformances when we've been given a module, so add it
now because we want this to be an overridable entry point.
2018-11-27 16:11:40 -08:00
Michael Ilseman
e44972dcea [String] Expunge _StringGutsSlice from ABI
_StringGutsSlice is an implementation helper that's no longer needed
from inlinable code. Internalize it.
2018-11-27 15:07:27 -08:00
Arnold Schwaighofer
e57ba9954c Merge pull request #20763 from aschwaighofer/inlinable_arraybufferprotocol_init
stdlib: Make ArrayBufferProtocol.init inlinable to facilitate specialization
2018-11-27 08:45:46 -08:00
Max Moiseev
2ea85798c8 Merge pull request #20783 from moiseev/network-max-dg-size
[overlay] Expose NWConnection.maximumDatagramSize
2018-11-27 07:52:22 -08:00
Ben Rimmington
c5997491da [stdlib] Remove Strideable closed range operator 2018-11-27 12:58:22 +00:00
Slava Pestov
86b5411a5a stdlib: __SwiftNativeNSString does not need to be public 2018-11-27 00:16:34 -05:00
Slava Pestov
86f23ec83f Runtime: Fill in the value witness table of a class when doing singleton metadata initialization
On Windows the image format does not support cross-image absolute
data symbol references. One case where we emit these is in class
metadata, because the value witness table always points at the
value witness table for Builtin.NativeObject, defined in the
runtime.

Instead, fill in the value witness table at runtime when doing
singleton metadata initialization.

Another change that will come later is to force use of singleton
metadata initialization on Windows, even if the class is otherwise
completely fixed.
2018-11-26 22:12:00 -05:00