Commit Graph

22799 Commits

Author SHA1 Message Date
Mike Ash 61b512b68b Merge pull request #89078 from mikeash/swift_getFunctionFullNameFromMangledName-leak-fix
[Distributed] Fix leaks in failure paths of swift_getFunctionFullNameFromMangledName.
2026-05-14 21:26:38 -04:00
Mike Ash 23fac72075 Merge pull request #88933 from mikeash/remote-mirror-inline-array
[Reflection] Support inspection of InlineArray.
2026-05-14 19:53:11 -04:00
Augusto Noronha 12f6b5f403 Merge pull request #89059 from augusto2112/fix-cross-mod-extension
[RemoteInspection] Fix handling of extensions in DemanglingForTypeRef
2026-05-14 10:04:38 -07:00
Konrad `ktoso` Malawski 2b70cce8d2 Distributed docs: Implementing DistributedActorSystem article (#88605)
As we now have docc doc catalogues and can have articles since
https://github.com/swiftlang/swift/pull/88061, we finally have a place
to put distributed actor system documentation!
2026-05-14 07:34:02 +09:00
Guillaume Lessard fd595f461e Merge pull request #88934 from glessard/rdar147935102-span-bytes-docs
[stdlib] improve doc-comments for span and bytes properties
2026-05-13 15:27:08 -07:00
Augusto Noronha e5873e820b [RemoteInspection] Fix handling of extensions in DemanglingForTypeRef
Typically, the first node of a nested type is the type that contains it.
For example:

```
Demangling for $s7ModBase5OuterV5InnerC
kind=Global
  kind=Class
    kind=Structure
      kind=Module, text="ModBase"
      kind=Identifier, text="Outer"
    kind=Identifier, text="Inner"
$s7ModBase5OuterV5InnerC ---> ModBase.Outer.Inner
```

However, when a type is declared inside an extension of "Outer", that
becomes part of the mangled name too. For example:

```
Demangling for $s7ModBase5OuterV6ModExtE5InnerC
kind=Global
  kind=Class
    kind=Extension
      kind=Module, text="ModExt"
      kind=Structure
        kind=Module, text="ModBase"
        kind=Identifier, text="Outer"
    kind=Identifier, text="Inner"
$s7ModBase5OuterV6ModExtE5InnerC ---> (extension in ModExt):ModBase.Outer.Inner
````

DemanglingForTypeRef did not treat the extension case correctly, and was
losing the extension information. This patch fixes it.

Assisted-by: claude

rdar://176586425
2026-05-13 11:06:13 -07:00
Mike Ash f6b456403c [Distributed] Fix leaks in failure paths of swift_getFunctionFullNameFromMangledName.
Fix several early returns which didn't free the string copy made earlier in the function. Fix most of them by doing the string copy only at the very end where it's needed. When we race to insert into the cache and we lose that race, then free the copies before returning the other thread's cached entry.

rdar://170736413
2026-05-13 09:56:09 -04:00
Konrad `ktoso` Malawski 689d85ffaa [Concurrency] New non-copyable Continuation type (#88182)
**Explanation**: 
Implementation of `Continuation` as proposed in upcoming SE proposal:
https://github.com/swiftlang/swift-evolution/pull/3246

This is a ~Copyable Continuation with much stronger safety guarantees
and no runtime overhead. Refer to proposal for details.

Initial work by @fabianfett.

**Scope**: Adds a new continuation type.

**Risk**: Low, adds new type, allows `~Copyable` into existing builtin
-- I believe this change should be safe (?)

**Testing**: Added lots of tests covering problems this aims to prevent.

**Issues**: 
resolves rdar://174826360
Somewhat relevant to rdar://139975911

Co-authored-by: Fabian Fett <fabianfett@apple.com>
2026-05-13 19:30:57 +09:00
Allan Shortlidge e4ee38446e Merge pull request #89050 from tshortli/warnings
stdlib/Runtimes: Address a few warnings
2026-05-13 00:38:33 -07:00
Guillaume Lessard 459a3208c4 Merge pull request #89063 from glessard/rdar139816157-se0525-followup
[stdlib] remove functions deferred from SE-0525
2026-05-12 20:20:06 -07:00
Doug Gregor e41f6dbc49 Merge pull request #89047 from DougGregor/embedded-alloc-dealloc-box
[Embedded] Centralize allocation size/alignment computation for boxes
2026-05-12 19:49:26 -07:00
Allan Shortlidge 794b905c31 Merge pull request #88890 from tshortli/stdlib-remove-superfluous-availability-checks
stdlib: Remove superfluous `StdlibDeploymentTarget 6.3` checks
2026-05-12 18:06:13 -07:00
Guillaume Lessard 7befc8ff8c [stdlib] remove functions deferred from SE-0525 2026-05-12 15:18:45 -07:00
Allan Shortlidge 5af46147ff stdlib/Runtimes: Address some _StringProcessing build warnings.
Allow _StringProcessing to use `@_silgen_name("swift_getTupleTypeMetadata")`
via `-enable-experimental-feature AllowRuntimeSymbolDeclarations`. Also, add
the missing `-DRESILIENT_LIBRARIES` flag to the Runtimes build for
_StringProcessing.
2026-05-12 15:11:45 -07:00
Guillaume Lessard 6e140559b8 [stdlib] rephrase some doc-comment notes with active voice 2026-05-12 13:56:51 -07:00
Guillaume Lessard eb8cea792c [stdlib] apply code fences to doc-comment code examples 2026-05-12 13:11:31 -07:00
Allan Shortlidge 400249a431 Merge pull request #89020 from tshortli/embedded-shims-warnings
Resolve warnings in EmbeddedShims.h
2026-05-12 11:53:07 -07:00
Allan Shortlidge da5ee4c315 Observation: Suppress a NoUsage warning.
Even though `trackingLists.remove(_:)` returns a discardable result,
`withCriticalRegion` forwards that return value as its own return value, which
the compiler then flags as unused.
2026-05-12 10:56:36 -07:00
Allan Shortlidge 0a8918c317 stdlib: Remove spurious unsafe in StringStorageBridge.swift.
Calling `withUnsafeTemporaryAllocation()` is not unsafe by itself - using the
pointer it provides is.
2026-05-12 10:56:36 -07:00
Doug Gregor d0957a8933 [Embedded] Centralize allocation size/alignment computation for boxes
swift_allocBox was correctly computing allocation size/alignment.
swift_deallocBox was compiting it differently (and incorrectly).
Factor out the logic into a separate function that we use from both
places.
2026-05-12 10:45:13 -07:00
Allan Shortlidge 27d605c584 stdlib: Remove superfluous SwiftStdlib 6.3 availability checks
Now that `SwiftStdlib 6.3` maps to real versions for Apple's operating systems
(https://github.com/swiftlang/swift/pull/87510), checks like

```
if #available(StdlibDeploymentTarget 6.3, *) { ... }
```

inside the implementation of the stdlib are no longer necessary to satisfy the
availability checker and instead cause warnings to be emitted.  Remove the now
superfluous checks.

This is a reattempt of https://github.com/swiftlang/swift/pull/87744. The
previous attempt was reverted because it turned out that there were some
configurations (outside of Swift CI) in which the stdlib was built with an
unnecessarily low deployment target. That has now been corrected, unblocking
this fix.
2026-05-12 08:34:31 -07:00
Alastair Houghton a512fc22ee Merge pull request #88488 from al45tair/eng/PR-171438432
[Windows][Backtracing] Don't use `DebugActiveProcess()`.
2026-05-12 11:41:07 +01:00
Karoy Lorentey 285fd54fde Merge pull request #88900 from lorentey/bump-swift-version
Bump Swift version to 6.5
2026-05-11 18:28:56 -07:00
Allan Shortlidge 9e9f28cf2c Resolve warnings in EmbeddedShims.h
This header has `#pragma clang assume_nonnull begin` which causes nullability
annotations to be inferred for most declarations. However, Clang does not infer
`_Nonnull` for function pointer declarations where the return type is also a
pointer so explicit annotations are needed for a few declarations.
2026-05-11 17:13:34 -07:00
Augusto Noronha fb537a0c98 Merge pull request #88981 from augusto2112/fix-existential-constrained-typeref-lowering-main
[RemoteInspection] Handle lowering existential constrained metatype
2026-05-11 10:36:34 -07:00
Mike Ash 31c4b0e216 Merge pull request #87715 from mikeash/swift-job-run-exception-block
[Concurrency] Block exception propagation through swift_job_run.
2026-05-11 13:21:01 -04:00
Alastair Houghton 4915138024 Merge pull request #88960 from al45tair/eng/PR-176547291
[Backtracing][Win32] Scan the global symbol stream and deduplicate.
2026-05-11 12:04:23 +01:00
Alejandro Alonso 66a1326cdb Merge pull request #88990 from Azoy/nonescapable-ref
[stdlib] Let `Ref` reference nonescapable types
2026-05-10 16:57:15 -07:00
David Smith 51b4c9b7d0 Don't attempt to create tagged pointer strings for >11 characters (#88810)
Fixes rdar://176209576
2026-05-09 20:25:21 -07:00
Alejandro Alonso f5561eaa4a Let Ref reference nonescapable types 2026-05-09 11:00:23 -07:00
David Smith ed3eec2cd1 Change String growth to resize by 1.625x instead of 2x (#88973)
Fixes rdar://59684914
2026-05-09 08:48:39 -07:00
Augusto Noronha cd4e937294 [RemoteInspection] Handle lowering existential constrained metatype
RemoteInspection was failing to produce type info for metatypes of
constrained existentials (any SomeType<ConstraintHere>.Type)

A constrained existential has the same layout as a regular protocol
composition, so we can use that instead.

rdar://176586637
2026-05-08 17:58:03 -07:00
Allan Shortlidge 9211f0aa46 stdlib: Remove superfluous unsafe markers.
Resolves warnings introduced by https://github.com/swiftlang/swift/pull/87271.
2026-05-08 16:14:04 -07:00
David Smith f08afd00c3 Vectorize UTF16->UTF8 transcoding (#83073)
Fixes rdar://141789595
2026-05-08 11:49:00 -07:00
Guillaume Lessard 590bef642b Merge pull request #88788 from glessard/wasi-expectCrash-skip
[StdlibUnittest] Skip crash testing based on test runner feature rather than platform
2026-05-08 09:18:11 -07:00
Alastair Houghton c27e93fc8e [Backtracing][Win32] Scan the global symbol stream and deduplicate.
While for Swift symbols, they always exist in the module streams, the
PDBs that Microsoft serves from its symbol servers don't work that
way, and contain symbols that don't show up in the module streams.

Thus we need to add function data for each of those.

That then creates a problem where the symbol is in both places, so we
need to de-duplicate as well.

rdar://176547291
2026-05-08 16:37:22 +01:00
Mike Ash 058b1ed822 [Concurrency] Block exception propagation through swift_job_run.
When an exception is thrown through swift_job_run, it leaves the Concurrency runtime in an inconsistent state, which can lead to misbehavior or crashes later on. It's very difficult to work out what the cause is when this happens. Since the program state is doomed once this happens, prevent exceptions from propagating through swift_job_run at all, and terminate immediately when throwing.

rdar://171909991
2026-05-08 10:16:29 -04:00
Guillaume Lessard cb85c226c0 [StdlibUnittest] rename .requireCapability to .require 2026-05-07 15:30:25 -07:00
Guillaume Lessard e67e32970f [stdlibUnitTest] test skipping based on test runner feature 2026-05-07 13:20:40 -07:00
Mike Ash 2bcfe0b092 [Reflection] Support inspection of InlineArray.
Report the array count as NumFields, and report the same info for each child since InlineArray is homogeneous.

rdar://176382725
2026-05-07 14:39:05 -04:00
Doug Gregor 5ac23be8fd Merge pull request #88862 from DougGregor/embedded-concurrency-minimized-dependencies
Minimize platform dependencies in the Embedded Swift Concurrency library
2026-05-07 10:37:32 -07:00
Guillaume Lessard e4db90b222 [stdlib] improve doc-comments for span and bytes properties 2026-05-07 10:29:01 -07:00
Allan Shortlidge 574ef23ce0 Merge pull request #88894 from tshortli/concurrency-warnings
Concurrency: Fix a few warnings in the Executor implementations
2026-05-07 09:43:16 -07:00
David Smith 5039cccf80 Add a cross-encoding version of strcmp, use it in bridged String equality, and expose it for Foundation's use (#87271)
There's a longstanding problem in implementing `-isEqualToString:`,
where if you don't know how to get fast access to the other NSString's
contents, you have to pick between doing it character by character (very
slow), or calling [other isEqualToString: self], which risks infinite
recursion if the other string does the same.

This cuts the gordian knot by adding a new method
`isEqualToBytes:encoding:count:`, so you can get the contents out of
`self`, and hand it to the other string, confident that it will not need
to (nor, in fact be able to) ask you anything that might recurse.
2026-05-07 02:10:44 -07:00
Karoy Lorentey da885c09e8 Bump Swift Compiler/Stdlib/Runtime version to 6.5 2026-05-06 16:21:38 -07:00
Allan Shortlidge 413092b3bd Concurrency: Fix a few warnings in the Executor implementations. 2026-05-06 14:03:51 -07:00
David Rönnqvist a4bcdb48c6 Merge pull request #88624 from d-ronnqvist/update-documentation-keyword-icons
[Documentation] Update custom icon for true/false keywords in the documentation navigation sidebar

rdar://174344255
2026-05-06 20:07:47 +02:00
Doug Gregor 41a16dd8b6 Eliminate abstract C++ methods from the Embedded Concurrency library
Use unreachable methods instead of abstract methods in the Embedded
concurrency library, so that the C++ compiler doesn't inject a
reference to __cxa_pure_virtual, which is in the C++ runtime.
2026-05-06 10:35:40 -07:00
Doug Gregor 5b2dbd6d56 Use swift_slowAlloc/swift_slowDealloc for task allocator slabs
Rather than always calling malloc/free, parameterize the StackAllocator
on the underlying global allocator. The default uses malloc/free, so
most uses of StackAllocator are unchanged by this refactoring.

In the embedded concurrency library, swap in an global allocator that
uses swift_slowAllloc/swift_slowDealloc instead, eliminating the
remaining malloc/free references so everything goes through the
platform abstraction layer. For now, don't change the non-embedded
concurrency library in the same manner.
2026-05-06 10:35:34 -07:00
Doug Gregor 834b2ace1d [Concurrency runtime] Use swift_slow(Alloc|Dealloc) instead of malloc/free
Memory allocation in Swift should always go through the common Swift
entrypoints rather than have calls directly into the C standard
library. This goes through the platform abstraction layer in Embedded
Swift, for platforms that may not have a C standard library.
2026-05-06 08:24:31 -07:00