Commit Graph

7762 Commits

Author SHA1 Message Date
Tim Kientzle
fbec09bd56 Consolidate format-independent discussion at the end 2021-04-20 15:40:39 -07:00
Robert Widmann
0149ccd0ca Add arm64_32 support for Swift
Commit the platform definition and build script work necessary to
cross-compile for arm64_32.

arm64_32 is a variant of AARCH64 that supports an ILP32 architecture.
2021-04-20 14:59:04 -07:00
Stephen Canon
8736683cf7 Prevent arbitrary objects from conforming to RNG. (#36969)
Me, sobbing: "Look, you can't just point at an empty struct and call it a RandomNumberGenerator."
Swift 5.4, pointing at anything: "RNG."
2021-04-20 16:39:16 -04:00
Tim Kientzle
2a476586d7 Backwards compatibility note 2021-04-20 11:25:03 -07:00
Tim Kientzle
1d5eb5b2be Wordsmithing 2021-04-19 10:30:31 -07:00
Tim Kientzle
0c7f85c56d Feedback 2021-04-19 10:25:09 -07:00
Tim Kientzle
33226b0505 Distinguish "string" (input), "value" or "number" (abstract real number that the string represents), and "instance" (the resulting ${Self}). 2021-04-19 09:09:11 -07:00
Tim Kientzle
b183c7d6c3 present, not future 2021-04-16 16:12:12 -07:00
Tim Kientzle
20ba149dc3 More wordsmithing. 2021-04-16 14:00:11 -07:00
Tim Kientzle
98cec1321d Document how out-of-range inputs are handled
This changed recently so that overflow and underflow consistently return signed
infinity or zero instead of nil.  (Previously, overflow returned nil, underflow
returned zero.)

Among other benefits:
 * The new behavior distinguishes malformed input (nil) from valid but out-of-range input.
 * The new behavior preserves the sign of the input
 * The new behavior is consistent with how floating-point parsing behaves in other langauges

Resolves rdar://76728925
2021-04-16 10:22:59 -07:00
Doug Gregor
194536472a [AnyHashable] Work around older compiler limitation.
An older Swift compiler failed to account for the witnesses in a
conformance with platform availability having their own availability,
which causes that compiler to reject the Swift module's .swiftinterface
file when it includes `AnyHashable` 's conformance to
`_HasCustomAnyHashableRepresentation`. Work around the issue by making
the one witness (`_toCustomAnyHashable`, which is trivial)
always-emit-into-client, so it does not need any availability.

Fixes rdar://76370138.
2021-04-15 21:21:41 -07:00
heoblitz
20ffc036ed Add whitespace to markup 2021-04-14 14:43:14 +09:00
Benzi
4e0c6f99b8 [stdlib] Set.intersection iterate over smaller set (#36678)
* [stdlib] Set.intersection iterate over smaller set

When intersecting two sets, it is beneficial to iterate over the smaller sized set of the two, and check membership on the other. This speeds up runtime dramatically for cases where the current set is significantly larger than the set you are intersecting against.

* Review comments - variable names, implicit swap
2021-04-11 11:42:10 -04:00
Ben Cohen
125902923c Revert lazy mirror children (#36722) 2021-04-08 16:34:50 -10:00
Doug Gregor
fcd5d43457 Revert "stdlib: Add reasync variants of '&&', '||' and '??'" 2021-04-05 16:45:44 -07:00
Alex Martini
1c5c111aab Merge pull request #36709 from amartini51/main
Doc comment corrections
2021-04-05 15:46:31 -07:00
Michael Ilseman
9ab21d3215 Merge pull request #36623 from xwu/better-atoi
[stdlib][SR-7556] Re-implement string-to-integer parsing
2021-04-03 08:30:25 -06:00
Michael Ilseman
f495c02afe Merge pull request #36667 from milseman/small_differential
[stdlib] Fix bug in small string uninitialized init
2021-04-02 16:46:51 -06:00
Xiaodi Wu
cef11cd82e [stdlib][NFC] Final renamings for new integer parsing implementations. 2021-04-02 10:20:04 -04:00
Karoy Lorentey
63d0b734c0 Merge pull request #36669 from lorentey/fix-float16-sendable
[stdlib] Float16/Intel: Add an explicit Sendable conformance to work around a swiftinterface issue
2021-04-02 01:37:07 -07:00
Alex Martini
4b3064ede5 Simplify prose in doc comment.
Incorporates PR feedback from @tbkka.
2021-04-01 16:05:48 -07:00
Alex Martini
1bfce98e8d Revise finite/infinite note for NaN.
Incorporates PR feedback from @tbkka.
2021-04-01 16:05:48 -07:00
Xiaodi Wu
c40c90402a [stdlib] Address reviewer comments and make some minor edits to string-to-integer parsing. 2021-04-01 13:03:56 -04:00
Karoy Lorentey
cb67f45394 [stdlib] Float16: Add explicit Sendable conformance to work around swiftinterface issue 2021-04-01 00:51:14 -07:00
Slava Pestov
c473869141 stdlib: Add reasync variants of '&&', '||' and '??'
Fixes rdar://problem/72770687.
2021-03-31 19:21:08 -04:00
Karoy Lorentey
ec7258e2fc [stdlib] Fix incorrect Float16 extension
This extension (introduced in https://github.com/apple/swift/pull/35264) was placed in a file location where it wasn’t correctly guarded against mentioning Float16 on macOS/x86_64, so the generated .swiftinterface file included a reference to an unavailable declaration. (The dummy stand-in Float16 type that we currently use on Intel macOS.)

Moving the declaration out of the “AnyHashable” section and into a file region that’s more suitable for it (i.e., enclosed in `#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))`) resolves the issue.

rdar://76025365
2021-03-30 18:43:16 -07:00
Michael Ilseman
49eddbf318 [stdlib] Fix bug in small string uninitialized init
Fix a bug and enforce the invariant that all bits between the last code unit
and the descriminator in a small string should be unset.
2021-03-30 18:24:28 -06:00
Xiaodi Wu
5d943f46bd [stdlib] Further simplify string-to-integer parsing and change some inlining choices. 2021-03-29 12:08:28 -04:00
Xiaodi Wu
0319bdc966 [gardening] Fix tab size inconsistency. 2021-03-29 11:30:48 -04:00
Xiaodi Wu
529891c911 [stdlib] Simplify implementation of string-to-integer parsing. 2021-03-29 11:27:21 -04:00
Xiaodi Wu
ebad4bbb5d [stdlib] Specialize FixedWidthInteger.init(_:radix:). 2021-03-29 10:19:22 -04:00
Xiaodi Wu
cc8a351cc1 [stdlib] Never inline two more string-to-integer parsing methods. 2021-03-29 09:02:41 -04:00
Xiaodi Wu
7c333b8e44 [stdlib] Never inline fallback helper methods when parsing strings to integers. 2021-03-28 22:22:50 -04:00
Xiaodi Wu
a9c57c3bcd [stdlib] Make FixedWidthInteger.init?(_:radix:) always inlined, and fix a think-o. 2021-03-28 20:44:11 -04:00
Xiaodi Wu
ad992f48dd [stdlib][SR-7556] Re-implement string-to-integer parsing. 2021-03-28 16:49:09 -04:00
Stephen Canon
09cd45d4c2 Remove a small helper function that took a Builtin.VecNxInt1 type.
It saved some boilerplate, but if it doesn't get inline (as in debug builds), Swift doesn't know how to legalize the type at the call boundary, and we crash.
2021-03-24 23:34:28 -04:00
Stephen Canon
5afe404707 Concrete simd mask operations (#36571)
* Replace lhs/rhs with a/b for clarity of documentation and to match concrete ops.

* Concretize additional SIMDMask operations:

.&=, .|=, .^=, .==, .!=

Also reflect documentation changes back to generic implementations.
2021-03-24 23:15:46 -04:00
Karoy Lorentey
390cebe88b Merge pull request #36004 from lorentey/document-copyContents
[stdlib] Document a fatal surprise with `Sequence._copyContents`
2021-03-22 16:49:18 -07:00
Stephen Canon
7e326063c5 Concrete SIMD operations, part 1 (#36172)
Adds concrete overloads of the following SIMD operations:
- Comparisons: .==, .!=, .<, .<=, .>, .>=
- Logical operations on masks: .!, .&, .^, .|
- Integer arithmetic: &+, &-, &, &+=, &-=, &=
This makes some simple benchmarks 10-100x faster, which is basically a no-brainer, while staying away from the most heavily used operators, so hopefully doesn't impact compilation performance too badly.
2021-03-22 16:48:21 -04:00
tbkka
26ab27648e Casting from AnyHashable to AnyHashable should never create another wrapper (#36470)
* Casting from AnyHashable to AnyHashable should never create another wrapper

This adds a conformance for _HasCustomAnyHashableRepresentation to
AnyHashable that simply returns self.  This ensures that anytime
you try to create a new AnyHashable wrapper for an existing
AnyHashable, you just get back the original.

Resolves rdar://75180619

* Move the `Struct AnyHashable` change to `without-asserts` list

As suggested by @lorentey
2021-03-22 09:03:29 -07:00
Robert Widmann
c5a751212d Merge pull request #36446 from wonhee009/Result 2021-03-21 09:58:14 -07:00
David Smith
e793e0e0e4 Always ask Cocoa for terminated char*s
(cherry picked from commit b7ce22ba1525dccd47f4095a9bf8a640b238a5fa)
2021-03-19 13:01:23 -07:00
Doug Gregor
9579390024 [SE-0304] Rename ConcurrentValue to Sendable 2021-03-18 22:48:20 -07:00
Meghana Gupta
dbea482085 Refactor FixedWidthInteger init (#36485) 2021-03-18 13:47:12 -07:00
wonhee
09971acf8c fix Result flatMapError remark 2021-03-16 14:03:18 +09:00
Xiaodi Wu
4c7059f59a [stdlib][SR-13883] Avoid advancing past representable bounds when striding (#34860)
* [stdlib][SR-13883] Avoid advancing past representable bounds when striding.

* [stdlib] Expand a test and add a comment to ensure correct floating-point stride bounds checking.

* [stdlib][NFC] Clarify a comment in a test.

* [stdlib][NFC] Adjust copyright notices, clarify comments, delete '-swift-version=3' for tests.

* [stdlib] Add implementations for fixed-width integer strides for performance.

* [stdlib] Document `Strideable._step` and modify overflow checking behavior of `Stride*Iterator`.

* [stdlib] Address reviewer comments, postpone documentation changes

* [stdlib][NFC] Update documentation for '_step(after:from:by:)'

* [stdlib][NFC] Use 'nil' instead of an arbitrary value for integer striding '_step' index
2021-03-11 08:18:28 -05:00
eeckstein
38efe16ad5 Merge pull request #36355 from eeckstein/fix-arrayslice
stdlib: fix ARC for getting an ArraySlice of an CocoaArray with non-contiguous storage.
2021-03-10 09:12:50 +01:00
Erik Eckstein
375f289597 stdlib: fix ARC for getting an ArraySlice of an CocoaArray with non-contiguous storage.
For this special case we copied the objects out of the cocoa array without retaining them.
This lead to a double-free crash.

Unfortunately I could not come up with an isolated test case.

rdar://74624065
2021-03-08 20:34:19 +01:00
Erik Eckstein
5be350a975 stdlib: add a semantic attribute on the String.utf8CString and define it as "readonly"
Needed for StringOptimization.
2021-03-08 08:34:53 +01:00
Xiaodi Wu
d4300dd7fe [stdlib] Fix conversion from Float16 to unsigned integer types (#36219)
* [stdlib] Fix conversion from Float16 to unsigned integer types

* [stdlib] Tighten up concrete Float16-to-integer conversions
2021-03-02 08:57:41 -05:00