Commit Graph

17851 Commits

Author SHA1 Message Date
Eric Miotto
2c5fdec56a Merge pull request #83725 from edymtt/edymtt/use-darwin-os-lock-in-observation
Observation: do not import all of Darwin to implement locking facilities
2025-08-14 17:00:31 -07:00
Guillaume Lessard
709156b215 Merge pull request #83686 from glessard/legacy-abi-rethrows
[stdlib] apply the legacy ABI pattern to 3 functions
2025-08-14 15:53:17 -07:00
Egor Zhdan
7dc8873266 [cxx-interop] Simplify std::string construction in the overlay
libc++ provides a 2-parameter constructor of `std::string`, so we can apply the logic under `#if os(Windows)` on Apple platforms too.

This avoids deserialization issues when building some complex projects that are still under investigation.

rdar://145939013
2025-08-14 17:45:19 +01:00
Eric Miotto
eab65319f9 Distributed: do not import all of Darwin to implement locking facilities
At the same time, drop that dependency in the new build system, so that
we don't add an additional linkage for Darwin platforms compared to what
we are doing in the current build system.

Addresses rdar://158314427
2025-08-14 08:51:36 -07:00
Eric Miotto
4da993f368 Observation: do not import all of Darwin to implement locking facilities
At the same time, drop that dependency in the new build system, so that
we don't add an additional linkage for Darwin platforms compared to what
we are doing in the current build system.

Addresses rdar://158313871
2025-08-14 08:35:06 -07:00
Gábor Horváth
8558931bd0 Merge pull request #83638 from Xazax-hun/swift-span-for-cxx-string 2025-08-14 07:42:57 +01:00
Anthony Latsis
8b27282324 Merge pull request #83675 from swiftlang/jepa-rebranch2
runtime: Silence a `-Wglobal-constructors` error than appears with upstream clang on Windows
2025-08-14 00:04:21 +01:00
Saleem Abdulrasool
162df1d5f4 Merge pull request #83643 from compnerd/mirror-warnings
SwiftRemoteMirror: adjust for Windows
2025-08-13 13:34:12 -07:00
Gabor Horvath
2bd8684868 [cxx-interop] Add span accessors to std.string variants
rdar://146944876
2025-08-13 15:49:39 +01:00
Anthony Latsis
311ff73a7f runtime: Silence a -Wglobal-constructors error than appears with upstream clang on Windows
Landing this on main to minimize rebranch-specific changes.
2025-08-13 00:32:23 +01:00
Guillaume Lessard
d1f7140357 [stdlib] apply the legacy ABI pattern to 3 functions 2025-08-12 16:15:13 -07:00
Erik Eckstein
e28125b106 stdlib: specialize OptionSet.insert for FixedWidthInteger raw-values
This lets the generated code boil down to a single or-instruction.

rdar://157958188
2025-08-12 08:05:49 +02:00
Hiroshi Kimura
db7717f411 Update Observations.swift 2025-08-12 06:15:56 +09:00
Karoy Lorentey
14b9b80746 Merge pull request #83314 from lorentey/pushing-word-boundaries
[stdlib] Fix implementation of Unicode text segmentation for word boundaries
2025-08-11 11:28:39 -07:00
Saleem Abdulrasool
d5412665e0 SwiftRemoteMirror: adjust for Windows
This cleans up the warnings when building on Windows. It is cleaning up
the warnings related to deprecated POSIX APIs.
2025-08-11 09:50:23 -07:00
Alex Martini
4b292b30f2 Merge pull request #83049 from amartini51/object_id_149961845
Update docs for ObjectIdentifier to mention actors

Fixes: rdar://149961845
2025-08-08 11:54:29 -07:00
Gábor Horváth
35b5c817b2 Merge pull request #83520 from Xazax-hun/check-safety-function-types 2025-08-08 06:39:39 +01:00
Karoy Lorentey
3e18a07187 [stdlib] Fix implementation of Unicode text segmentation for word boundaries
Carefully overhaul our word breaking implementation to follow the recommendations of Unicode Annex #29. Start exposing the core primitives (as well as `String`-level interfaces), so that folks can prototype proper API for these concepts.

- Fix `_wordIndex(after:)` to always advance forward. It now requires its input index to be on a word boundary. Remove the `@_spi` attribute, exposing it as a (hidden, but) public entry point.
- The old SPIs `_wordIndex(before:)` and `_nearestWordIndex(atOrBelow:)` were irredemably broken; follow the Unicode recommendation for implementing random-access text segmentation and replace them both with a new public `_wordIndex(somewhereAtOrBefore:)` entry pont.
- Expose handcrafted low-level state machines for detecting word boundaries (_WordRecognizer`, `_RandomAccessWordRecognizer`), following the design of `_CharacterRecognizer`.
- Add tests to reliably validate that the two state machine flavors always produce consistent results.

rdar://155482680
2025-08-05 20:04:46 -07:00
fahadnayyar
9a01358132 [C++ Interop] Deprecate Optional argument overloads of std.string initializer in Swift’s C++ Stdlib Overlay (#83223)
This patch addresses potential ambiguity and unsafe behavior by
deprecating initializer overloads for `std.string` that accept optional
arguments (`string?`). These overloads previously allowed implicit
initialization from optional pointers (`UnsafePointer<CChar>?`), causing
unclear or unintended behavior.

- Deprecated: `init(_ string: UnsafePointer<CChar>?)`, guiding users
toward the explicit, non-optional initializer.
- Unavailable: `init(_ string: String?)`, explicitly preventing misuse
from optional Swift strings.

rdar://148041893
2025-08-05 15:22:02 -07:00
Adrian Prantl
52fa6a1ceb Merge pull request #82389 from adrian-prantl/153934495
Implement reflection support for Symbolic Extended Existential types.
2025-08-05 09:42:19 -07:00
Gabor Horvath
402ad33463 [StrictMemorySafety] Check the safety of return types of calls
Previously, we skipped checking the return type of a function for safety
as we expected to warn at the use of the returned value:

  let x = returnsUnsafe()
  usesUnsafe(x) // warn here

Unfortunately, this resulted in missing some unsafe constructs that can
introduce memory safety issues when the use of the return value had a
different shape resulting in false negatives for cases like:

  return returnsUnsafe()

or

  usesUnsafe(returnsUnsafe())

This PR changes the analysis to always take return types of function
calls into account.

rdar://157237301
2025-08-05 12:16:44 +01:00
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
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
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
Max Desiatov
78c85945f6 Actor.cpp: Fix unused variables for non-embedded path 2025-07-31 21:16:40 +01: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
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