Commit Graph

7762 Commits

Author SHA1 Message Date
Jeremy Schonfeld
e59ba66970 Un-deprecate _StringGuts._isContiguousASCII 2024-01-04 14:58:41 -08:00
Dario Rexin
65343add82 [Embedded] Enable SIMD types in embedded Swift (#70674)
* [Embedded] Enable SIMD types in embedded Swift

* Incorporate feedback and add test

* Update simd.swift
2024-01-04 07:28:36 -08:00
Guillaume Lessard
b67b2cb2c5 link to issue regarding initializer renaming 2024-01-03 14:38:05 -08:00
Guillaume Lessard
3e73445a3e Merge pull request #61093 from glessard/se0370-primary-associated-types
[stdlib] use a primary associated type
2024-01-03 10:59:57 -08:00
Kuba (Brecka) Mracek
1efcb415e9 Merge pull request #70217 from kubamracek/embedded-set
[embedded] Add Set to the embedded stdlib
2024-01-03 08:13:52 +01:00
Max Desiatov
0d35c42cf3 Fix error message typo in stdlib/public/core/StaticString.swift (#70643) 2024-01-02 08:11:52 +00:00
honghoker
2fdb8b0481 Fix typo whiteSpace between line comment 2023-12-24 00:05:57 +09:00
Guillaume Lessard
b869a3cabe [se-0405] improve readability of double-optional unwrapping 2023-12-21 10:44:52 -08:00
Guillaume Lessard
4617553ee7 [se-0405] improve slow path 2023-12-21 10:44:52 -08:00
Guillaume Lessard
0ba58de1e1 [se-0405] improve fast path 2023-12-21 10:44:52 -08:00
Guillaume Lessard
148a7e2eff [stdlib] make __SharedStringStorage able to own a pointer 2023-12-21 10:44:52 -08:00
Guillaume Lessard
566fbf4fec [se-0405] update availability to a realistic release target 2023-12-21 10:44:52 -08:00
Guillaume Lessard
92df9b4bdb Apply suggestions from code review
Co-authored-by: Ben Rimmington <me@benrimmington.com>
2023-12-21 10:44:52 -08:00
Guillaume Lessard
f7006880c7 [se-0405] adapt implementation from staging package 2023-12-21 10:44:52 -08:00
Kuba Mracek
bde23e2c2f [embedded] Avoid using reinterpretCast in set bridging 2023-12-20 14:39:38 +01:00
Kuba Mracek
29a7c52433 [embedded] #if the entire _BridgeStorage struct instead of sprinkling a bunch of #ifs inside 2023-12-20 14:32:48 +01:00
Kuba Mracek
25f971d344 [embedded] Add explaining comment about _swiftEmptyArrayStorage/_swiftEmptySetSingleton 2023-12-20 14:08:16 +01:00
Kuba Mracek
943c7c2ee5 [embedded] Drop 'public' from forward declaration of arc4random_buf 2023-12-20 14:04:35 +01:00
Allan Shortlidge
9a0eb73302 Merge pull request #70547 from tshortli/diagnose-unreachable-cant-back-deploy
AST/SILGen: Use @_alwaysEmitIntoClient diagnostic helper in unavailable code
2023-12-20 00:16:29 -08:00
Stephen Canon
154454e16a Use specialized [u]int64 -> FloatingPoint conversions even on 32b platforms. (#70541)
This means that we'll end up going int32 -> int64 -> float/double sometiems, but LLVM knows how to optimize away the intermediate conversion so we end up with just a normal 32b->float conversion as desired, and we get much, much better performance on oddball platforms like arm64_32.
2023-12-19 20:29:30 -05:00
Allan Shortlidge
6d22433d0f AST/SILGen: Use @_alwaysEmitIntoClient diagnostic helper in unavailable code.
The `_diagnoseUnavailableCodeReached()` function was introduced in the Swift
5.9 standard library and employs `@backDeployed` to support compilation of
binaries that target OS releases aligned with earlier Swift releases.
Unfortunately, though, this backdeployment strategy doesn't work well for some
unusual build environments. Specifically, in some configurations code may be
built with a compiler from a recent Swift toolchain and then linked against the
dylibs in an older toolchain. When linking against the older dylibs, the
`_diagnoseUnavailableCodeReached()` function does not exist but the
`@backDeployed` thunks emitted into the binary reference that function and
therefore linking fails.

The idea of building with one toolchain and then linking to the dylibs in a
different, older toolchain is extremely dubious. However, it exists and for now
we need to support it. This PR introduces an alternative
`_diagnoseUnavailableCodeReached()` function that is annotated with
`@_alwaysEmitIntoClient`. Calls to the AEIC variant are now emitted by the
compiler when the deployment target is before Swift 5.9.

Once these unusual build environments upgrade and start linking against a Swift
5.9 toolchain or later we can revert all of this.

Resolves rdar://119046537
2023-12-19 16:26:56 -08:00
Alejandro Alonso
f96ed95b8a Remove some hold over in core 2023-12-18 14:01:16 -05:00
Alejandro Alonso
2c0b473b8d Add Synchronization module 2023-12-18 14:01:16 -05:00
Alejandro Alonso
87974a83af Some documentation work, some work from review, add tests 2023-12-18 14:01:16 -05:00
Alejandro Alonso
6d6e55a931 Apply feedback from pitch 2023-12-18 14:01:15 -05:00
Alejandro Alonso
f747162084 Implement the Atomic type 2023-12-18 14:01:15 -05:00
Doug Gregor
82ebc54857 Merge pull request #70520 from DougGregor/no-opaque-parameters-in-stdlib
Don't use opaque parameters in the standard library
2023-12-18 10:33:25 -08:00
Doug Gregor
3b4e37e5fe Don't use opaque parameters in the standard library
The SIL printer is printing opaque parameters as <anonymous>, which
breaks the SIL parser. Stop using opaque parameters in the standard
library for the moment to unbreak SIL parsing of the standard library.
2023-12-18 10:14:57 -08:00
Doug Gregor
6536f57ab5 Merge pull request #70516 from DougGregor/typed-throw-try-bang
[Typed throws] Terminate with an error message for typed try! failures.
2023-12-17 02:41:48 -08:00
Doug Gregor
d740965753 [Typed throws] Terminate with an error message for typed try! failures. 2023-12-16 23:58:51 -08:00
Kavon Farvardin
b43f861827 [NCGenerics] delete _Copyable from stdlib
resolves rdar://115793371
2023-12-16 11:17:31 -08:00
Kuba Mracek
490ffe28f7 [embedded] Fix build of the stdlib, avoid changing non-embedded codepaths in BridgeStorage.swift 2023-12-13 17:39:42 -08:00
Rose
9998161e97 Prevent modulo in places where we can check the length
NFC.

We know maxLength must be positive and non-zero, and therefore, i += 1 will be the next index until we reach maxLength, in which case the result is 0. Rather than perform a modulo, which requires division, every time, we can just reset i when it reaches the end of the buffer.
2023-12-13 19:13:54 -05:00
Kuba Mracek
d3849fe843 [embedded] Use @_extern(c) instead of @_silgen_name on arc4random_buf 2023-12-13 11:28:17 -08:00
Kuba Mracek
2f0883ab24 [embedded] Add Set to the embedded stdlib 2023-12-13 11:28:17 -08:00
Kuba (Brecka) Mracek
4f592f0022 Merge pull request #70407 from kubamracek/embedded-placeholders
[embedded] Fix editor placeholders by adding a StaticString variant of _undefined
2023-12-13 09:00:10 -08:00
Erik Eckstein
e4ea7491a2 IRGen: fix and re-enable static read-only arrays
Static read-only arrays didn't work when passed to ObjectiveC as NSArray.
The storage class of static read-only arrays doesn't carry information about the Element type.
The new `__SwiftDeferredStaticNSArray` is generic over the element type and doesn't have to rely on the element type information of the array storage.

rdar://94185998
2023-12-13 11:45:01 +01:00
Dave Lee
a56c89f97e [Debug] Conditional _DebugDescription macro declaration (#70351)
Make `_DebugDescription` macro conditional upon macro availability in the build.

The `Macros` feature is based on the value of `SWIFT_BUILD_SWIFT_SYNTAX`.

See https://github.com/apple/swift/pull/69626#issuecomment-1848221971
2023-12-12 15:19:49 -08:00
Kuba Mracek
8ee33d2260 [embedded] Use #if instead of unavailability for _undefined 2023-12-12 13:06:16 -08:00
Kuba Mracek
996f51e3be [embedded] Fix editor placeholders by adding a StaticString variant of _undefined 2023-12-12 11:04:14 -08:00
eeckstein
484fc77a8c Merge pull request #70301 from eeckstein/fixed-array
Add experimental support for fixed arrays
2023-12-11 09:36:29 +01:00
Kavon Farvardin
a4a6c69e97 Merge pull request #70277 from kavon/inverse-escapable
[NCGenerics] add `~Escapable`
2023-12-10 05:42:24 -08:00
Kavon Farvardin
e99ce1cc5d [NCGenerics] add ~Escapable
Basic implementation of `~Escapable` in the type system.

rdar://119216918
2023-12-10 01:25:43 -08:00
Erik Eckstein
43c4fce773 stdlib: make Array.count an array semantic function
So far the semantic annotation was just added to the internal `_getCount` function.
But for FixedArray it is also required to add the `@_semantics("array.get_count")` to the public API.
2023-12-09 18:49:58 +01:00
Erik Eckstein
dd9ce40ba1 add the allocVector builtin 2023-12-09 18:49:57 +01:00
Dave Lee
ad585b3195 [Debug] Add _DebugDescription macro (#69626)
Implementation of the DebugDescription macro pitched on the forums: 
https://forums.swift.org/t/pitch-debug-description-macro/67711. In this initial commit, 
the macro is named `_DebugDescription` to indicate it's internal use at this time, 
pending Swift Evolution.

rdar://115180949
2023-12-08 15:19:16 -08:00
Stephen Canon
d66f233839 Add concrete overload for != on all stdlib integer types. (#70043)
* Add concrete overload for  on all stdlib integer types.

* Add very basic tests for type inference of comparands.

* Add a comment explaining why these overloads are present.
2023-12-06 16:40:16 -05:00
Nate Chandler
b7f5171b83 [stdlib] BitwiseCopyable loadUnaligned overloads.
The new overloads will make use the new BitwiseCopyableArchetypeTypeInfo
to avoid the extra copy that is currently done.
2023-12-05 17:21:05 -08:00
Kavon Farvardin
b6c7ff4140 Merge pull request #70142 from kavon/ncgenerics-stdlib-workarounds
[stdlib] add missing `Element` type witnesses
2023-12-01 10:47:05 -08:00
nate-chandler
54a152f284 Merge pull request #69938 from nate-chandler/rdar96919870/1/bitwise-copyable-protocol
[BitwiseCopyable] Add a marker protocol.
2023-12-01 06:57:11 -08:00