Commit Graph

5263 Commits

Author SHA1 Message Date
Max Moiseev
ff47c303ad Merge pull request #21443 from compnerd/ilp32
core: remove unsupported architecture conditional
2018-12-20 13:49:40 -08:00
Saleem Abdulrasool
c764e8a273 build: differentiate better between host and target
Assume that the build currently targets only a single target.  Use the target to
determine the linked libraries for the target library (swiftCore).  This is more
precise and more importantly, is required to enable cross-compilation of various
targets.
2018-12-20 09:18:27 -08:00
Saleem Abdulrasool
f1c2a57557 build: link swiftCore against Shell32
We are now using Shell APIs for the command line parsing.  Ensure that we link
against the Shell32 library.  This is needed for the cross-compilation as on
Windows, the environment will set a default link against a number of libraries.
This is more precise and explicit.
2018-12-20 09:13:34 -08:00
Michael Munday
cdd5aa0624 [stdlib] Fix Unicode.Scalar to String cast on big endian machines
We need to explicity ensure that an integer is in the required byte
order (little-endian in this case) before accessing it as an array
of bytes through an unsafe pointer.
2018-12-20 14:58:16 +00:00
Robert Widmann
426fe886dc [SR-8272] Drop the last remnants of LogicValue
Removes the _getBuiltinLogicValue intrinsic in favor of an open-coded
struct_extract in SIL.  This removes Sema's last non-literal use of builtin
integer types and unblocks a bunch of cleanup.

