Commit Graph

5543 Commits

Author SHA1 Message Date
fischertony
eff8a789fc Stdlib: Fix ReversedIndex compatibility alias 2019-04-25 01:39:56 +03:00
swift-ci
c34c3e373e Merge pull request #23732 from Catfish-Man/pointernt 2019-04-23 14:58:34 -07:00
David Smith
96a93261d0 Use the Swift runtime's (faster) class check in the stdlib instead of shimming object_getClass() 2019-04-23 13:05:25 -07:00
Thomas Roughton
4c2df287a7 [stdlib] Use String’s underlying UTF-8 view for Float parsing 2019-04-23 10:46:19 +12:00
Joe Groff
a8c2b50bd8 Merge pull request #22072 from jckarter/opaque-type-runtime
Opaque types with resilience
2019-04-18 14:52:31 -07:00
Stephen Canon
57a4553832 SE-0246: Protocols and static functions (#23824)
This implements the protocols and static functions proposed in SE-0246, plus some initial test coverage. It also has some rough accompanying cleanup of tgmath. It does not include the globals (on scalars or SIMD types) nor does it deprecate much in tgmath.h.
2019-04-17 23:57:33 +02:00
Joe Groff
05dfec0cda Push the conformance accessor hack down into getTypeByMangledName. 2019-04-17 14:44:40 -07:00
swift-ci
388c21ac64 Merge pull request #24000 from Catfish-Man/thread-specific-doh 2019-04-15 18:08:06 -07:00
David Smith
584fbfc245 Avoid the overhead of looking up the current CFAllocator in String bridging 2019-04-15 15:28:00 -07:00
Karoy Lorentey
e08b219448 Merge pull request #23683 from lorentey/casting-improvements
[stdlib] Fix Set/Dictionary casting issues
2019-04-15 10:56:38 -07:00
Stephen Canon
9e61aaefba Temporarily remove the global min(a,b) and max(a,b) SIMD functions. (#23960)
These are triggering a bad compile-time regression for some expressions; that's a bug that should be fixed, but we don't know how to fix it yet, so we'll need to remove these in the short-term, and possibly spell them differently in the medium term.
2019-04-12 16:30:32 +02:00
Bob Wilson
207bf788f2 Merge pull request #23896 from bob-wilson/branchHint-followup
Move the legacy _branchHint function to LegacyABI.swift
2019-04-09 16:47:56 -07:00
Michael Ilseman
b39ead1774 Merge pull request #23863 from milseman/string_cleaning
[gardening] Clean up many String computed vars
2019-04-09 14:02:39 -07:00
Bob Wilson
0cf186f25d Move the legacy _branchHint function to LegacyABI.swift 2019-04-09 11:44:35 -07:00
Stephen Canon
f4b2916de6 [SE-0251] Additions to SIMD types. (#23421)
* Additions to SIMD types.

- extension from 2 and 3-element vectors to 3- and 4-element vectors.
- the .one member
- swizzles via subscript-by-simd
- min/max/sum reductions
- min/max/clamp on vectors-of-comparable
- any and all

- Make permute subscript wrap on vector length, even for SIMD3 dictionaries. Also restore min/max to globals, rather than static functions.
2019-04-09 18:53:45 +02:00
Michael Ilseman
f7cdda2720 [gardening] Clean up many String computed vars 2019-04-08 15:16:48 -07:00
Stephen Canon
c5e3f85378 Revert SE-0246 (#23800)
* Revert "Merge pull request #23791 from compnerd/you-know-nothing-clang"

This reverts commit 5150981150, reversing
changes made to 8fc305c03e.

* Revert "Merge pull request #23780 from compnerd/math-is-terrible"

This reverts commit 2d7fedd25f, reversing
changes made to 0205150b8f.

* Revert "Merge pull request #23140 from stephentyrone/mafs"

This reverts commit 777750dc51, reversing
changes made to 0c8920e747.
2019-04-04 19:35:25 -04:00
Michael Ilseman
3b99358592 Merge pull request #23051 from milseman/textual_contiguity
[SE-0247] Add contiguous string APIs
2019-04-03 19:50:23 -07:00
Ted Kremenek
777750dc51 Merge pull request #23140 from stephentyrone/mafs
Math functions for Swift
2019-04-03 14:53:16 -07:00
Steve (Numerics) Canon
bcc7e2c901 Obscene rant about linters. 2019-04-03 15:15:28 -04:00
Karoy Lorentey
3c74c0f1cb [stdlib] Change the signature of Dictionary’s bulk initializer (#23758)
The initializer was originally introduced without proper availability; in https://github.com/apple/swift/pull/23643, we fixed this by applying the `@_alwaysEmitIntoClient` attribute. However, this had the unfortunate side-effect that the symbol disappeared from `libswiftCore.dylib`, which somehow confuses some simulator builds.

Try to figure out what’s happening by replacing the third closure argument with an integer return value. This changes the mangled name of the bulk initializer, which should make it more obvious how/why these builds fail.

rdar://problem/49479386
2019-04-03 10:51:36 -07:00
Michael Ilseman
aab8063267 [SE-0247] Add contiguous string APIs
Adds API for querying, enforcing, and using contiguous strings.
2019-04-02 20:30:02 -07:00
Karoy Lorentey
ea6ae67a9f [stlib] _NativeSet: Revert spurious change 2019-04-02 16:38:01 -07:00
Steve (Numerics) Canon
3fda509805 Implementation of ElementaryFunctions / Real protocols.
This commit implements SE-0246, by adding conformance to Real to the Float, CGFloat, Double, and Float80 types, implemented either in terms of the system's C math library, existing standard library functionality, or LLVM intrinsics. It includes basic test coverage for these new functions, and deprecates and obsoletes *some* existing functionality in the Platform overlay. We still need to make a decision about how to handle the remaining "tgmath" functions, because obsoleting them is technically a source-breaking change (if users have unqualified names like "exp(1)", it's fine, but it would break users who have used qualified names like "Darwin.exp(1)".)
2019-04-02 18:49:31 -04:00
Steve (Numerics) Canon
2f7435da7d First non-intrinsic functions. 2019-04-02 18:48:08 -04:00
Steve (Numerics) Canon
b8d1481fc6 WOW\! 100% less gratuitous type machinery at runtime\! 2019-04-02 18:48:08 -04:00
Steve (Numerics) Canon
5e5cd76e8d Work in progress towards "Mathsable"
Fundamental decision to be made; should implementation hooks present like `Float.exp(_ x: Float) -> Float` or like `Float.Maths.exp(_ x: Float) -> Float`? Having the intermediate namespace to group them as in the second is definitely nicer, but it requires a little bit of extra machinery, and much more importantly, there doesn't seem to be any way to make access to the static `Maths` associatedtype transparent.
2019-04-02 18:48:08 -04:00
Karoy Lorentey
1ddf99a9da [stdlib] Set, Dictionary: Unify casting operations 2019-04-02 13:10:55 -07:00
Michael Ilseman
ff39c345fd Merge pull request #22869 from milseman/gab_barg
[SE-0248] String Gaps
2019-04-02 09:28:34 -07:00
Stephen Canon
60fc39e72a Improve codegen for init(signOf: magnitudeOf:) (#23727)
This can map straight to the LLVM copysign intrinsic for builtin types, which both gets us better codgen and lets the compiler plug this operation into other LLVM-level optimizations.
2019-04-02 09:49:18 -04:00
Hiroki Nagasawa
f85ca6c01a Remove redundant space in first(where:) of Sequence (#23365) 2019-04-01 10:56:16 -05:00
Karoy Lorentey
2bd5da539e [stdlib] Fix Set/Dictionary casting issues
- Fix Set/Dictionary up/downcasting with String keys.
- Improve error handling.
2019-03-29 19:15:09 -07:00
Michael Ilseman
3923fb2268 [String] String.Index.init(_:within:) bounds checks
Bounds check the given index for String.Index's generic initializer
that makes sure a passed index is a valid one for the given
StringProtocol.
2019-03-29 15:43:00 -07:00
Michael Ilseman
0ece62d911 [String] Add Substring.base
Adds Substring.base, analogous to Slice.base, to access the entire
String.

Tests added.
2019-03-29 15:43:00 -07:00
Michael Ilseman
aa519362f3 [String] Add Character.UTF16View and Character.UTF8View
Adds these collections, which are just String's views.

Tests added.
2019-03-29 15:43:00 -07:00
Michael Ilseman
b19c2cf9c3 [String] Add generic String.Index and range inits within a String
Adds a generic version of String.Index.init?(_:within:) and
Range<String.Index>.init?(_:in:).

Tests added
2019-03-29 15:43:00 -07:00
Michael Ilseman
4967fc08eb [Unicode] Add convenience APIs to Unicode encodings
Add convenience APIs to the stdlib's Unicode encodings:

* Unicode.UTF16
  * isASCII
  * isSurrogate
* Unicode.UTF8
  * isASCII
  * width
* Unicode.UTF32
  * isASCII
* Unicode.ASCII
  * isASCII

Tests added
2019-03-29 15:43:00 -07:00
Michael Ilseman
b6a158e1fc [stdlib] Add LegacyABI.swift for legacy non-API declarations 2019-03-29 15:43:00 -07:00
Michael Ilseman
751cf26ef5 [Unicode.Scalar] Add RAC UTF8View
This adds new (availability-controlled) API to Unicode.Scalar,
exposing the scalar's UTF-8 code units as a random-access collection
similarly to how it currently exposes UTF-16 code units.

Tests added.
2019-03-29 15:43:00 -07:00
Karoy Lorentey
7b654b372f [stdlib] Fix availability of Dictionary’s bulk-loading initializer (#23643)
Making it @_alwaysEmitIntoClient makes it available in all OS versions.
2019-03-29 12:54:56 -07:00
David Smith
39745a1e5e Merge pull request #21627 from kubamracek/fix-data-race-on-emptyarraystorage
Fix a data race on _swiftEmptyArrayStorage reported by TSan
2019-03-28 17:38:21 -07:00
Daniel Rodríguez Troitiño
28251a7a3b Merge pull request #19846 from drodriguez/android-aarch64-disable-powl
[android] Fix powl test in Android ARMv7/AArch64.
2019-03-28 07:20:51 -07:00
Daniel Rodríguez Troitiño
7455fb748f [android] Fix powl test in Android ARMv7/AArch64.
In Android ARMv7 there was no alias defined for CLongDouble, so
importing anything with long double was failing. Defining the alias
makes the test pass.

AAPCS64 defines long double as 128 bits, which is still unsupported by
Swift (SR-9072). Disable this particular test for Android and Linux in
AArch64 to not fail (but still test all the other tests).
2019-03-27 13:30:17 -07:00
Mike Ash
965953d7a0 Merge pull request #23451 from mikeash/magic-symbols-for-install-name
[Build] Use magic linker symbols to specify an @rpath-relative install name when targeting pre-stable-ABI OSes.
2019-03-27 08:10:30 -07:00
Nate Cook
b6bb9d2f8c [stdlib] Make unsafe array initializer public (#23134)
[stdlib] Make unsafe array initializer public

This implements SE-0245. The public versions of this initializer call
into the existing, underscored version, which avoids the need for
availability constraints.
2019-03-23 13:18:10 -05:00
Mike Ash
4fb99998ae [Build] Use magic linker symbols to specify an @rpath-relative install name when targeting pre-stable-ABI OSes.
Magic symbols of the form $ld$install_name$os9.0$@rpath/libswiftCore.dylib tell the linker to use that install name when targeting that OS version. Use these symbols to specify an @rpath install name for all back-deployment libraries when targeting watchOS 2.0-5.1, iOS 7.0-12.1, and macOS 10.9-10.14.

rdar://problem/45027809
2019-03-22 10:04:39 -04:00
Saleem Abdulrasool
65d4199c7b Merge pull request #23400 from drodriguez/remove-incorrect-docs
[stdlib] Remove documentation piece that it is not longer true.
2019-03-21 09:30:34 -07:00
Michael Gottesman
384882d5f3 Merge pull request #23201 from compnerd/patience-is-not-always-a-virtue
build: introduce and switch to GYB_SOURCES
2019-03-20 13:27:32 -07:00
Stephen Canon
60e86b9361 Some cleanup of SIMDVector and SIMDVectorTypes source files. (#23389)
Bring formatting closer in line with the rest of the standard lib, remove "public" from extensions (moving it onto the contents defined therein). Restore Swift project headers that were apparently lost at some point.
2019-03-19 12:44:35 -04:00
Kyle Murray
cf5bcabd6e Merge pull request #23406 from krilnon/master
[stdlib] Fix a misspelling in a Dictionary doc comment.
2019-03-18 21:35:56 -07:00