Commit Graph

329 Commits

Author SHA1 Message Date
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
Alastair Houghton
079c1657ae [Backtracing] Fix the new build system for Windows.
We needed to add the `Runtime` module to the new build system, but
when I tried doing that, various things broke.

Firstly, we ended up with two targets with the name `swiftRuntime`,
but only in the static build (because in that build, everything
gets pulled in together, so CMake sees both of them).  Rename the
one that's part of `swiftCore` to `swiftRuntimeCore`.

Second, we need some extra paths for the `Cxx` module and its
submodules, and since those are part of the `INTERFACE`, we need
to make sure we `PUBLIC` link them into the `Cxx` module so that
they get passed through when building `swiftRuntime`.

rdar://101623384
2026-02-06 08:53:16 +00:00
Mike Ash
85d1ac02de [Runtime] Always look for the SwiftDirect package in the new Runtime build.
Remove the SwiftCore_ENABLE_DIRECT_RETAIN_RELEASE option and the corresponding option from the various subprojects. Instead, unconditionally find_package(SwiftSwiftDirectRuntime) but without REQUIRED. We expect that if the compiler is emitting DirectRuntime calls, the library will be available, so there's no need to configure that separately.

Also refine the check for HasSwiftSwiftDirectRuntimeLibrary to exclude DriverKit.
2026-02-03 13:07:37 -05:00
Joe Groff
af579e326f Add Borrow.cpp to the other runtime CMakeLists 2026-01-23 08:02:11 -08:00
Mike Ash
d0017555c7 [Runtime] Faster dynamic exclusivity checking implemented in Swift.
Replace C++ implementation of swift_beginAccess and swift_endAccess with (almost) pure Swift implementation. Helpers remain in C++ for TLS, getting return addresses, and raising a fatal error on violations.

This change also moves the exclusivity access set head from the shared SwiftTLSContext structure to a dedicated TLS key. This improves performance, which is important for exclusivity checking. This is particularly the case where we can inline TLS access with a constant key, as on Darwin ARM64.

The code that bridges exclusivity tracking into Concurrency remains in C++. The new Swift implementation exposes a few helpers for it to use as a replacement for directly manipulating the C++ implementation.

rdar://161122309
2026-01-14 12:23:55 -05:00
Eric Miotto
e6ce866cf4 Runtimes/Core: add Apple vendor cache for arm64 macOS
This is to support internal configurations that cannot target arm64.

Addresses rdar://167555197
2026-01-05 09:14:33 -08:00
Eric Miotto
d1f2dc1f7e Runtimes/Core: require Catalyst deployment target in Apple macOS caches
This alignes the behaviour with the other vendor caches.

Addresses rdar://160173706
2026-01-05 09:10:49 -08:00
Alejandro Alonso
536518bbb4 Merge pull request #86276 from Azoy/unsafe-shall-be-errored
[stdlib] Make strict memory safety an error in the stdlib
2026-01-04 15:40:41 -08:00
Alejandro Alonso
2e46df25a5 Make strict memory safety an error in the stdlib 2026-01-03 11:39:27 -08:00
Alejandro Alonso
ee6c1a8ce2 Add UnicodeEmoji to Runtimes cmake 2026-01-02 21:32:03 -08:00
Tim Kientzle
93eb82c9a3 [Embedded] Reimplement Float16/32/64 parsing in Swift
This reimplements the underlying support for `Float16(_:StringSlice)`,
`Float32(_:StringSlice)`, and `Float64(_:StringSlice)` in pure Swift,
using the same core algorithm currently used by Apple's libc.  Those
`StringSlice` initializers are in turn used by `Float16(_:String)`,
`Float32(_:String)`, and `Float64(_:String)`.

**Supports Embedded**: This fully supports Embedded Swift and
insulates us from variations in libc implementations.

**Corrects bugs in Float16 parsing**: The previous version of
`Float16` parsing called libc `strtof()` to parse to a 32-bit float,
then rounded to `Float16`. (This was necessary because float16
parsing functions are not widely supported in C implementations.)
This double-rounding systematically corrupted NaN payloads and
resulted in 1 ULP errors for certain decimal and hexadecimal inputs.
The new version parses `Float16` directly, avoiding these errors.

**Modest perforamnce improvement**:  The old version had to copy
the Swift string to construct a C string.  For inputs longer than
15 characters, this typically required a heap allocation, which added
up to 20% to the runtime.  The new version parses directly from a Swift
string, avoiding this copy and heap allocation.
2025-12-06 09:04:12 +00:00
Evan Wilde
4ad6bea8c2 Merge pull request #85825 from etcwilde/ewilde/concurrency-tracing
Concurrency Runtime: Enable tracing with `SWIFT_STDLIB_TRACING`
2025-12-04 08:17:22 -08:00
Evan Wilde
c1efd8f9d2 Concurrency: Use SWIFT_STDLIB_TRACING
Switching the concurrency runtime to use the common SWIFT_STDLIB_TRACING
to control whether the concurrency runtime enables tracing. The old
process required passing bot the `SWIFT_STDLIB_TRACING` and
`SWIFT_STDLIB_CONCURRENCY_TRACING` macro to the concurrency build or it
would fail to build.

