Commit Graph

21492 Commits

Author SHA1 Message Date
Alastair Houghton
a0c424622a [Observation] Add threading fatal error handler.
When the Threading library experiences a fatal error, we need to
tell it what to do.
2025-11-03 15:53:39 +00:00
Alastair Houghton
9739a2f5d4 [Linux][Backtracing] Don't try to use process_vm_readv().
We used to try to use `process_vm_readv()` if `CAP_SYS_PTRACE` is
enabled.  This avoided using signal handlers to catch crashes when
we try to read through an invalid pointer, but it complicates the
code and it turns out not to work on some Linux kernels where
the `process_vm_readv()` syscall is unavailable.

rdar://159930644
2025-09-26 09:02:22 +01:00
Max Desiatov
c36e33ea7a [6.2.1] Embedded Wasm: enable import WASILibc (#84396)
**Explanation**: Cherry-pick of #83792, merged as 450cb14597
WASILibc wasn't built for the embedded stdlib in `stdlib/public/Platform/CMakeLists.txt`. New `copy_wasilibc_modulemap_embedded_resource` and `embedded-stdlib-platform-${triple}` targets are added, the latter for `wasm32-unknown-wasip1` only for now. Also added a `wasilibc_functions.swift` test to verify the result.
**Scope**: limited to Embedded Swift for Wasm;
**Risk**: low due to limited scope;
**Testing**: added new lit test to the existing Embedded Swift test suite;
**Issue**: rdar://157467412
**Reviewer**: @bnbarham
2025-09-19 14:14:32 -07:00
Marc Prud'hommeaux
5212e0f023 Support 16 KB page sizes on Android (#81596)
Android 15+ requires that native libraries be compiled with a linker
flag to support 16 KB page sizes. See:
https://developer.android.com/guide/practices/page-sizes#compile-r26-lower
2025-08-19 18:44:57 +05:30
Philippe Hausler
838cb7a91b Revert "[Observation] Ensure deinitialized Observable types don't leave active observations in memory (#82752)" (#83492)
This reverts commit a349e64039.

This is in concert of https://github.com/swiftlang/swift/pull/83436

<!--
If this pull request is targeting a release branch, please fill out the
following form:

https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1

Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:

  Resolves <link to issue>, resolves <link to another issue>.

For more information about linking a pull request to an issue, see:

https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->

<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:

https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci

Thank you for your contribution to Swift!
-->
2025-08-08 17:13:13 -07:00
Slava Pestov
95baef19df Merge pull request #83300 from slavapestov/update-availability-macros-26-6.0
[6.2] Update utils/availability-macros.def
2025-07-26 10:47:45 -04:00
David Smith
215620af3d [6.2] Fix lengthOfBytes(using:) semantics (#83340)
(cherry picked from commit ea7c3d4ec8)
2025-07-25 22:22:51 -07:00
Alastair Houghton
4f7be0814a [Concurrency] Update availability of UnimplementedExecutor.
We need it to be `StdlibDeploymentTarget 6.2` rather than
`SwiftStdlib 6.2`, so that we can update the availability definitions.

rdar://156710569
2025-07-25 15:45:46 -04:00
David Smith
155d7fbbcf [6.2] Make sure SwiftObject doesn't crash when compared to tagged pointers (#83271)
Cherry pick of https://github.com/swiftlang/swift/pull/83269
2025-07-25 01:11:46 -07:00
Michael Ilseman
7983566de5 [6.2] Better docs for UTF8Span (#83184) (#83209)
Cherry pick of https://github.com/swiftlang/swift/pull/83184

<!--
If this pull request is targeting a release branch, please fill out the
following form:

https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1

Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:

  Resolves <link to issue>, resolves <link to another issue>.

For more information about linking a pull request to an issue, see:

https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->

<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:

https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci

Thank you for your contribution to Swift!
-->

Co-authored-by: Alex Martini <amartini@apple.com>
2025-07-23 03:48:20 -07:00
Stephen Canon
59e64904dc [6.2] Use unsigned arithmetic for Span bounds checks (#83215)
This allows us to eliminate a comparison;
https://github.com/swiftlang/swift/pull/83172 will allow the compiler to
do it for us instead in the future.

**Explanation:** Changes the implementation of Span's subscript bounds
checks to use a single unsigned comparison instead of two signed
compares.
**Scope:** Narrow. Does not apply to any other API.
**Issues:** rdar://156068535 
**Original PRs:** https://github.com/swiftlang/swift/pull/83150
**Risk:** Low. Minor implementation tweaks to API that is not widely
adopted.
**Testing:** CI
**Reviewers:** @glessard @meg-gupta
2025-07-23 03:38:07 -07:00
Guillaume Lessard
a345e3a8b3 Merge pull request #83000 from glessard/rdar147780495-OutputSpan-updates-62
[SE-0485, 6.2] OutputSpan and OutputRawSpan
2025-07-17 19:12:58 -07:00
Yuta Saito
0a5a694b46 Merge pull request #83120 from kateinoigakukun/yt/cherry-pick-6.2-gh83086
[6.2][Concurrency] Fix runtime isolated-conformance checks with static stdlib
2025-07-17 22:00:15 +09:00
Konrad `ktoso` Malawski
8e4d9a3c8a [6.2][Concurrency] Remove symbols of startSynchronously, make it AEIC (#83089)
Co-authored-by: Pavel Yaskevich <pyaskevich@apple.com>
2025-07-17 00:44:36 -07:00
Guillaume Lessard
2a88f0e764 [stdlib] add OutputSpan to backdeployment library 2025-07-16 17:19:42 -07:00
Yuta Saito
e6453a34a0 [Concurrency] Fix runtime isolated-conformance checks with static stdlib
Most of linkers pull object files from static archives only if any
symbol from that object file is referenced, even if the object contains
a ctor code. `Setup.cpp` didn't have any symbols referenced from
other code, so it was not linked in when the concurrency runtime was
linked in statically. This commit moves the ctor code to `Task.cpp`
to ensure that it is always linked in.
2025-07-16 23:50:31 +00:00
Guillaume Lessard
5ba72f267f Merge pull request #83023 from glessard/rdar155474776-extracting-62
[SE-0488, 6.2] Implementation for SE-0488
2025-07-15 13:59:29 -07:00
Saleem Abdulrasool
8bf3af09a6 Merge pull request #82166 from Steelskin/fabrice/6.2-line-directive
🍒 [6.2] line-directive: Stop expanding response files
2025-07-15 11:40:13 -07:00
Jonas Devlieghere
3d0ceb7715 Merge pull request #82997 from augusto2112/change-remote-addr-6.2-3
[NFC][RemoteInspection] Add an opaque AddressSpace field to RemoteAddress
2025-07-14 13:24:19 -07:00
Alastair Houghton
eefdd69c8d Merge pull request #82915 from al45tair/eng/PR-151147606-take2
[Concurrency] Remove custom global executors from 6.2.
2025-07-14 16:20:57 +01:00
Guillaume Lessard
6414aa226f [stdlib] rename RawSpan.extracting functions 2025-07-12 22:58:00 -07:00
Guillaume Lessard
ac3e47612c [stdlib] rename Span.extracting functions 2025-07-12 22:58:00 -07:00
Guillaume Lessard
402a0cf2c8 [stdlib] remove bulk-update from MutableRawSpan per SE-0485 2025-07-11 19:03:03 -07:00
Guillaume Lessard
34a26d6d9a [stdlib] remove bulk-update from MutableSpan per SE-0485 2025-07-11 19:03:03 -07:00
Guillaume Lessard
3b4279c671 [stdlib] rename MutableRawSpan.extracting functions 2025-07-11 19:03:03 -07:00
Guillaume Lessard
05fe6fa522 [stdlib] rename MutableSpan.extracting functions 2025-07-11 19:03:03 -07:00
Guillaume Lessard
8c7d0db816 [stdlib] make OutputRawSpan changes from SE-0485 2025-07-11 19:03:02 -07:00
Guillaume Lessard
f11f3a9b72 [stdlib] make OutputSpan changes from SE-0485 2025-07-11 19:03:02 -07:00
Guillaume Lessard
ea4083777b [stdlib] internal UnsafeRawBufferPointer tweaks 2025-07-11 19:03:02 -07:00
Guillaume Lessard
d078734051 [stdlib] InlineArray consumed by OutputSpan 2025-07-11 19:03:01 -07:00
Guillaume Lessard
9f9565f4b2 [stdlib] in-place initializer for InlineArray 2025-07-11 19:03:01 -07:00
Guillaume Lessard
42c5988161 [stdlib] add OutputRawSpan 2025-07-11 19:03:01 -07:00
Guillaume Lessard
850bb23d48 [stdlib] add OutputSpan 2025-07-11 19:03:00 -07:00
Guillaume Lessard
ccffb19afd [stdlib] alignment-checking functions for pointers
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2025-07-11 19:03:00 -07:00
Augusto Noronha
79824f56b2 [RemoteAddress] Handle comparison of addresses in different spaces
Sometimes it makes sense to compares addresses from different address
spaces.

rdar://148361743
(cherry picked from commit c97dfd6b05)
2025-07-11 16:36:40 -07:00
Augusto Noronha
e2c8b761cd [NFC][RemoteInspection] Add an opaque AddressSpace field to RemoteAddress
Add an extra opaque field to AddressSpace, which can be used by clients
of RemoteInspection to distinguish between different address spaces.

LLDB employs an optimization where it reads memory from files instead of
the running process whenever it can to speed up memory reads (these can
be slow when debugging something over a network). To do this, it needs
to keep track whether an address originated from a process or a file. It
currently distinguishes addresses by setting an unused high bit on the
address, but because of pointer authentication this is not a reliable
solution. In order to keep this optimization working, this patch adds an
extra opaque AddressSpace field to RemoteAddress, which LLDB can use on
its own implementation of MemoryReader to distinguish between addresses.

This patch is NFC for the other RemoteInspection clients, as it adds
extra information to RemoteAddress, which is entirely optional and if
unused should not change the behavior of the library.

Although this patch is quite big the changes are largely mechanical,
replacing threading StoredPointer with RemoteAddress.

rdar://148361743
(cherry picked from commit 58df5534d2)
(cherry picked from commit 8f3862b5e7)
2025-07-11 16:36:40 -07:00
Konrad `ktoso` Malawski
9ac4ebc603 Merge pull request #82984 from ktoso/pick-task-group-docs 2025-07-12 05:01:37 +09:00
Alex Martini
12b998e4bc Revise doc comment for style & clarity
- Move the definition of 'structured concurrency' to the beginning of
  the section.
- Avoid future tense.  Fix some mixed future+present tense errors.
- Write bullet points as individual sentences, not as the clauses of one
  long sentence.
- Apple Style: Use 'since' only in the sense of 'after'.
- Apple Style: Use 'you' instead of 'one'.
- Apple Style: Close up 'non-' except when ambiguous.
- DevPubs style: Avoid bare 'this' for clarity.  Here, 'this guarantee'
  tells the reader what 'this' refers to.
- DevPubs style: Avoid 'may' which can be ambiguous between possibility
  and permission.
2025-07-11 12:00:54 +09:00
Alex Martini
430f49b98b Fix more 'cancel(l)ed' style issues 2025-07-11 11:45:25 +09:00
Alex Martini
929a167eda Remove stray spaces
These looks like the side effect of a find-and-replace for PR 82558
fixing 'cancelled' vs 'canceled'.
2025-07-11 11:45:22 +09:00
Konrad `ktoso` Malawski
7a6527af83 Merge pull request #82558 from ktoso/wip-cleanup-group-docs 2025-07-11 11:45:15 +09:00
Changhyun Kang
1416a74f11 [Concurrency] fix documentation typos in TaskGroup.swift (#82291) 2025-07-11 11:44:52 +09:00
Konrad 'ktoso' Malawski
fba13f8eda [Concurrency] Add missing Task.immediateDetached, which drops task locals 2025-07-11 08:45:08 +09:00
Konrad 'ktoso' Malawski
6f3099b564 [Concurrency] a few missing overloads for immediate tasks 2025-07-11 08:45:03 +09:00
Philippe Hausler
a349e64039 [Observation] Ensure deinitialized Observable types don't leave active observations in memory (#82752)
Explanation:
This ensures a potential leak with SwiftUI and other systems using
Observation do not leak observation closures when the potential
Observable instances used are only weakly referenced inside the tracking
closure.
 
Scope:
This is limited to the runtime behavior of Observable types and has no
ABI or language level interactions.

Issues:
rdar://112167556

Original PRs:
https://github.com/swiftlang/swift/pull/79823
https://github.com/swiftlang/swift/pull/82307

Risk:
Low - This is very targeted to just Observation, however it is a
behavioral change which does not make this a zero risk change.

Testing:
New unit tests were added to catch at least some of the potential cases
this issue can occur with.
2025-07-10 17:14:27 -04:00
Guillaume Lessard
b78124470c Merge pull request #82896 from glessard/rdar154331399-makeReallyContiguous-62
[stdlib, 6.2] Make String.makeContiguousUTF8() strictly true
2025-07-09 15:47:15 -07:00
Alastair Houghton
bd289dc548 [Concurrency] Remove custom global executors from 6.2.
The custom global executors work is not landing in 6.2, so make
sure it isn't public there.

rdar://151147606
2025-07-09 15:45:15 +01:00
Pavel Yaskevich
3c98a1e76f Merge pull request #82885 from swiftlang/revert-82860-remove-startSynchronously-6.2
Revert "[6.2][Concurrency] Remove deprecated `Task.startSynchronously` API"
2025-07-09 00:19:30 -07:00
Guillaume Lessard
1830334aa3 Merge pull request #82883 from glessard/rdar155275054-default-inits-allspans-62
[stdlib, 6.2] Default initializers for Span-family types
2025-07-08 18:48:07 -07:00
Doug Gregor
958e74c48c Merge pull request #82852 from DougGregor/span-back-deployment-version-fixes-6.2
[6.2] Fix deployment version for Span back-deployment library
2025-07-08 16:09:03 -07:00