Commit Graph

22351 Commits

Author SHA1 Message Date
Alastair Houghton e77a8ba8ec Merge pull request #87092 from jessezamora/#86955-dwarf-v2-support
Support reading DWARFv2 format in `DwarfReader`
2026-02-10 16:42:59 +00:00
Joe Groff 1ddd222544 Merge pull request #87046 from jckarter/borrow-layout-sync
IRGen/Runtime: Fix discrepancies in Borrow type layout.
2026-02-10 07:09:46 -08:00
Clinton Nkwocha 2e8977fe5c [stdlib] Typed Throws Adoption for Several Dictionary APIs (#86894)
Adopts typed throws for several Dictionary APIs: mapValues, merge,
merging and init.

---------

Co-authored-by: Guillaume Lessard <guillaume.lessard@apple.com>
2026-02-10 11:47:33 +00:00
Joe Groff 8d41f21aea IRGen/Runtime: Fix discrepancies in Borrow type layout.
On the compiler side, `Borrow` ought to use extra inhabitants from its value
representation, or at least the null pointer for the pointer representation.

On the runtime side, the choice of representation needs to take size into
account.
2026-02-09 14:38:08 -08:00
Stephen Canon 45260c7de4 Make withExtendedLifetime, withUnsafePointer, etc inline(always) (#85921) 2026-02-09 13:40:38 -08:00
Alex Martini e3fb97a108 Merge pull request #87050 from amartini51/typo_164515574
Fix typos in documentation
2026-02-09 11:57:35 -08:00
Finagolfin 9ccacd9b8b [Backtracing] Excise code again that was previously disabled on platforms where backtracing was disabled
This was failing to compile on platforms like Android armv7 where it is disabled.
2026-02-09 14:41:06 +05:30
Doug Gregor 29e9fbb3e4 Merge pull request #87054 from DougGregor/embedded-swift-less-unicode
[Embedded] Make a few standard library functions not depend on the Unicode tables
2026-02-07 12:23:13 -08:00
Doug Gregor b09a82b17a Eliminate string copy from readLine's newline removal code
Thanks for the prod, Rauhul
2026-02-06 19:58:15 -08:00
Doug Gregor 7b89f4c475 Merge pull request #84357 from DougGregor/debug-precondition-condfail-transparent
Use condfail_message in _debugPrecondition and make it more transparent
2026-02-06 16:20:04 -08:00
Doug Gregor eed25ef52d Make StaticBigInt's debugDescription no longer depend on the Unicode tables 2026-02-06 15:22:59 -08:00
Jesse Zamora e73c16a330 Support reading DWARFv2 format in DwarfReader
- It is essentially the same as DWARFv3 minus a few missing fields.
2026-02-06 18:13:40 -05:00
Doug Gregor 708115195e Ensure that readLine doesn't require the Unicode tables 2026-02-06 15:01:48 -08:00
Doug Gregor 1e8317803e Make Bool's conformance to LosslessStringConvertible not use String.==
String.== performs normalization, which brings in the Unicode tables.
Don't use it for Bool's conformance to LosslessStringConvertible,
which doesn't need it. It's only the "true" and "false" strings that
matter.
2026-02-06 14:10:38 -08:00
Alex Martini ad13c9ff6a Fix typos in documentation 2026-02-06 13:52:27 -08:00
Doug Gregor d003f1dcca Use condfail_message in _debugPrecondition and make it more transparent
Improve debugging from core dumps for Embedded Swift by using condfail
rather than trap within _debugPrecondition, and make the call stack
transparent enough that we promote these out to callers.

Fixes rdar://159471659.
2026-02-06 11:33:38 -08: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