Commit Graph

7762 Commits

Author SHA1 Message Date
Nate Chandler
b266abe5c0 [BitwiseCopyable] Add a marker protocol.
Behind the experimental feature BitwiseCopyable.
2023-11-30 15:25:46 -08:00
Kavon Farvardin
4096ca39b2 [stdlib] add missing Element type witnesses
With `NoncopyableGenerics` enabled, we currently lose some ability for
associatedtype inference to find a suitable type witness based on a
value witness. (rdar://118998138)

The stdlib accidentally uses that inference for Sequence.Element,
due to the default witness for `_customContainsEquatableElement`
mentioning `Iterator.Element` whereas the requirement only states
`Element`.
2023-11-30 15:05:20 -08:00
Kuba Mracek
fa7da75cdc [embedded] Port and start building Darwin.swiftmodule as embedded 2023-11-27 20:16:58 -08:00
Doug Gregor
3baf6ac31a Revert "[Typed throws] Support overrides that are contravariant in the thrown error" 2023-11-16 10:40:23 -08:00
Doug Gregor
5db3685e1c [Existential collections] Switch internal _map rethrows methods to throws
These class methods are internal, but because they are overridden and are
part of a `@usableFromInline`, `@_fixed_layout` class, we they can't be
moved over to typed throws without breaking ABI. However, they are
only ever called from typed-throws functions, which already need a
do...catch dance to downcast the error itself. Make them `throws`
instead, which is ABI-compatible, but eliminates the need for
do...catch hackery in the function itself.
2023-11-13 11:47:00 -08:00
Doug Gregor
1892396e14 Improve ABI-only rethrowing map shims based on code review
Replace the hackish use of `@_disfavoredOverload` with the more principled
use of `@_silgen_name` for the entrypoint we are maintaining, then rename
these functions in source to `__rethrows_map` to indicate what they're for.

While here, make them `throws` instead of `rethrows`. The ABI is the
same, and `throws` allows us do avoid to do/catch tricks with rethrows
functions.
2023-11-13 11:47:00 -08:00
Doug Gregor
0d15d4edbe Replace rethrowing map with generic typed throws
Adopt typed throws for the `map` operation to propagate thrown error
types through the `map` API. This is done in a manner that is backward
compatible for almost all cases:

* The new typed-throws entrypoint is `@_alwaysEmitIntoClient` so it
can back-deploy all the way back.
* The old `rethrows` entrypoint is left in place, using
`@usableFromInline` with `internal` so it is part of the ABI but not
the public interface, and `@_disfavoredOverload` so the type checker
avoids it while building the standard library itself. The old
entrypoint is implemented in terms of the new one.

Note that the implementation details for the existential collection
"box" classes rely on method overriding of `_map` operations, and the
types are frozen, so  we don't get to change their signatures. However,
these are only implementations, not API: the actual API `map`
functions can be upgraded to typed throws.

Note that this code makes use of a known hole in `rethrows` checking
to allow calling between `rethrows` and typed throws. We'll need to do
something about this for source-compatibility reasons, but I'll follow
up with that separately.
2023-11-13 11:47:00 -08:00
Doug Gregor
c433740c08 Enable TypedThrows in the standard library build 2023-11-13 11:47:00 -08:00
eeckstein
1e9135f7cd Merge pull request #69718 from eeckstein/embedded-stdlib
Two small fixes for the embedded stdlib
2023-11-09 07:51:05 +01:00
Alejandro Alonso
16cbb76fc6 Merge pull request #69710 from Azoy/stdlib-warning-cleanup
[stdlib] Silence some standard library warnings
2023-11-08 20:09:13 -08:00
Alejandro Alonso
e41fe5a173 Special case some unknown builtin macros 2023-11-08 16:02:31 -08:00
Alejandro Alonso
3deacf8944 Fix backwards iteration of word breaking 2023-11-08 13:26:20 -08:00
Yuta Saito
7df19b86ea [stdlib] Fix calling convention mismatch for debugger utility functions (#69352)
This is the 3rd attempt to fix the mismatch, where the actual definition
(e.g. `swift_retainCount`) are defined with C calling-convention and the
callers wrongly expect Swift calling-convention.

The 1st fix broke ABI compatibility by introducing new symbol references
from app-side without any availability checks.
The 2nd fix broke lldb's retain counting feature due to new x-ref to
Clang module in serialized function body by `@_alwaysEmitIntoClient`.

This attemps to avoid introducing serialized x-ref to Clang module by
using new `@_extern(c)` attribute.

Resolves rdar://113910821

Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2023-11-08 10:45:28 -08:00
Erik Eckstein
c8db45907f EmbeddedRuntime: add swift_willThrow 2023-11-08 16:23:28 +01:00
Erik Eckstein
de6edc70e8 stdlib: build the embedded stdlib core with -enable-ossa-modules
As it is the case for the regular stdlib core
2023-11-08 14:01:25 +01:00
Alejandro Alonso
17c30f162d Merge pull request #69194 from karwa/patch-17
[NFC][In Both Senses] Use _NormData type instead of performing a lookup directly
2023-11-07 21:44:19 -08:00
Alejandro Alonso
31aed274c4 Silence some standard library warnings 2023-11-07 15:03:53 -08:00
Philippe Hausler
7a2c21d312 [Embedded] enable random APIs if a RandomNumberGenerator is provided, but leave system random number generators unavailable (#69645) 2023-11-03 21:12:22 -07:00
Kuba (Brecka) Mracek
9d846a07e1 Merge pull request #69498 from kubamracek/embedded-once-thread-safe
[embedded] Make embedded swift_once thread-safe
2023-11-02 08:58:21 -07:00
Kuba Mracek
95d5d71d51 [embedded] Add asserts on predicate value into swift_once 2023-10-30 09:10:30 -07:00
Kuba Mracek
b057417e52 [embedded] Make embedded swift_once thread-safe 2023-10-29 20:33:43 -07:00
Karoy Lorentey
7176bd386e [5.11][stdlib] Bump runtime version indicator to 5.11 2023-10-26 13:52:37 -07:00
Karoy Lorentey
02531db29b [5.10][stdlib] Bump runtime version indicator to 5.10
(cherry picked from commit 6181609559)
2023-10-26 13:50:56 -07:00
Nate Cook
2c244b9698 Fix precondition in UMRBP.initialize(as:fromContentsOf:)
This precondition checks to make sure that the content-providing
collection isn't larger than the allocated buffer, but was preventing
using a buffer that is the exact same size as the collection.
2023-10-25 17:17:36 -05:00
Arnold Schwaighofer
235c27b749 Don't keep generic versions of PtrAuth functions alive
We don't support generating code for ptrauth builtins with generic
inputs (or non-constant inputs). We rely on specialization/inlining for
such code to work.

After a recent commit (#68843 ) code in IRGen keeps internal unreferenced
functions alive for debugging purposes.

This is a problem for the generic functions in PtrAuth.swift using
ptrauth builtins.

Opt out of this new behavior by sprinkling some pixie dust.

Fixes debug swift standard library builds targeting arm64e.

rdar://117411740
2023-10-24 11:52:47 -07:00
Kyle
f96ae2f2db [Documentation] Fix UnsafeMutablePointer's documentation 2023-10-20 10:54:44 +08:00
Kuba (Brecka) Mracek
ed105d02f4 Merge pull request #69256 from kubamracek/embedded-arc-crash
[embedded] Fix an LLVMARCOpts crash by avoiding direct calls to swift_retain/swift_release
2023-10-19 09:14:30 -07:00
Kuba Mracek
db10e78eb2 [embedded] Start diagnosing metatype/value_metatype instructions in embedded Swift 2023-10-18 16:51:10 -07:00
Philippe Hausler
e9b01a35d8 [Embedded] Include OptionSet as part of the embedded build (#69197)
* [Embedded] Include OptionSet as part of the embedded build

* [Embedded] Include SetAlgebra as part of the embedded build
2023-10-18 15:49:08 -07:00
Kuba Mracek
6900efe42c [embedded] Fix an LLVMARCOpts crash by avoiding direct calls to swift_retain/swift_release 2023-10-18 14:44:18 -07:00
Kuba (Brecka) Mracek
1686800c26 Merge pull request #69180 from kubamracek/embedded-move-protocol-aliases
[embedded] Move _CustomStringConvertibleOrNone/_LosslessStringConvertibleOrNone to avoid detaching doccomments from their declarations
2023-10-17 21:45:19 -07:00
Karl
d66e06a971 Remove unnecessary import 2023-10-15 20:03:52 +02:00
Karl
e9f11d70a6 [NFC][In Both Senses] Use _NormData type instead of performing a lookup directly 2023-10-15 19:36:10 +02:00
Kuba Mracek
624df4d71b [embedded] Make ExpressibleByStringInterpolation available in embedded Swift 2023-10-14 23:10:55 -07:00
Kuba Mracek
043a9fd15c [embedded] Move embedded ifdefs around in ObjectIdentifier.swift to avoid detaching doccomments from their decls 2023-10-14 11:27:14 -07:00
Kuba Mracek
c8a5ac0142 [embedded] Use Builtin.RawPointer as the argument type on swift_release_n 2023-10-13 20:55:58 -07:00
Kuba Mracek
3646c32b45 [embedded] Move _CustomStringConvertibleOrNone/_LosslessStringConvertibleOrNone to avoid detaching doccomments from their declarations 2023-10-13 15:31:30 -07:00
Pavel Yaskevich
a0dfab9ab2 [SE-0331] Mark unsafe pointer conformances to Sendable as explicitly unavailable
This is a preferred way to make sure that Sendable inference doesn't
happen for these types because they are marked as @frozen.
2023-10-10 21:42:46 -07:00
Saleem Abdulrasool
d61b8855e9 stdlib: map wchar_t to UInt16 on Windows
This is an ABI breaking change for Windows.  `WCHAR` on Windows is
mapped to `short` (`-fshort-wchar` makes it `unsigned short`).  When C++
interop is enabled, `WCHAR` will be mapped to `wchar_t` which is then
mapped to `short` (or `unsigned short` if `-fshort-wchar` is specified).
Correct the mapping type to get the desired behaviour.
2023-10-09 20:02:48 -07:00
Kuba Mracek
809fa63b83 [embedded] Pass all default stdlib SWIFT_COMPILE_FLAGS to the embedded stdlib build too 2023-10-09 09:00:51 -07:00
Kuba Mracek
5d8c55eacb [embedded] Initial Swift Concurrency for embedded Swift 2023-10-06 20:04:03 -07:00
Alex Martini
de18b08d18 Merge pull request #68993 from amartini51/assert_65958589
Replace "sanity check" in  doc comments per Apple Style Guide.

https://help.apple.com/applestyleguide/#/apsge70df12b?sub=apd57d1e8d9c

Resolves rdar://65958589
2023-10-06 09:23:45 -07:00
Alex Martini
ef84aa9b39 Replace "sanity check" in doc comments. 2023-10-05 11:41:37 -07:00
nate-chandler
a9e03df58c Revert "[Diagnostics] Require explicit releasenone." 2023-10-04 14:19:15 -07:00
Kuba Mracek
e9961323d8 [embedded] Avoid using Optional in the forward declared free() function in EmbeddedRuntime 2023-10-03 11:29:11 -07:00
Kuba (Brecka) Mracek
e3b3b47097 Merge pull request #68784 from kubamracek/embedded-roundingmode
[embedded] Fix a warning in stdlib build about never executed switch case
2023-10-03 09:04:20 -07:00
Kuba (Brecka) Mracek
75838507d8 Merge pull request #68929 from kubamracek/embedded-sdk3
[embedded] Resolve empty -sdk path warning in embedded stdlib build, take 3
2023-10-03 07:02:19 -07:00
Kuba (Brecka) Mracek
0d2f98a368 Merge pull request #68912 from kubamracek/embedded-closures-heap
[embedded] Support closures with captures and promoting locals to refcounted heap objects
2023-10-03 07:00:46 -07:00
Kuba (Brecka) Mracek
61be59948f Merge pull request #68786 from kubamracek/embedded-no-swiftinterface
[embedded] Do not emit .swiftinterface files for fragile modules (embedded stdlib, Cxx.swiftmodule)
2023-10-02 19:34:16 -07:00
Kuba Mracek
d579c62fee [embedded] Resolve empty -sdk path warning in embedded stdlib build, take 3 2023-10-02 17:55:02 -07:00