Commit Graph

22380 Commits

Author SHA1 Message Date
Jonathan Grynspan
6951ac4a63 Merge branch 'main' into jgrynspan/executablePath 2026-02-06 17:44:24 -05:00
Meghana Gupta
a0664a938a Merge pull request #87019 from meg-gupta/assertconf
Add -assert-config DisableReplacement to the private oslog library
2026-02-06 09:13:21 -08:00
Alastair Houghton
e38c0652b6 Merge pull request #84906 from al45tair/eng/PR-101623384
[Backtracing] Add initial support for Windows.
2026-02-06 14:53:16 +00:00
Kavon Farvardin
ae77ba81e3 Merge pull request #87013 from kavon/revert-84789
Back out #84789 after additional testing
2026-02-06 02:58:00 -08:00
Alastair Houghton
3e7647de2c [Backtracing] Fix silly mistake.
I really did mean `ret`.

rdar://101623384
2026-02-06 08:53:16 +00:00
Alastair Houghton
ceaba82d6d [Backtracing] Updates after review.
Tweaked the comment in `Runtime/Config.h`.

Fixed a couple of incorrect ARM64 instruction mnemonics.  This still needs
testing on ARM64 Windows.

Fixed an out-of-date comment in `swift-backtrace`.

Use a macro in `Backtrace.cpp` to guarantee we don't overrun the buffer,
and in the process simplify the code slightly.

rdar://101623384
2026-02-06 08:53:16 +00:00
Alastair Houghton
ae71bd8d65 [Backtracing] Fix tests up for Windows.
We can't use `|| true` on Windows, so use `not` instead.

Also, on Windows, program names get downcased because `lit` uses
`os.path.normcase()`, so if we have program names in the output,
make sure the programs are already lower-case.

Fix up the stack overflow test to match the expected output.

Plus fix the macOS build to always build for macOS 26.0 or above.

rdar://101623384
2026-02-06 08:53:16 +00:00
Alastair Houghton
d9b0031f09 [Backtracing] Build and test fixes.
Tweak things to build on Linux and macOS again.

Also fix a few things in the tests.

rdar://101623384
2026-02-06 08:53:15 +00:00
Alastair Houghton
58a6470ac3 [Backtracing] Fix build failures for places Runtime doesn't build.
We should only add the assembly files if we're actually going
to build the `Runtime` module.  This was tripping up iOS/tvOS/
watchOS builds.

rdar://101623384
2026-02-06 08:53:15 +00:00
Alastair Houghton
f6af22c402 [Backtracing] Don't pull in windows.h unnecessarily.
Also, fix two files that managed to use Windows API without
importing `WinSDK` as a result of the leakage caused by including
`windows.h` from `codeview.h`.

rdar://101623384
2026-02-06 08:53:15 +00:00
Alastair Houghton
38c4848b12 [Backtracing] Remember to emit end instruction.
We were omitting the `end` instruction, the upshot of which was
that the compact backtrace was always being decoded as truncated.

rdar://101623384
2026-02-06 08:53:15 +00:00
Alastair Houghton
add83b4d22 [Backtracing] Don't build backtracing code when it's disabled.
Don't even bother building the backtracing code if the backtracing
code is disabled.