It's not clear that there are any environments where it is desirable
for swiftCore to have tracing enabled and not have swift_Concurrency
tracing enabled or vice versa. Replacing the concurrency-specific macro
with a single common macro. If it is desirable, we can teach the build
system to avoid passing `SWIFT_STDLIB_TRACING` to a specific target if
an option is not set.

rdar://165777240
2025-12-03 14:02:40 -08:00
Doug Gregor
3c933a1f73 Move Unicode Data declarations from SwiftShims to @_extern(c)
This eliminates UnicodeData.h from the public SwiftShims. A small
part of it remains as a private header, but everything else moves
into `@_extern(c)`.
2025-12-02 15:11:53 -08:00
Evan Wilde
3aa8b76a00 Merge pull request #85616 from etcwilde/ewilde/stdlib-tracing
CMake: Runtimes: Enable tracing on Apple OSs
2025-11-20 17:19:26 -08:00
Evan Wilde
20cfe0a4e0 CMake: Verify os_signpost_*/os_log with tracing
Adding check to CMake to verify that we have the os_signpost and os_log
API available in order to accept enabling the runtime tracing.
2025-11-20 08:34:39 -08:00
Evan Wilde
01eb3990be CMake: Runtime: Enable tracing on Apple platforms
Adding tracing to concurrency, and enable tracing on the standard
library on Apple OSs.

rdar://164925172
2025-11-20 08:34:23 -08:00
Saleem Abdulrasool
f4a60df6ea build: explicitly error out if -print-target-info fails
Rather than trying to silently continue, catch an execution error and
report it to the user. There is no possible recovery at this point.
2025-11-18 10:01:39 -08:00
Eric Miotto
57908cd4e7 Runtimes: allow to link SwiftDirectRetainRelease in swiftCore
At the moment we are not building that natively in the new build system,
so find the copy built by the legacy one using a find module.

Keep this disabled for the time being.

Addresses rdar://164174616
2025-11-14 07:01:27 -08:00
Eric Miotto
9e85aa7fd2 Runtimes: rename Core/core to Core/Core (uppercase C) so it appears...
higher in case sensitive directory listings (like GitHub).

This will ease checking for stdlib code on small screens without needing
to scroll.

Addresses rdar://164195263
2025-11-06 14:26:21 -08:00
Eric Miotto
30cd1ada78 Runtimes: pass target variant flags when compiling assembly code
This ensure we build code correctly for macCatalyst.