This patch would be NFC, but it improves line information for conditional expression codegen.
2018-12-19 23:14:59 -05:00
Michael Ilseman
0ac802a95b Merge pull request #21310 from milseman/4_bit_string
[String] Last-minute ABI adjustment: 4-bit discriminator
2018-12-19 16:42:20 -08:00
Karoy Lorentey
624135641d Merge pull request #21057 from lorentey/actually-deprecate-hashValue
[Sema] Emit a deprecation warning if a Hashable type only implements hashValue
2018-12-19 22:47:16 +00:00
Saleem Abdulrasool
f8b41740e5 core: remove unsupported architecture conditional
AArch64 ILP32 support has not yet been integrated into the frontend.
Remove the conditional compilation for the target.
2018-12-19 13:56:18 -08:00
Michael Ilseman
5a6d2dfa59 [String] Switch ABI to only use 4 discriminator bits.
In anticipation of potential future HW features, e.g. armv8.5 memory
tagging, only use the high 4 bytes as discriminator bits in
_BridgeObject rather than the top 8 bits. Utilize two perf flags to
cover this instead. This requires shifting around a fair amount of
internal complexity.
2018-12-19 13:54:50 -08:00
Michael Ilseman
5d67236bc0 [String] Refactor 32-bit StringObject.
Remove Discriminator, Flags, etc., abstractions from
StringObject. These cause code divergence between 32-bit and 64-bit
ABI, complicate ABI changes, and otherwise contribute to bloat.
2018-12-19 11:19:08 -08:00
Maxim Moiseev
165fe328c3 [stdlib] tee _stdlib_AtomicInt > SwiftPrivate
Turns out some people used this type despite it being prefixed with
`_stdlib_`, so we have to keep it, with an obsoletion message this time.
Second copy of the same type is kept available past Swift 5 in
SwiftPrivate for use in tests.
2018-12-18 16:12:47 -08:00
Karoy Lorentey
9d61bad1e5 [stdlib] Keep the first duplicate key instead of the last 2018-12-18 09:49:58 -08:00
Karoy Lorentey
f862ad3741 [stdlib] Doc updates 2018-12-18 09:49:58 -08:00
Karoy Lorentey
f0e04f73f4 [stdlib] Process elements from back to front 2018-12-18 09:49:58 -08:00
Karoy Lorentey
039891c24b [stdlib] Dictionary: Add support for non-unique keys in bulk loading init 2018-12-18 09:49:58 -08:00
Karoy Lorentey
f1f5e0f2bf [stdlib] Dictionary: Add unsafe bulk-loading initializer
Interface inspired by this Array pitch:
https://forums.swift.org/t/array-initializer-with-access-to-uninitialized-buffer/13689
2018-12-18 09:49:58 -08:00
Nate Cook
646849ee64 Doc fix
Co-Authored-By: lorentey <klorentey@apple.com>
2018-12-18 17:27:08 +00:00
Doug Gregor
ad17e8a3ab [SIMD] Delete unnecessary comment on debugDescription.
It maakes documentation works by overriding the default.
2018-12-17 11:08:46 -08:00
Doug Gregor
69c9fbc3c8 Move SIMD operators back into the Swift standard library
Moving them out to SIMDOperators didn't help, but the type checker hack
might. Move them back into the Swift standard library where they belong,
but leave SIMDOperators there to smooth over any short-term
incompatibilities.
2018-12-17 11:07:32 -08:00
Doug Gregor
34113d1f86 Merge pull request #21339 from DougGregor/simd-custom-string-convertible
[SIMD] Add CustomDebugStringConvertible conformance for SIMD types.
2018-12-14 20:43:36 -08:00
Luciano Almeida
2bc5623bdf [stdlib] Resolving some FIXME comments on Set type. (#20631)
* Fixing some fixmes on stdlib Set

* Adding @inline attr

* Fixing spaces

* Adding isEmpty as fast path in other places where is possible.

* Quotes on variable name on comment.

* Update stdlib/public/core/Set.swift

Co-Authored-By: LucianoPAlmeida <passos.luciano@outlook.com>

* Adding benchmark for isDisjoint Set method

* Adding empty sets to benchmark

* Fixing the factor on benchmarks and naming warnings for empty 5 words
2018-12-14 22:11:12 -06:00
Doug Gregor
fbf4bb738d [SIMD] Add CustomDebugStringConvertible conformance for SIMD types.
The old SIMD types had a conformance to CustomDebugStringConvertible,
but the new ones do not, causing a source compatibility
regression. Add back a CustomDebugStringConvertible conformance.

Fixes rdar://problem/46746829.
2018-12-14 17:00:17 -08:00
Erik Eckstein
aae60ff271 stdlib: Code size improvements for Dictionary for -Osize
The first change is to remove some @inline(__always) attributes. Those were added before we had the guaranteed-by-default calling convention. They are not necessary anymore.

The second change is to not specialize some slow-path functions. This results that no specialization code for these functions is generated at the client side. Instead those functions are directly called in the libSwiftCore.
Note that Key-related hash and equality comparisons are still specialized, because otherwise the performance hit for Osize would be too big.

Some Dictionary benchmarks regress a bit with -Osize, but the code size wins are big.

rdar://problem/46534453
2018-12-13 16:59:19 -08:00
Max Moiseev
83ccb23c97 Merge pull request #20958 from jshier/add-result
SE-0235: Add Result<Success, Failure: Error> to Standard Library
2018-12-12 14:00:15 -08:00
Ben Cohen
929539b4ab Merge branch 'master' into remove-strideable-closed-range-operator 2018-12-12 08:03:50 -08:00
Joe Groff
e30c86769a KeyPath: Allow existing context descriptors to be used as generic environment.
If a key path literal appears in a generic context with an existing context descriptor, this will allow us to
save some code size by not having to emit a separate GenericEnvironment descriptor.
2018-12-11 09:05:47 -08:00
Joe Groff
85eb634191 stdlib: Make _typeByName Foundation SPI reject symbolic references.
It's used for recovering type metadata from deserialized mangled names, which should never have symbolic
references in them.
2018-12-10 20:22:03 -08:00
Joe Groff
1f5f6dbb6d Merge pull request #21186 from jckarter/public-getTypeByMangledName
Runtime: Make getTypeByMangledNameIn(Context|Environment) a public entry point.
2018-12-10 18:58:53 -08:00
Michael Ilseman
6a18fb8d83 Merge pull request #21178 from milseman/string_storage_view
[String] UTF8View implements withContiguousStorageIfAvailable
2018-12-10 15:57:15 -08:00
Mike Ash
a39ee29f0e Merge pull request #21127 from mikeash/rename-anykeypath-and-valistbuilder
[Stdlib] Rename AnyKeyPath's ObjC name and _VaListBuilder to avoid conflicts with older stdlibs.
2018-12-10 18:11:23 -05:00
Joe Groff
021053d499 Runtime: Make getTypeByMangledNameIn(Context|Environment) a public entry point.
This can be used by compiler-generated code as a size optimization for metadata access, using a
mangled name instead of possibly many open-coded metadata calls. It can also allow reflection
libraries outside of the standard library to turn type reference strings into in-process metadata
pointers in a robust way. rdar://problem/46451849
2018-12-10 14:22:41 -08:00
Jordan Rose
c66a445ef7 [stdlib] Make some more *Pointer operations _transparent (#21126)
Not only was this affecting performance when building from parseable
interfaces, but we'd also want these to be inlined for any sort of
bounds-checking diagnostics / static analysis we might get in the
future.
2018-12-10 13:37:15 -08:00
Nate Cook
2bb0b5c842 Revise some documentation comments. 2018-12-10 14:31:28 -06:00
Michael Ilseman
1d9032991b [String] UTF8View implements withContiguousStorageIfAvailable 2018-12-10 11:01:28 -08:00
Valeriy Van
0e5d18654e Fixes comment for binaryString example snippet in FixedWidthInteger 2018-12-10 17:12:31 +01:00
Mike Ash
6b9480252e [Stdlib] Change AnyKeyPath to use @_objcRuntimeName attribute for its rename.
rdar://problem/46546165
2018-12-10 10:35:37 -05:00
Mike Ash
a49e2ddde7 [Stdlib] Rename AnyKeyPath's ObjC name and _VaListBuilder to avoid conflicts with older stdlibs.
rdar://problem/46546165
2018-12-10 10:17:52 -05:00
Jon Shier
c739498c9b Remove usage lines from docs. 2018-12-09 19:20:49 -05:00
Jon Shier
e4a700c32d Update inline documentation. 2018-12-09 19:08:41 -05:00
Ben Cohen
11769d2494 Add tests for withContiguousStorageIfAvailable 2018-12-07 17:30:13 -08:00
Max Moiseev
290e9025fa Merge pull request #21118 from benrimmington/remove-interval-group-info
[stdlib] Remove Interval.swift from GroupInfo.json
2018-12-07 11:16:55 -08:00
Ben Cohen
ad50a39b12 [stdlib] Add withContiguous{Mutable}StorageIfAvailable (#21092)
* Add MutableCollection.withContiguousMutableStorageIfAvailable

* Add withContiguousMutableStorageIfAvailable impls

* Add tests on concrete types

* Add Sequence.withContiguousStorageIfAvailable

* Implement withContiguousStorageIfAvailable in concrete types
2018-12-07 10:01:18 -08:00
Karoy Lorentey
b77351548a Merge pull request #21045 from lorentey/modify-vs-throw
[stdlib] Dictionary: Support throwing yields in _modify accessors
2018-12-07 17:08:42 +00:00
Ben Rimmington
4e667cb97b [stdlib] Remove Interval.swift from GroupInfo.json 2018-12-07 12:39:36 +00:00
Michael Ilseman
8863a5514c Merge pull request #21024 from milseman/fass_and_smol
[String] In-register comparison of small ASCII strings
2018-12-06 09:01:37 -08:00
Michael Ilseman
4394ce1a23 Merge pull request #21072 from milseman/i_dem_potent
[String] String-from-whole-Substring fast-path.
2018-12-06 09:01:12 -08:00
Doug Gregor
00d2acd809 Merge pull request #21037 from DougGregor/flatten-abs
[ABI] [stdlib] Remove magnitude-based overload of abs(_:).
2018-12-06 08:36:24 -08:00
Karoy Lorentey
549926337c Merge pull request #20967 from lorentey/aump-read
[stdlib] AutoreleasingUnsafeMutablePointer: Switch subscripts to _read accessors
2018-12-06 15:13:09 +00:00
Doug Gregor
ab75577079 [stdlib] Teach abs(_:) to use magnitude when it can.
Within the (single) implementation of abs(_:), dynamically check whether
the numeric type and its `Magnitude` are of the same type and, if so,
return the result of `magnitude`. This ensures that we do the right thing
with respect to (e.g.) floating point values like -0.0, without resorting
to overloading of abs(_:).
2018-12-05 21:05:52 -08:00
Jon Shier
2bc4cbbfdd Update for revised proposal. 2018-12-05 23:17:35 -05:00