Commit Graph

21803 Commits

Author SHA1 Message Date
Eric Miotto
31536e9ee3 CMake: make the libswiftCompatibilitySpan symlink relative (#84200)
Currently we create an absolute one -- this prevents to use the partial
toolchain before the installation phase (namely for configurations that
run Swift tests on a different device than the builder).

Addresses rdar://160277259
2025-10-10 17:46:22 +01:00
Mike Ash
716f2bc0b7 [Concurrency] Emit async task running/waitingOn metadata inline into CPUTrace.
This allows tracking async code execution throughout a task's lifetime.

rdar://137230240
2025-10-10 17:46:22 +01:00
Anton Korobeynikov
7668666ad2 Support differentiation of wrapped value modify accessors (#78794)
Some fixes for coroutines with normal results and `partial_apply` of coroutines were required.

Fixes #55084
2025-09-10 02:30:26 -07:00
Egor Zhdan
6f0ab5dce8 Merge pull request #83914 from egorzhdan/egorzhdan/guiddef
[WinSDK] Modularize `<guiddef.h>`
2025-09-09 16:24:23 +01:00
Alastair Houghton
3e74869830 Merge pull request #84122 from al45tair/eng/PR-159930644
[Linux][Backtracing] Don't try to use `process_vm_readv()`.
2025-09-09 11:16:11 +01:00
Tim Kientzle
e5f9ffce12 Merge pull request #84024 from tbkka/tbkka-missing-embedded-allocators
Fill in two missing functions for Embedded Swift
2025-09-08 06:44:10 -07:00
Alastair Houghton
da4e319d16 [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-05 11:38:28 +01:00
David Smith
11adbdd707 Don't grow smol Strings to 16 characters when bridging out if tagged pointer formation fails (#84068)
Fixes rdar://159771498
2025-09-04 12:34:19 -07:00
Stephen Canon
f3da6b205e Try to clarify availability of Float16 and Float80 (#84011) 2025-09-04 10:22:18 -04:00
Stephen Canon
de8c4cd4d5 Mark U[M]BP.baseAddress transparent (#84097)
As well as a few other trivial API, since apparentely these do not reliably get inlined as-is.

Addresses rdar://159801610
2025-09-04 08:21:16 -04:00
Guillaume Lessard
cbcef93a54 Merge pull request #84002 from stephentyrone/pointer-comment-clarification
Remove "if and only if" language from [Raw]Span's _pointer field
2025-09-03 16:33:36 -07:00
Arnold Schwaighofer
f1b6de0de5 Merge pull request #83833 from aschwaighofer/mark_unsaferawpointer_withContiguousStorageIfAvailable_inline_always
stdlib: Mark UnsafeRawBufferPointer's withContiguousStorageIfAvailable as @inline(__always)
2025-09-02 10:17:59 -07:00
Tim Kientzle
ff50f8f2be Fill in two missing functions for Embedded Swift
`swift_coroFrameAlloc` is needed by `_read`/`_modify` accessors

`swift_deallocUninitializedObject` which I believe is needed for failable class initializers

Resolves rdar://157028375
Resolves rdar://157276375
2025-08-29 16:57:08 -07:00
Eric Miotto
c9345a38c4 [Concurrency] Add availability to one of the ExecutorJob extensions
Without this, we may fail building Concurrency when enforcing strict
availability.

Addresses rdar://159473855
2025-08-29 15:09:46 -07:00
Eric Miotto
5464129aa1 Merge pull request #83990 from edymtt/edymtt/update-availability-taskpriority
[Concurrency] Change availability for a TaskPriority extension
2025-08-29 13:48:55 -07:00
Stephen Canon
567c619e3f Remove "if and only if" language from [Raw]Span's _pointer field
"can be nil" paired with "if and only if" lends itself to misreading, so let's clean this up a bit.
2025-08-29 09:36:12 -04:00
Jesse L. Zamora
bf60ab1630 Float16Support.cpp: Add __arm__ for ARM 32-bit architectures (#83979)
This is the only patch required to cross-compile Swift for armv6 and armv7 that is used here:

https://github.com/swift-embedded-linux/armhf-debian/blob/main/patches/0002-Add-arm-to-float16support-for-missing-symbol.patch
2025-08-29 10:03:41 +01:00
Eric Miotto
173c5ff2a4 [Concurrency] Change availability for a TaskPriority extension
We need the `init?(JobPriority)` constructor to be
`StdlibDeploymentTarget 5.9`
so the compiler will not complain when we reference it
 from `ExecutorJob.createTrampoline` when building the standard library
without strict availability.

Addresses rdar://159397287
2025-08-28 15:34:10 -07:00
Egor Zhdan
28f9db7bfa [WinSDK] Modularize <guiddef.h>
This fixes modularization errors that arise when importing a C++ header that contains `#include <guiddef.h>`, which might hijack this header from the WinSDK module where it belongs.
2025-08-28 22:21:55 +01:00
Egor Zhdan
4b0e8861f5 [cxx-interop] Fix warning about missing unsafe 2025-08-28 12:10:14 +01:00
Egor Zhdan
521c2cea94 Merge pull request #83943 from egorzhdan/egorzhdan/wstring
[cxx-interop] Provide overlay for `std::wstring`
2025-08-28 10:35:51 +01:00
Egor Zhdan
4dda78846d [cxx-interop] Provide overlay for std::wstring
This adds CxxStdlib overlay features to `std::wstring` similarly to `std::string`, `std::u16string`, etc.

This lets clients e.g. convert between Swift String and C++ wide string simply by calling an initializer.

rdar://159272493
2025-08-27 13:20:09 +01:00
Alastair Houghton
687e09da65 Merge pull request #82456 from al45tair/concurrency-updates
[Concurrency] Updates after second SE pitch.
2025-08-27 11:40:07 +01:00
Saleem Abdulrasool
6f1b83143a Merge pull request #83933 from compnerd/unsafe
Windows: annotate unsafe constructs in the overlay
2025-08-26 23:47:32 -07:00
Doug Gregor
75b94d7a5b Merge pull request #83921 from DougGregor/with-unsafe-temporary-alloc-typed-throws
Adopt typed throws in withUnsafeTemporaryAllocation
2025-08-26 22:47:49 -07:00
Saleem Abdulrasool
eafc8140da Windows: annotate unsafe constructs in the overlay
Mark a number of overlay calls as `unsafe` to account for the new memory
safety work.
2025-08-26 18:03:56 -07:00
Doug Gregor
45069a199b Merge pull request #82080 from jamieQ/patch-2
[docs][NFC]: minor formatting edits to SendableMetatype docs
2025-08-26 17:15:45 -07:00
Doug Gregor
3782db5ce1 Small fixes for typed throws in withUnsafeTemporaryAllocation 2025-08-26 17:09:07 -07:00
Doug Gregor
e96e1746bb Adopt typed throws in withUnsafeTemporaryAllocation
The interior wrapping in Result<T, U> is a little unfortunate, but is
currently necessary because we end up with extra stack allocations
along the error-handling path in a do..catch that aren't there when
using untyped throws. We can simplify the implementation if we can
eliminate the extraneous stack allocation.

Fixes rdar://134973620.
2025-08-26 13:06:48 -07:00
Alastair Houghton
d6224d16d9 [Concurrency] Fix minimal stdlib build again.
Some mentions of `ExecutorJob` were not guarded by the required
`SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY` condition.
2025-08-26 09:38:14 +01:00
Alastair Houghton
ff8d2fa80c [Concurrency] Support continuous waits in CooperativeExecutor.
This fixes some WASM tests.
2025-08-26 09:38:14 +01:00
Alastair Houghton
bd27a14ea0 [Concurrency] Fix cooperative executor to return only after all jobs run.
We were terminating after the first set of jobs; if one of them scheduled
another job, and there were no timers running, we would terminate,
which was wrong.
2025-08-26 09:38:13 +01:00
Alastair Houghton
d0b3d14c68 [Concurrency] Don't expose Dispatch or CF executors directly.
Also add `final` to the `CooperativeExecutor` declaration.
2025-08-26 09:38:13 +01:00
Alastair Houghton
250458f9f6 [Concurrency] Add a couple of comments.
Add some documentation comments to the Dispatch and CF executors,
and update the comments for the allocation and private data APIs.
2025-08-26 09:38:13 +01:00
Alastair Houghton
0fbd382e9c [Concurrency] Fix CooperativeExecutor to not loop forever.
If a job enqueues another job on the executor, we might never leave
the inner `while` loop in the `run()` method.  Fix this by taking
the contents of the run queue and only running those jobs in the
queue at the time we enter the inner loop.
2025-08-26 09:38:13 +01:00
Alastair Houghton
871a062002 [Concurrency] Remove canonicalization code.
I don't think we actually need this.  If you have a non-canonical
(i.e. derived) clock, you can just implement `enqueue` and/or `run`
and call those methods on the clock you're wrapping.
2025-08-26 09:38:13 +01:00
Alastair Houghton
7af5b8d8fd [Concurrency] Add implementations of run and enqueue for built-in clocks.
The built-in clocks should have implementations of `run` and `enqueue`,
to allow derived clocks to call those implementations.
2025-08-26 09:38:13 +01:00
Alastair Houghton
6046286b58 [Concurrency] Updates after second SE pitch.
We no longer attempt to convert timestamps from the passed-in `Clock`
in order to allow any clock to work with any executor.  Instead,
executors that do not recognise a clock should call the `enqueue`
function on that `Clock`, which lets the `Clock` itself decide how
to proceed.

Additionally, rename `SchedulableExecutor` to `SchedulingExecutor`.
2025-08-26 09:38:11 +01:00
David Smith
0038b92e2b Speed up -isEqual:/isEqualToString: (#83894)
Fixes rdar://159058877
2025-08-25 18:03:54 -07:00
Eric Miotto
732a216c7e CMake: readd StringProcessing dependency to StdlibUnittest
This reverts commit 4a95275bde.

I remove the dependency looking at the modules that StdlibUnittest
directly imports -- but it turns out we import StringProcessing
indirectly as a result of importing Foundation from e.g. the underlying
Apple SDKs.

Addresses rdar://158797152
2025-08-20 13:52:17 -07:00
Arnold Schwaighofer
0b5233fa63 stdlib: Mark UnsafeRawBufferPointer's withContiguousStorageIfAvailable as @inline(__always)
The body seems to only reinterpret pointer types (`withMemoryRebound`).
Inlining it should not lead to code size gains and has shown to reduce code size.
2025-08-20 09:19:56 -07:00
Jaap Wijnen
a5ef5fe226 Improve differentiableMap vjp performance (#83807)
Improve differentiableMap vjp performance by reserving capacity for the values and pullbacks arrays.
2025-08-19 17:08:14 -07:00
Max Desiatov
900c7c9d7b Platform/CMake: use arch instead of arch_subdir
This fixes wasi-libc.modulemap not found after installation
2025-08-19 11:25:14 +01:00
Max Desiatov
e227e50704 Platform/CMake: remove unused message func, mod var 2025-08-18 20:42:45 +01:00
Max Desiatov
4299bca9d6 Platform/CMake: add embedded-stdlib-${mod} dependency 2025-08-18 20:28:59 +01:00
Max Desiatov
6582ad92bc Embedded Wasm: enable import WASILibc
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.

Resolves https://github.com/swiftlang/swift/issues/83513

rdar://157467412
2025-08-18 18:41:10 +01:00
Eric Miotto
3fc59c439f Merge pull request #83730 from edymtt/edymtt/fix-deployment-target-versions-for-more-private-libraries
CMake: allow more private libraries to be used on older OSes
2025-08-18 06:46:02 -07:00
Anthony Latsis
a482f37944 Merge pull request #83650 from muukii/patch-1
Fix typo in Observations.swift
2025-08-16 13:23:58 +01:00
Guillaume Lessard
c9a3fdf722 Merge pull request #83771 from glessard/rdar158440246 2025-08-16 02:40:16 -07:00
Guillaume Lessard
476491392b [stdlib] guard against underflow 2025-08-15 17:24:06 -07:00