Addresses rdar://163363796
2025-10-24 14:04:56 -07:00
Evan Wilde
a2dcc719aa Merge pull request #84737 from etcwilde/ewilde/runtimes-linux-glibc-overlay
CMake: Glibc Overlay
2025-10-21 14:21:25 -07:00
Tim Kientzle
41f680cb93 Merge pull request #84826 from tbkka/tbkka-revert-revert-floatingpointdescription
Re-land new Floating-poing `debugDescription`
2025-10-12 20:19:12 -07:00
Tim Kientzle
b69d5fe40c Add Internal version of InlineArray with no availability limitations 2025-10-10 14:04:16 -07:00
Saleem Abdulrasool
6a1ff42a80 Merge pull request #84781 from compnerd/pretty-special
Runtime: disable prespecialisation on Windows
2025-10-09 10:21:30 -07:00
Evan Wilde
5088eb5927 Merge pull request #84741 from etcwilde/ewilde/runtimes-fix-cleanups
NFC: CMake: Runtime build housekeeping
2025-10-08 21:29:21 -07:00
Saleem Abdulrasool
bb18e02590 Runtime: disable prespecialisation on Windows
This causes crashes at runtime (see swiftlang/swift#84780).
2025-10-08 18:41:20 -07:00
Evan Wilde
989b3bea01 NFC: Clean up runtime comments
Updating the todo list comments.

 - Windows builds are already using the runtime build system to build
   the runtimes so we can remove that from the todo list.

 - The Android SDK on Windows is currently cross-compiled with the new
   runtime build.

 - Catalyst builds have been going for a bit now, generating the
   necessary bits.

 - We moved things to a nested swiftmodule structure, which installs the
   entire directory, containing all of the emitted products.

The Glibc Linux builds should be coming soon.
We still have embedded to work on.
2025-10-07 15:16:17 -07:00
Evan Wilde
0f3f3e5a59 NFC: Cleanup full module directory
Adding the additional driver outputs in the cleanup files. This cleans
up the warnings from `ninja clean`.

```
Cleaning... ninja: error: remove(clang/_Builtin_float.swiftmodule): Directory not empty
```
2025-10-07 11:18:46 -07:00
Evan Wilde
beac5fa1e1 NFC: Cleanup module directory name
This is a small refactor to rename the build module directory,
"${CMAKE_CURRENT_BINARY_DIR}/${module_name}.swiftmodule" to
"${module_directory}" to make it more concise.
2025-10-07 11:10:06 -07:00
Tim Kientzle
f0679b363e Re-apply PR #82750: Reimplement floating-point description implementation in Swift.
This reverts PR #84576, which was a revert of PR #82750
It reverts commit 4ac18aa32e, reversing
changes made to b46eddbabd.
2025-10-07 07:11:57 -07:00
Evan Wilde
a53b2787ac CMake: Check platform availability on Apple
Platform availability is an Apple concept because Swift is shipped as
part of the OS. It doesn't make sense to check or to warn on other
platforms. Only checking and setting it for Apple platforms.
2025-10-06 22:12:33 -07:00
Tim Kientzle
7d85d75f78 Revert "Merge pull request #82750 from tbkka/tbkka-swift-floatingpointtostring"
This reverts commit 54627fb49b, reversing
changes made to dda4608a84.
2025-09-29 15:13:19 -07:00
Tim Kientzle
54627fb49b Merge pull request #82750 from tbkka/tbkka-swift-floatingpointtostring
Reimplement floating-point description implementation in Swift.
2025-09-29 07:55:25 -07:00
eeckstein
a1e5a06c9e Merge pull request #84530 from eeckstein/remove-enable-oss-module-option
Remove the `-enable-ossa-modules` option
2025-09-27 07:35:40 +02:00
Evan Wilde
39941a79d1 Merge pull request #84525 from etcwilde/ewilde/set-language-versions
CMake: Set language version across supplemental libs
2025-09-26 18:45:31 -07:00
Saleem Abdulrasool
31619c85f3 Runtimes: ensure that all symbols are fully resolved on Android
This ensures that the libraries are properly linked and that we do not
have any unresolved symbols in the runtime (which are not satisfied by
its module dependencies).
2025-09-26 08:47:12 -07:00
Erik Eckstein
2f124cf564 Remove the -enable-ossa-modules option.
OSSA modules are enabled by default.
The compiler still accepts this option but it has no effect.
2025-09-26 08:01:08 +02:00
Evan Wilde
a0538ae7cb Revert "CMake: Runtimes: Specify language mode explicitly."
Reverting since we can use `CMAKE_Swift_LANGUAGE_VERSION` instead.

This reverts commit 6cc9a7d509.
2025-09-25 19:15:19 -07:00
Saleem Abdulrasool
f05195cfe7 Core: add missing link against log on Android
The standard library and Concurrency depend on liblog from the NDK. Add
the missing dependency to fully resolve symbols.
2025-09-25 12:05:56 -07:00
Tim Kientzle
e1b9d65aa5 Add FP-to-string support to core library 2025-09-22 12:40:10 -07:00
Tim Kientzle
875297bc24 Remove old C implementation 2025-09-22 12:40:10 -07:00
Allan Shortlidge
6cc9a7d509 CMake: Runtimes: Specify language mode explicitly.
The compiler will soon require that any module with a `.swiftinterface` be
built with an explicit language mode specified on the command line. This
prevents misinterpretation of the `.swiftinterface` when building it for
clients that aren't building with the default language mode.

Add explicit `-swift-version` arguments to the builds of various Runtimes
libraries to comply with this new requirement.
2025-09-15 20:52:15 -07:00
Eric Miotto
c31e3b397b Runtimes: add support to emit variant modules
This leverages the SwiftDriver flag added in
https://github.com/swiftlang/swift-driver/pull/1941

Leave this disabled by default, so we can stage its adoption in Apple
vendor  configurations.

Addresses rdar://158895783
2025-09-12 06:31:31 -07:00
Saleem Abdulrasool
b06eed151c Merge pull request #84124 from compnerd/mirroring
SwiftRemoteMirror: export symbols from the library on Windows
2025-09-05 17:28:57 -07:00
Saleem Abdulrasool
e7992a6b6b SwiftRemoteMirror: export symbols from the library on Windows
When building a shared library on Windows, ensure that we export the
symbols. We would previously export none of the interfaces making the
dynamic library unusable. Simplify the macros as
`swiftRemoteMirror_EXPORTS` would only be defined when building a shared
library.
2025-09-05 08:19:20 -07:00
Evan Wilde
0bebd9d190 CMake: Runtime: Extract runtime version number
This extracts the version number computation out into a separate module
to be shared between the runtimes.
Setting `SWIFT_RUNTIME_VERSION` allows external build orchestration
tools to override the version number specified in source if necessary,
while centralizing the location of the default version number across the
runtime libraries.
2025-09-04 12:27:11 -07:00
Mishal Shah
c75932b89f Merge pull request #83748 from swiftlang/bump-version-6.3
Bump the Swift version to 6.3
2025-09-03 21:18:05 -07:00
Saleem Abdulrasool
185ff12154 Merge pull request #83956 from compnerd/strength
Runtimes: ensure that we strongly resolve all symbols on Linux
2025-08-29 10:52:39 -07:00
Justice Adams
ff3fdd32ee [cmake] Use correct identifier for CFBundleIdentifier (#83960)
Use the associated library name for the `CFBundleIdentifier` within the
plist. This will prevent cases where we have projects with multiple
targets referencing the project name itself (i.e swiftSwiftOnoneSupport
had it's bundle name set to SwiftCore)
2025-08-29 10:28:21 -07:00