Commit Graph

21821 Commits

Author SHA1 Message Date
David Smith
051d0b68aa Override -_fastUTF8StringContents:utf8Length: to give bridged Strings O(1) access to their UTF8 contents (#83499)
Fixes rdar://157337605
2025-08-04 12:41:51 -07:00
Adrian Prantl
eabcf41a54 Implement reflection support for Symbolic Extended Existential types.
This patch adds a new SymbolicExtendedExistentialTypeRef kind, and
wires it up in TypeDecoder, TypeRefBuilder, TypeLowering, and
ASTDemangler.

This is tested indirectly via the matching LLDB commit.
2025-08-04 08:36:37 -07:00
Alastair Houghton
94058e5e68 [Concurrency] Fix availability problem with UnownedTaskExecutor.
a550080 added a call to the new initializer, but that call
came from a function annotated with `StdlibDeploymentTarget 6.2`,
rather than `SwiftStdlib 6.2`, while the initializer was set to
`SwiftStdlib 6.2`.  This will fail in some build configurations
(specifically where the target being built for is older than that
implied by `SwiftStdlib 6.2`).

rdar://157217460
2025-08-04 14:30:20 +01:00
Alastair Houghton
de3e54a79d Merge pull request #83398 from al45tair/eng/PR-155841439
[Build] Fix deployment version handling for StdlibDeploymentTarget.
2025-08-04 10:54:17 +01:00
eeckstein
8335ce577f Merge pull request #83474 from eeckstein/fix-address-of-property-feature
rename the feature AddressOfProperty to AddressOfProperty2
2025-08-01 17:38:19 +02:00
Ben Rimmington
b57b8368ac [stdlib] Update UTF8Span documentation (#83418)
Amend formatting of `Substring.utf8Span` example code.
Use DocC tables in `Unicode.UTF8.ValidationError` overview.

---------

Co-authored-by: Alex Martini <amartini@apple.com>
2025-08-01 06:56:19 -07:00
Alastair Houghton
857539f3c5 [Build] Fix minimal stdlib build.
We need the new `deployment_version` function to handle the `FREESTANDING`
SDK also.

rdar://155841439
2025-08-01 14:37:34 +01:00
Alastair Houghton
27b1a7d8ee [Build] Fix deployment version handling for StdlibDeploymentTarget.
Where someone has told a target library to build for a _newer_ target
than the current deployment target, we need to respect that newer
target when setting StdlibDeploymentTarget for that target library.

This trips us up when testing against older systems.

rdar://155841439
2025-08-01 12:49:23 +01:00
Max Desiatov
d63bbb9d0c Merge pull request #83456 from MaxDesiatov/enqueue-existential
Embedded WASI: fix some concurrency tests

The test was crashing due to `swift_unreachable("custom executors not supported in embedded Swift")` line in `swift_task_enqueueImpl`, as the corresponding non-embedded codepath was relying on an unspecialized generic function `_swift_task_enqueueOnExecutor` defined in `Executor.swift`. Unspecialized generics are unavailable in Embedded Swift, and such `@silgen_name` function can't be specialized when used from concurrency runtime code written in C/C++. We can redefine this function for Embedded Swift using a class-bound existential instead, and re-enable this codepath with a slightly different call that avoids the use of unavailable `swift_getObjectType` function from the non-embedded runtime.

rdar://156996468
2025-08-01 12:33:51 +01:00
Erik Eckstein
ec8dcc98ad rename the feature AddressOfProperty to AddressOfProperty2
Fixes a build problem when using a mainline compiler with a 6.2 Swift.swiftinterface file.
This was caused by mistakenly cherry-picking the `#if $AddressOfProperty` conditions in the stdlib into 6.2 without the required compiler change.
2025-08-01 08:00:51 +02:00
Allan Shortlidge
fd4df735de Merge pull request #83406 from tshortli/rebaseline-features
AST/ModuleInterface: Re-baseline features
2025-07-31 17:01:17 -07:00
Konrad `ktoso` Malawski
d8cfe92465 Merge pull request #83468 from edymtt/edymtt/no-sized-deallocation-for-compatibility-archives 2025-08-01 06:25:37 +09:00
Max Desiatov
78c85945f6 Actor.cpp: Fix unused variables for non-embedded path 2025-07-31 21:16:40 +01:00
Eric Miotto
988531cc3b CMake: ensure we can build compatibility libraries with macOS 14.0 SDK
In particular, fix the Apple Silicon benchmark job by do not
propagating the flag added in #83399.

Addresses rdar://157188603
2025-07-31 13:12:54 -07:00
Allan Shortlidge
71a5d9bd74 AST: Re-baseline ValueGenericsNameLookup feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
6dd3e49954 AST: Re-baseline BuiltinEmplaceTypedThrows feature. 2025-07-31 10:21:55 -07:00
Alejandro Alonso
e3d381b557 Merge pull request #83397 from Azoy/atomic-addressofrawlayout
[stdlib] Change the builtin used to get the address for Atomic
2025-07-31 09:47:07 -07:00
Max Desiatov
7ec0837778 Embedded WASI: fix concurrency-deleted-method.swift test
The test was crashing due to `swift_unreachable("custom executors not supported in embedded Swift")` line in `swift_task_enqueueImpl`, as the corresponding non-embedded codepath was relying on an unspecialized generic function `_swift_task_enqueueOnExecutor` defined in `Executor.swift`. Unspecialized generics are unavailable in Embedded Swift, and such `@silgen_name` function can't be specialized when used from concurrency runtime code written in C/C++. We can redefine this function for Embedded Swift as using a class-bound existential instead, and re-enable this codepath with a slightly different call that avoids the use of unavailable `swift_getObjectType` function from the non-embedded runtime.
2025-07-31 16:00:40 +01:00
Jonathan Grynspan
3195c28b8d Add WinSDK.GDIPlus Clang module. (#83425) 2025-07-31 07:08:51 -07:00
Alastair Houghton
796da7aa08 Merge pull request #83327 from al45tair/eng/PR-156701386
[Concurrency] Fix task switch performance issue.
2025-07-31 12:31:09 +01:00
Allan Shortlidge
04852d0a61 Merge pull request #83437 from tshortli/const-has-no-effect
stdlib: Fix warning about superfluous 'const' on return type
2025-07-30 23:29:14 -07:00
Allan Shortlidge
c82b9ed5ae stdlib: Fix warning about superfluous 'const' on return type.
Resolves the following warnings:

```
stdlib/public/SwiftShims/swift/shims/CoreFoundationShims.h:86:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
   86 | const _swift_shims_NSUInteger
      | ^~~~~
stdlib/public/stubs/FoundationHelpers.mm:110:1: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
  110 | const _swift_shims_NSUInteger
      | ^~~~~
```
2025-07-30 12:45:46 -07:00
Guillaume Lessard
f0b454559e Merge pull request #83416 from glessard/also-available-now 2025-07-30 11:48:19 -07:00
Alastair Houghton
a55008066d [Concurrency] Further improve performance.
Remove some reference counting traffic by using `Unowned*Executor`s.

Also, add a test to make sure we stay on the fast path.

rdar://156701386
2025-07-30 13:41:04 +01:00
Guillaume Lessard
f6a7c61245 [stdlib] fix availability of Span.bytes 2025-07-29 17:19:34 -07:00
Egor Zhdan
0266913348 Merge pull request #83395 from egorzhdan/egorzhdan/stl-xsmf-control
[cxx-interop] Modularize xsmf_control on Windows
2025-07-29 21:57:15 +01:00
Alejandro Alonso
19b8bed884 Change the builtin used to get the address for Atomic 2025-07-29 09:33:44 -07:00
Marc Prud'hommeaux
663ec9340d 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-07-29 20:42:22 +05:30
Egor Zhdan
a818de1588 [cxx-interop] Modularize xsmf_control on Windows
This adds `xsmf_control.h` into the STL modulemap on Windows.

Fixes the following compiler error emitted by Clang when trying to use `std::variant` from Swift with C++ interop:
```
...\MSVC\14.42.34433\include\variant:923:25: error: missing '#include <xsmf_control.h>'; '_Non_trivial_move_assign' must be defined before it is used
```
2025-07-29 14:30:34 +01:00
Alastair Houghton
2b4082e4f9 [Concurrency] Fix task switch performance issue.
When using the new custom default executors, sometimes we end up
taking a long time to do a task switch.  This is happening because
the path the new code takes sometimes results in a concrete pointer
to the default global executor being in the executor tracking
information in `swift_task_switch()`, and if we try to switch to
a `nil` task executor (which _also_ means the default global executor),
we aren’t spotting that and we’re taking the slow path.

Essentially, we want to take the fast path in cases where we switch
from `nil` to the concrete default global executor and vice-versa.

rdar://156701386
2025-07-28 15:49:46 +01:00
Alastair Houghton
d0cf535664 Merge pull request #83330 from al45tair/eng/PR-156710569
[Concurrency] Update availability of UnimplementedExecutor.
2025-07-28 12:42:12 +01:00
Pavel Yaskevich
da1f8b2f29 Merge pull request #83342 from xedin/remove-startSynchronously
[Concurrency] Remove deprecated `Task.startSynchronously` API
2025-07-26 09:03:41 -07:00
David Smith
cee927e2d5 Fix lengthOfBytes(using:) semantics (#83334)
Fixes rdar://156675395
2025-07-25 16:29:45 -07:00
Guillaume Lessard
bf80c2f90f Merge pull request #83160 from glessard/typedThrows-array-init
[stdlib] Generalize `Array(unsafeUninitializedCapacity:initializingWith:)` for typed throws
2025-07-25 14:54:45 -07:00
Pavel Yaskevich
95d4ef5756 [Concurrency] Remove deprecated Task.startSynchronously API
This is the original spelling which was not accepted. We kept
it for a bit to give adopters time to switch but it's time to
remove it now.
2025-07-25 13:15:02 -07:00
Guillaume Lessard
8b0bde8eb0 [SwiftOnoneSupport] information about the list of symbols 2025-07-25 09:29:25 -07:00
Guillaume Lessard
3a963a6957 [stdlib] generalize Array(unsafeUninitializedCapacity:initializingWith:) 2025-07-25 09:29:19 -07:00
Alastair Houghton
f27e20a3e7 [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 17:02:48 +01:00
Slava Pestov
ca50986f3a Merge pull request #83308 from slavapestov/fix-rdar156095800
Embedded Swift: Fix === and !== with existential
2025-07-25 08:41:38 -04:00
David Smith
a5e6b8556a Make sure SwiftObject doesn't crash when compared to tagged pointers (#83269)
Fixes rdar://152912840
2025-07-24 17:31:01 -07:00
Slava Pestov
b7766b6361 stdlib: Use the original === and !== operators on embedded
It seems that the restriction preventing these from working was
lifted.

The behavioral difference is that in Swift 5 mode, we don't
actually open AnyObject like this, so the old operator could
not be used with class-bound existentials.

I added a trivial test case just to ensure that calls to ===
type check correctly in both language modes.

Fixes rdar://156095800.
2025-07-24 15:25:30 -04:00
Max Desiatov
31e92db5b2 Executor.swift: only enable MainActor in Embedded Swift for WASI 2025-07-24 16:03:06 +01:00
Max Desiatov
5c5358b5df Enable more MainActor code paths for Embedded Swift 2025-07-24 14:58:21 +01:00
Justice Adams
d454771ee2 [CMAKE] Fix layering issue between Concurrency and Darwin overlay (#82973)
Concurrency from the Core project is importing the Darwin platform
overlay, which in turn depends on SwiftCore from the Core project,
breaking the project layering.

Concurrency only needs the Clang module, but Swift does not have a
mechanism to only import a clang module. For now import the
functionality needed from Darwin by importing and wrapping the
associated functions from `<dlfcn.h>` within `CFExecutor.cpp`

Also remove Darwin import from `AsyncStreamBuffer.swift` because it is
not used
2025-07-23 16:04:14 -07:00
Meghana Gupta
83399f93e0 Merge pull request #83111 from meg-gupta/lifediag
Diagnose @_lifetime on targets that are Escapable
2025-07-22 22:54:35 -07:00
eeckstein
18b02a7c70 Merge pull request #83172 from eeckstein/span-bounds-checking
Improve Span bounds check elimination by adding `_assumeNonNegative` to `count`
2025-07-22 22:00:43 +02:00
Alejandro Alonso
12a4415f28 Merge pull request #82392 from 3405691582/openbsd_mutex_pthread
Use libpthread primitives for OpenBSD mutexes.
2025-07-22 12:48:11 -07:00
Meghana Gupta
222ee7389a Diagnose @_lifetime on targets that are Escapable
Lifetime dependencies can be attached to ~Escapable types only
2025-07-22 06:00:38 -07:00
Max Desiatov
7ada71b7a5 Merge pull request #82331 from swiftlang/maxd/embedded-wasm-concurrency
Enable `MainActor` in embedded concurrency, add `ExecutorImpl.cpp`

`ExecutorImpl.cpp` should be moved from `SWIFT_RUNTIME_CONCURRENCY_NONEMBEDDED_C_SOURCES` to `SWIFT_RUNTIME_CONCURRENCY_C_SOURCES`. This way we can also include `ExecutorImpl.swift` and use `PlatformExecutorCooperative.swift` in embedded concurrency for WASI.
2025-07-22 12:52:38 +01:00
Erik Eckstein
b540204a64 stdlib: specify the count of Span and MutableSpan as _assumeNonNegative 2025-07-22 12:24:58 +02:00