Commit Graph

21665 Commits

Author SHA1 Message Date
Guillaume Lessard
6fa9780bc5 [span] improve _elementsEqual 2024-10-23 14:48:25 -07:00
Guillaume Lessard
108034e4b0 [span] fix a bounds-checking mistake 2024-10-23 14:06:26 -07:00
Guillaume Lessard
e58e50d17c [span] add availability annotations 2024-10-23 13:14:26 -07:00
Guillaume Lessard
909409181a [gardening] add a relevant FIXME comment 2024-10-23 13:14:22 -07:00
Joe Groff
4a12979584 Merge pull request #77188 from al45tair/eng/PR-137551812-ios-fix
[Backtracing] Fix iOS build.
2024-10-23 08:09:00 -10:00
Joe Groff
8242110bbe Merge pull request #76831 from jckarter/builtin-vector
Builtin.FixedArray
2024-10-23 05:20:21 -10:00
Alastair Houghton
95aef6c972 [Backtracing] Fix iOS build.
The new code needs to not build for iOS.

rdar://137551812
2024-10-23 15:49:15 +01:00
swift-ci
85d3dabbec Merge remote-tracking branch 'origin/main' into rebranch 2024-10-23 01:35:18 -07:00
Alastair Houghton
6d2d4eb19f Merge pull request #77162 from al45tair/eng/PR-137551812
[Backtracing] Bail out earlier for privileged binaries on macOS.
2024-10-23 09:18:07 +01:00
Joe Groff
a184782a38 Introduce a Builtin.FixedArray type.
`Builtin.FixedArray<let N: Int, T: ~Copyable & ~Escapable>` has the layout of `N` elements of type `T` laid out
sequentially in memory (with the tail padding of every element occupied by the array). This provides a primitive
on which the standard library `Vector` type can be built.
2024-10-22 16:21:45 -07:00
swift-ci
13ec468707 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-22 16:09:47 -07:00
Daniel Rodríguez Troitiño
63022333d8 [unittest] Disambiguate references to errno (#77155)
In Xcode 16 SDKs there seem to be two `errno` visible for some files,
one in the `Darwin` module, and one in the `_errno` module (which seems
new for this Xcode version).

Disambiguate the references by prepending `Darwin`, which should be the
one that was being used before Xcode 16 SDKs.
2024-10-22 15:48:56 -07:00
Alastair Houghton
2cc93cf7b0 [Backtracing] Bail out earlier for privileged binaries on macOS.
Also remove the code that deals with file descriptors; we will now
only start the backtracer for processes that have the get-task-allow
entitlement, which means that they've been specifically signed for
debugging, and *that* means that it is no longer critical to ensure
that unexpectedly inherited fds are closed.

rdar://137551812
2024-10-22 12:21:58 +01:00
swift-ci
fd1e3242f8 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-21 22:57:39 -07:00
Daniel Rodríguez Troitiño
d84b23b611 [maccatalyst] Handle macCatalyst static swiftmodules (#76784)
The existing CMake code for macCatalyst swiftmodule only handled the
shared case, and did not have the static pieces that non-macCatalyst
targets are doing.

Try to match as much as possible the non-macCatalyst variables and
structure and allow macCatalyst targets to support static Swift targets.

This is important for the `Cxx.swiftmodule` and `CxxStdlib.swiftmodule`,
since they are only static, and the previous code skipped creating those
files since https://github.com/swiftlang/swift/pull/74994
2024-10-21 22:56:12 -07:00
swift-ci
6284e9f325 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-21 17:59:25 -07:00
Ben Barham
2523660d3b Revert "[DebugInfo] Stop emitting spare bits mask in debug info" 2024-10-21 14:23:04 -07:00
Kuba Mracek
0048c1c624 [embedded] Document the details of the Embedded Swift's refcounting scheme 2024-10-21 08:56:22 -07:00
swift-ci
8af1ee5f5f Merge remote-tracking branch 'origin/main' into rebranch 2024-10-21 08:55:27 -07:00
Guillaume Lessard
979523014c [span] update to match latest proposal tweaks 2024-10-19 23:46:54 -07:00
Kuba Mracek
8666aef39f [embedded] Fix a memory leak caused by incorrect refcounting logic around doNotFreeBit 2024-10-18 23:19:40 -07:00
Guillaume Lessard
7faf7bc634 [stdlib] add Span 2024-10-18 22:57:43 -07:00
Guillaume Lessard
5b3647270b [stdlib] add RawSpan 2024-10-18 22:57:43 -07:00
Guillaume Lessard
5e819aeea6 [stdlib] generalize isPOD() over suppressible protocols 2024-10-18 22:57:43 -07:00
swift-ci
138625f758 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-18 10:41:34 -07:00
Egor Zhdan
940730efb6 Merge pull request #77024 from swiftlang/egorzhdan/maccatalyst-ld-warning
[build] Do not implicitly bump macCatalyst deployment target
2024-10-18 19:32:30 +02:00
swift-ci
fa99c9a86c Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 19:01:34 -07:00
David Smith
bed89567d4 Disable calling _swift_stdlib_dyld_is_objc_constant_string, it's unnecessary currently (#77064) 2024-10-17 19:01:08 -07:00
swift-ci
5bfc87531f Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 18:21:11 -07:00
Michael Gottesman
1a07030a0a Merge pull request #77028 from gottesmm/swift_task_runOnMainActor
[concurrency] Implement swift_task_runOnMainActor/hop to main actor thunk
2024-10-17 18:11:24 -07:00
swift-ci
f207571405 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 14:48:02 -07:00
Dario Rexin
5b8cfa473f Merge pull request #77078 from drexin/wip-oops
[Runtime] Use aligned offset to compute new field offset for unmanage…
2024-10-17 14:42:33 -07:00
Michael Gottesman
b1750bad1a [concurrency] Implement swift_task_runOnMainActor.
This routine takes a synchronous non-throwing main actor isolated closure
without a result. If we are dynamically on the main actor, we just run the
closure synchronously. Otherwise, we run a new task on the main actor and call
the closure on that.

This builds on top of the previous commit by using
swift_task_isCurrentExecutorWithFlags in the implementation of this function.

To backwards deploy this function on Darwin, I used some tricks from libdispatch
to validate that we are on the main queue.
2024-10-17 11:17:38 -07:00
Michael Gottesman
5fa02d8711 [concurrency] Add a new entrypoint: swift_task_isCurrentExecutorWithFlags.
This entrypoint is similar to swift_task_isCurrentExecutor except that it
provides an ABI level option flag that enables one to configure its behavior in
a backwards deployable manner via the option flag.

I used this to expose at the ABI level the ability to check the current executor
without crashing on failure, while preserving the current behavior of
swift_task_isCurrentExecutor (which crashes on failure).

I am going to use this to implement swift_task_runOnMainActor.
2024-10-17 11:17:38 -07:00
swift-ci
083ff08307 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 10:55:18 -07:00
Augusto Noronha
17926e78fa Merge pull request #77038 from augusto2112/stop-spare-bits-debug
[DebugInfo] Stop emitting spare bits mask in debug info
2024-10-17 10:41:28 -07:00
Mike Ash
763666ed6c Merge pull request #77031 from mikeash/actor-enqueue-retain
[Concurrency] Retain the actor around the CAS in enqueue() when necessary.
2024-10-17 13:38:04 -04:00
Dario Rexin
2bcece3e52 [Runtime] Use aligned offset to compute new field offset for unmanaged properties in CVW
The original fix only added the field size to the unaligned offset, which is not correct.
2024-10-17 10:31:07 -07:00
swift-ci
70ece60b69 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 10:11:01 -07:00
Dario Rexin
0ec1f4b6ce Merge pull request #76799 from drexin/wip-137066879
[Runtime] Properly compute offset for unmanaged properties in generic…
2024-10-17 09:42:22 -07:00
swift-ci
1df3ffb7cb Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 09:12:58 -07:00
Tim Kientzle
5bd2c4b93c Merge pull request #77027 from tbkka/tbkka-remotemirror-classexistential
Fix multi-payload enums with Class Existential payloads on 32-bit targets
2024-10-17 08:57:38 -07:00
Tim Kientzle
689ffbe28b A separate "indirect case" counter didn't properly distinguish generic indirect vs. non-generic indirect.
Counting indirect cases as regular non-empty cases is a better fit.
2024-10-17 08:49:08 -07:00
swift-ci
6d6062cf59 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-16 23:07:22 -07:00
Kuba Mracek
2358cc973d [Concurrency] Split out the default cooperative executor into a separate opt-in library 2024-10-16 22:49:22 -07:00
Kuba (Brecka) Mracek
44bea0552a Merge pull request #76029 from kubamracek/embedded-traps-unique
[embedded] Make assert helper functions always inlined to avoid trap basic blocks from merging
2024-10-16 22:46:39 -07:00
Tim Kientzle
fe90ad5684 Let indirect enum cases export spare bits
To determine the correct enum layout, we first count various
categories of cases.  Before, we counted indirect generic cases as
"generic", but regular "generic" cases can't export spare bits.

Change this to count "indirect" cases as a separate category.
In particular, this ensures that fully-indirect enums use
spare bits from the pointers even when some or all of the cases
are generic.

Resolves rdar://133890406
2024-10-16 18:31:28 -07:00
Tim Kientzle
cfc7b2ef2e Use SWIFT_FALLTHROUGH 2024-10-16 17:02:47 -07:00
Tim Kientzle
502941ca5a More arcana about MPEs carrying class existentials
The first word in a class existential is the class pointer itself.
This pointer exposes spare bits differently depending
on the platform, which becomes apparent when you try to reflect
an Optional carrying such an MPE.

Add new test cases and some logic to zero out the first
word of spare bit information only on platforms with 8-byte pointers.
2024-10-16 16:06:37 -07:00
Mike Ash
6b01fed9c4 [Concurrency] Retain the actor around the CAS in enqueue() when necessary.
It's possible that the job we enqueue holds the last strong reference to the actor. If that job runs on another thread after we enqueue it, then it's possible for `this` to be destroyed while we're still in this function. We need to use `this` after the enqueue when the priorities don't match. When it looks like that will happen, retain `this` before the enqueue to ensure it stays alive until we're done with it.

Introduce a defensive retain helper class that makes it easy to do a single retain under certain conditions even in a loop, and does RAII to balance it with a release when the scope exits.

rdar://135400933
2024-10-16 16:51:29 -04:00