rdar://101623384
2026-02-06 08:53:12 +00:00
Jonathan Grynspan
83d82a5af5 swift_slowAlloc() assumes malloc(0) returns non-NULL. (#86922)
`swift_slowAlloc()` and related functions assume that `malloc(0)` and `aligned_alloc(0)` return non-`NULL` pointers. The C standards allow implementations to return `NULL` when the allocation size is `0`.

This PR implements a check for `0` that instead allocates `1`. The cost of the check is negligible next to the cost of actually allocating, but we'll mark it `SWIFT_UNLIKELY` just in case.

Resolves rdar://169304909.
2026-02-05 21:44:47 -08:00
Meghana Gupta
114b782f22 Add @_alwaysEmitIntoClient to _osLogTestHelper 2026-02-05 16:56:16 -08:00
Meghana Gupta
57ee2bd4f5 Add -assert-config DisableReplacement to the private oslog library
We have a private oslog library to test optimizations specific for oslog.
Add -assert-config DisableReplacement to this library similar to the real oslog library.
This prevents surprizing optimizer regressions.
2026-02-05 15:52:36 -08:00
Kavon Farvardin
d5f9a1eeeb Revert "Merge pull request #84789 from nickolas-pohilets/mpokhylets/fix-82618"
This reverts commit b633bd37ac, reversing
changes made to b27bb64b03.
2026-02-05 11:34:59 -08:00
Susana Monteiro
b7459b864f Merge pull request #86933 from susmonteiro/susmonteiro/reapply-non-copyable-cxx-interator
[cxx-interop] Reapply adoption of ~Copyable on UnsafeCxxInputIterator
2026-02-05 18:29:06 +00:00
Joe Groff
f627832f94 Merge pull request #86952 from jckarter/type-instantiation-propagate-afd
Runtime: Propagate addressable-for-dependencies bit in generic and resilient type layout.
2026-02-04 08:03:43 -08:00
Alastair Houghton
7f8398e60b [Backtracing] Improve debug option on Windows.
Made the debug option on Windows work better.

rdar://101623384
2026-02-03 18:23:30 +00:00
Alastair Houghton
0682923f45 [Backtracing] Make the debug option work on Windows.
Hitting `D` when in the backtracer should do the same on Windows
that it does on macOS, namely launching `lldb` and attaching it to
the crashed program.

rdar://101623384
2026-02-03 18:23:30 +00:00
Alastair Houghton
54f9cee919 [Backtracing] Fix typos, tidy up.
Fix a couple of typos and remove some `print()` statements that
were added for debugging.

rdar://101623384
2026-02-03 18:23:30 +00:00
Alastair Houghton
a677131c96 [Backtracing] Tweak a few things after rebasing.
Fix a couple of issues with the rebase.

Also, add code to handle the debug exceptions (which we don't want
to crash the process).

rdar://101623384
2026-02-03 18:23:29 +00:00
Alastair Houghton
6d930d39ec [Backtracing] Make tests work, plus various fixes.
Made the tests run, then fixed various issues with them.

rdar://101623384
2026-02-03 18:23:29 +00:00
Alastair Houghton
4f90a96640 [Backtracing][Windows] Fix things to install swift-backtrace
We needed to modify `build.ps1` to copy `swift-backtrace.exe` into
position.  Also tidy up the code in `AddSwiftStdlib.cmake`.

rdar://101623384
2026-02-03 18:23:29 +00:00
Alastair Houghton
e0845e1483 [Backtracing] Made on-crash backtraces work for 64-bit.
On-crash backtracing is basically there for 64-bit Windows.  It
won't work on 32-bit because of a Swift compiler issue, and there
is a little more work to do yet, but it is now working!

rdar://101623384
2026-02-03 18:23:29 +00:00
Alastair Houghton
38f91e2dbd [Backtracing] Fix Linux and macOS builds.
There was a case-sensitivity problem, and a missing source file.

rdar://101623384
2026-02-03 18:23:29 +00:00
Alastair Houghton
bf9dd3ac55 [Backtracing] Make line numbers work.
Also fix things so that we use the right path separator, depending
on image type, and add support for `DW_AT_specification` attributes
on `DW_TAG_subprogram` entries.

rdar://101623384
2026-02-03 18:23:29 +00:00
Alastair Houghton
3cdac64200 [Backtracer] Fix some bugs that prevented DWARF reading.
This is now fetching symbols successfully, though not line numbers
yet.

rdar://101623384
2026-02-03 18:23:29 +00:00
Alastair Houghton
7f57385be4 [Backtracing][Windows] Add PE file parsing and DWARF-in-PE support.
This should allow us to get symbolicated backtraces for Swift code
that is built with DWARF debug information.

rdar://181623384
2026-02-03 18:23:29 +00:00
Alastair Houghton
d13988bd5f [Backtracing][Windows] Initial Windows support.
This doesn't have a working symbolicator yet, but it does build and
it can obtain a basic backtrace.

It also doesn't include a working `swift-backtrace` program yet.

rdar://101623384
2026-02-03 18:23:29 +00:00
Joe Groff
8f14c35630 Runtime: Propagate addressable-for-dependencies bit in generic and resilient type layout.
Now that the bit controls `Borrow`'s layout, it must be set properly for runtime-instantiated types.
2026-02-02 18:43:46 -08:00
Mike Ash
4a43ce263f Merge pull request #86910 from mikeash/inline-exclusivity-tls-fix
[Runtime] Narrow the conditions for exclusivity using inline asm TLS.
2026-02-02 10:29:47 -05:00
susmonteiro
5a6ca66ea0 [cxx-interop] Reapply adoption of ~Copyable on UnsafeCxxInputIterator 2026-02-02 11:50:15 +00:00
Mike Ash
ae46d77582 [Runtime] Narrow the conditions for exclusivity using inline asm TLS.
We can't use the inline asm on simulators or when TARGET_OS_MAC isn't set.

rdar://169250556
2026-01-30 22:23:09 -05:00
Konrad `ktoso` Malawski
2ec0351b41 [Concurrency] Use Task.immediate for bridged async methods when available (#86807) 2026-01-30 08:15:40 +01:00
Mike Ash
707d96211f Merge pull request #86763 from mikeash/actors-as-locks-switch-deadlock-fix
[Concurrency] Unlock old actor before locking new in actors-as-locks model.
2026-01-29 19:58:01 -05:00
Alex Martini
a77489c08b Merge pull request #85197 from amartini51/sendable_abstract_129033829
[Docs] Improve abstract & flow for Sendable

Fixes: rdar://129033829
2026-01-29 10:35:31 -08:00
Becca Royal-Gordon
e5de981b6c Merge pull request #86855 from beccadax/mod-squad-cxx 2026-01-28 23:29:36 -08:00
Guillaume Lessard
a147e3beac [stdlib] give all the bytes to the unsafe closure 2026-01-28 15:51:06 -08:00
Becca Royal-Gordon
7dcdf1a7ad [NFC-ish] Disable module selectors in CxxStdlib
The module interface for this module intentionally does not qualify its names, since the C++ standard library is modularized differently on different platforms. Make sure we don’t add module selectors to it.

This change is a no-op except in configurations where module selectors are on by default. We are currently testing such configurations before making them the default.
2026-01-28 14:11:14 -08:00
Alastair Houghton
f2958af1c2 Merge pull request #86813 from al45tair/eng/PR-168996222
[Backtracing] For DWARF 3, skip `maximum_operations_per_instruction`
2026-01-28 15:18:33 +00:00
Alastair Houghton
064860825a Merge pull request #86808 from al45tair/eng/PR-168508495-main
[Concurrency] Mark custom executors entry points as SPI.
2026-01-28 09:08:44 +00:00
Doug Gregor
17b333d3c5 Merge pull request #86820 from DougGregor/task-cancellation-handler-with-isolation
Reinstate public API for `withTaskCancellationHandler(operation:onCancel:isolation:)`
2026-01-27 14:31:39 -08:00
Doug Gregor
43217e190d Reinstate public API for withTaskCancellationHandler(operation:onCancel:isolation:)
Some clients are explicitly passing isolation through, so we need to
retain this signature. Fixes rdar://168955495.
2026-01-27 09:41:20 -08:00
Alastair Houghton
07eaaf2ed7 [Backtracing] For DWARF 3, skip maximum_operations_per_instruction
DWARF 3 doesn't have the `maximum_operations_per_instruction` field
in the line number header.  As a result, we were mis-reading the
subsequent fields in the DWARF line table header.

rdar://168996222
2026-01-27 14:37:04 +00:00
Alastair Houghton
61cab14821 [Concurrency] Mark custom executors entry points as SPI.
Marking these as `@_spi(ExperimentalCustomExecutors)` for now, to match
what we're doing for 6.3.

rdar://168508495
2026-01-27 09:48:01 +00:00
Joe Groff
0f3ddfbcc8 Merge pull request #86545 from jckarter/builtin-borrow
`Builtin.Borrow` implementation
2026-01-26 07:32:31 -08:00
Mike Ash
7674c4e9b9 [Concurrency] Unlock old actor before locking new in actors-as-locks model.
swift_task_switchImpl can give up its thread and immediately start running the new code. In the actors-as-locks model, this acquires the new actor's lock and releases the old one. This results is a classic lock ordering problem and can deadlock. Avoid this by releasing the old lock first when in this mode.

rdar://168073822
2026-01-23 19:39:22 -05:00
Doug Gregor
61ce5e39fe Merge pull request #86745 from DougGregor/migration-support-end
Move MigrationSupport.swift to the end of the list
2026-01-23 14:28:00 -08:00
Guillaume Lessard
8f1f7ddbec Merge pull request #86718 from glessard/rdar168561707-outputrawspan-storeBytes-safety
[stdlib] mark `OutputRawSpan.storeBytes()` with `@unsafe`
2026-01-23 11:14:22 -08:00