Commit Graph

21602 Commits

Author SHA1 Message Date
eeckstein
66e07f04ac Merge pull request #81441 from eeckstein/vector_base_addr
SIL: introduce the `vector_base_addr` instruction and use it in `InlineArray`
2025-05-13 06:52:42 +02:00
Alejandro Alonso
9e24563bb7 Merge pull request #81365 from Azoy/my-existentials
[AST & Runtime] Correctly mangle extended existentials with inverse requirements
2025-05-12 13:21:07 -07:00
Alastair Houghton
485b8f6888 Merge pull request #81446 from al45tair/eng/PR-150531873
[Concurrency] Remove deprecation attribute for now.
2025-05-12 20:02:03 +01:00
Erik Eckstein
e3f25d710d stdlib: make InlineArray work with the new vector_base_addr instruction
Don't unsafe-cast from the InlineArray struct itself, but from `_storage` which is the actual array buffer.
This also requires making `_storage` a var.
2025-05-12 19:25:12 +02:00
Egor Zhdan
ede6e468e0 Merge pull request #81408 from swiftlang/egorzhdan/do-not-install-swiftmodules
[cxx-interop] Do not install binary `.swiftmodule` files for the overlays
2025-05-12 17:29:52 +01:00
Pavel Yaskevich
3854e61c49 Merge pull request #81428 from xedin/rename-some-task-apis
[stdlib] SE-0472: Rename `Task` and`*TaskGroup` APIs to match the pro…
2025-05-12 09:13:11 -07:00
Alastair Houghton
c6d1969afc [Concurrency] Remove deprecation attribute for now.
This deprecation attribute is possibly a little premature.

rdar://150531873
2025-05-12 15:35:45 +01:00
Alastair Houghton
28f96e64ab [Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
If you use SwiftStdlibCurrentOS availability, you will be able to
use new types and functions from within the implementation. This
works by, when appropriate, building with the CurrentOS availability
set to the current deployment target.

rdar://150944675
2025-05-12 12:07:24 +01:00
Egor Zhdan
16b280862a [cxx-interop] Do not install binary .swiftmodule files for the overlays
This fixes a deserialization failure in the compiler that occurred while loading the CxxStdlib overlay module:
```
Cross-reference to module 'Swift'
... Optional
... some
... with type <τ_0_0 where τ_0_0 : ~Copyable, τ_0_0 : ~Escapable> (Optional<τ_0_0>.Type) -> (τ_0_0) -> Optional<τ_0_0>
```

This was happening because the overlays were built against a different version of the Swift stdlib than is being used. The compiler is able to rebuild the Cxx and CxxStdlib modules from their textual interfaces. Let's use that feature unconditionally in production toolchains to avoid this kind of binary incompatibilities.

rdar://150416863
2025-05-10 22:55:06 +01:00
Pavel Yaskevich
99d810aa7d [stdlib] Temporarily bring back Task.startSynchronously as deprecated 2025-05-09 23:59:36 -07:00
Pavel Yaskevich
001eab867d [stdlib] SE-0472: Rename Task and*TaskGroup APIs to match the proposal
`Task.startSynchronously` -> `Task.immediate`
`*TaskGroup.startTaskSynchronously{UnlessCancelled}` -> `*TaskGroup.addImmediateTask{UnlessCancelled}`
2025-05-09 23:59:30 -07:00
Slava Pestov
10ca7f6614 Merge pull request #81299 from slavapestov/remote-mirrors-meet-packs
RemoteInspection: Support for parameter packs
2025-05-09 22:28:31 -04:00
Slava Pestov
70b413dc56 RemoteInspection: Support for parameter packs 2025-05-09 14:49:37 -04:00
Evan Wilde
1a546a9ccb [FreeBSD]: Optional observation pthread primitives
The pthread APIs on FreeBSD do not include nullability APIs so the
pthread mutex APIs are imported as pointers to optional values.
Other platforms include nullability APIs and import the pthread APIs as
pointers to the mutex. Splitting the locking primitive type based on the
OS.

Fixes: rdar://150880976
2025-05-09 10:08:35 -07:00
Daniil Kovalev
a5c727125e Fix compilation errors appearing due to missing <cstdint> include (#81233)
This patch resolves the issue by adding missing `<cstdint>` includes.
For SmallVector.h, such a change was already introduced in LLVM repository:
7e44305041

<!--
If this pull request is targeting a release branch, please fill out the
following form:

https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1

Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:

  Resolves <link to issue>, resolves <link to another issue>.

For more information about linking a pull request to an issue, see:

https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->

<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:

https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci

Thank you for your contribution to Swift!
-->
2025-05-08 17:43:29 -07:00
Henrik G. Olsson
59d7d3160f [Swiftify] Emit @availability when expansions contain Span (#81320)
This prevents errors when compiling for older targets using a newer
compiler.

rdar://150740330
2025-05-08 16:13:24 -07:00
Alejandro Alonso
d26bde798e Start building the runtime demangle tree for extended existentials 2025-05-07 13:56:25 -07:00
Ben Troller
3123cb0407 Merge pull request #81311 from btroller/clean-up-obj-interop-templating-in-remote-mirror
[RemoteMirror] Clean up templating used by Remote Mirror's SwiftReflectionContext to handle ObjC interop being enabled/disabled in the target.
2025-05-07 12:34:11 -07:00
Nate Cook
e68069f891 [stdlib] Allow a default for optional interpolations (#80547)
This adds an `appendInterpolation` overload to
`DefaultStringInterpolation` that includes a parameter for providing a
default string when the value to interpolate is `nil`. This allows this
kind of usage:

```swift
let age: Int? = nil
print("Your age is \(age, default: "timeless")")
// Prints "Your age is timeless"
```

The change includes an additional fixit when optional values are
interpolated, with a suggestion to use this `default:` parameter.
2025-05-07 12:47:02 -05:00
Alastair Houghton
921d6d8d2c Merge pull request #81332 from al45tair/eng/PR-148899609
[Concurrency] Don't pass negative times to the Dispatch code.
2025-05-07 09:46:26 +01:00
Guillaume Lessard
d8c3942198 Merge pull request #81224 from glessard/override-lifetime-publicly
[stdlib] make `_overrideLifetime()` functions public
2025-05-06 19:56:11 -07:00
Guillaume Lessard
bc22bcd820 [stdlib] remove TODOs
These TODOs aren’t particularly actionable. What we really want is a way to define `_overrideLifetime()` in a not-unsafe way, and that will probably be a `Builtin` operation.
2025-05-06 15:19:32 -07:00
Eric Miotto
dd9adeb0bf Merge pull request #81241 from edymtt/edymtt/add-builtin-float-dep-for-libraries-depending-on-darwin
CMake: add explicit dependency to _Builtin_float to targets...
2025-05-06 09:09:09 -07:00
Michael Gottesman
b34e2d72fb Merge pull request #81306 from gottesmm/pr-b6ba1a771d90007a5ee6da3e4dc657bfef32b320
[swift-settings] Now that we aren't using it immediately, remove it from tree.
2025-05-06 08:21:23 -07:00
Alastair Houghton
69c965e15c [Concurrency] Don't pass negative times to the Dispatch code.
Dispatch uses unsigned times, and cannot cope with times before its
clock started.  As such, passing negative times from Swift through to
the C++ code results in large unsigned values, which then causes us to
wait forever.  This is undesirable.

rdar://148899609
2025-05-06 15:56:07 +01:00
Slava Pestov
cc8639b523 Merge pull request #81301 from slavapestov/remote-mirrors-cleanups
RemoteInspection: Two small cleanups
2025-05-06 07:43:47 -04:00
Ben Troller
943c0a034a Clean up templating related to whether ObjC interop is enabled for a Remote Mirror context 2025-05-05 15:29:23 -07:00
Doug Gregor
d7c77130e7 Merge pull request #81293 from DougGregor/revert-hashable-asyncstream-inlining
Revert hashable asyncstream inlining
2025-05-05 15:14:34 -07:00
Michael Gottesman
9d59dbed17 [swift-settings] Now that we aren't using it immediately, remove it from tree.
We can always get it back from the git history.

rdar://150695113
2025-05-05 13:39:03 -07:00
Slava Pestov
c205c802f6 RemoteInspection: Remove 'DidSubstitute' form of TypeRef::subst() 2025-05-05 14:59:45 -04:00
Slava Pestov
31947d0617 RemoteInspection: Fix latent bug in TypeRefIsConcrete::visitOpaqueArchetypeTypeRef() 2025-05-05 14:59:45 -04:00
Doug Gregor
f358c1e6b7 Revert "[Concurrency] Hashable funcs should be inlinable for AsyncStream"
This reverts commit 06bb7183f4.
2025-05-05 10:43:11 -07:00
Eric Miotto
8c7e8550aa CMake: add explicit dependency to _Builtin_float to targets...
... that would import that as a result of importing Darwin from the SDK.

Amend my previous change to Differentiation and Distributed in this
sense.

Addresses rdar://150400049
2025-05-05 10:39:14 -07:00
Doug Gregor
f04e916dff Fix issue with older compilers not handling MutableSpan code
The use of SendableCompletionHandlers here is completely incidental,
because it happened to be introduced at roughly the same time as the
bits we needed for MutableSpan. Fixes rdar://148072153.
2025-05-05 10:12:06 -07:00
Philippe Hausler
c4088252d0 [Concurrency] An implementation of system epochs for continuous and suspending clocks (#80409)
This implements
[SE-0473](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0473-clock-epochs.md)
2025-05-05 08:45:24 -07:00
Evan Wilde
91a0692bd1 Merge pull request #81227 from etcwilde/ewilde/FreeBSDPlatformExecutor
Add platform executor module for FreeBSD
2025-05-04 13:07:32 -07:00
Alastair Houghton
3b89d6d137 Merge pull request #81195 from al45tair/eng/PR-150290165
[Concurrency] Fix copy-paste error.
2025-05-04 18:33:50 +01:00
Henrik G. Olsson
bd233ea26e [Swiftify] Don't use count from Span inside withUnsafeBufferPointer call (#81267) 2025-05-04 01:52:05 -07:00
Doug Gregor
c249357f16 Merge pull request #81249 from DougGregor/observation-nonisolated-conformances
[Observation] Create nonisolated conformances to Observable
2025-05-02 12:56:27 -07:00
Karoy Lorentey
74efc7d354 Merge pull request #80859 from lorentey/is_same_metatype_condfail
[stdlib] Allow metatype comparisons to work with outdated compilers
2025-05-02 00:06:18 -07:00
Doug Gregor
3a01fc18b4 Make the _Concurrency library depend on _Builtin_float 2025-05-01 22:01:38 -07:00
Philippe Hausler
3f157ab712 [Observation] Use independent locking since the runtime functions reference a symbol that is not emitted (#81185)
The runtime functions for locking end up referencing a symbol that is
not publicly emitted. This leads to broken linux builds.
Since that interface is not public and does not offer a stable mechanism
and Synchronization cannot be used (due to it being a higher deployment
target) instead it has to revert to implementing locking from scratch
for all platforms.

This is mostly replicated from the swift-async-algorithms package and
should be usable enough to accomplish the goals of this module.

Resolves rdar://150060874
2025-05-01 17:30:50 -07:00
Mike Ash
2838208c06 Merge pull request #81234 from mikeash/useless-comment-begone
[Concurrency] Remove useless comment about assert in AsyncTask::complete().
2025-05-01 16:02:45 -04:00
Stephen Canon
ab2b28cc4b Add static .nanoseconds(_: Double) to Duration (#81210)
SE-0329 defines the following static factory methods:
```
public static func seconds<T: BinaryInteger>(_ seconds: T) -> Duration
public static func seconds(_ seconds: Double) -> Duration
public static func milliseconds<T: BinaryInteger>(_ milliseconds: T) -> Duration
public static func milliseconds(_ milliseconds: Double) -> Duration
public static func microseconds<T: BinaryInteger>(_ microseconds: T) -> Duration
public static func microseconds(_ microseconds: Double) -> Duration
public static func nanoseconds<T: BinaryInteger>(_ value: T) -> Duration
```
For no good reason, the obvious additional method:
```
public static func nanoseconds(_ nanoseconds: Double) -> Duration
```
was omitted. After talking this through with the LSG, we have decided
that this is simply a bug, and we will add this method without formal
evolution review.
2025-05-01 15:50:17 -04:00
Mike Ash
a1dbdd59d1 [Concurrency] Remove useless comment about assert in AsyncTask::complete().
This comment is really about an assert that's no longer present, so it should just go away.
2025-05-01 11:22:39 -04:00
Meghana Gupta
3cad5c5924 Merge pull request #81043 from meg-gupta/fixcow
Insert end_cow_mutation_addr for lifetime dependent values dependent on mutable addresses
2025-05-01 07:26:28 -07:00
Alastair Houghton
23a181730f Merge pull request #81200 from al45tair/eng/PR-150310927
[Concurrency] Fix issue with using Dispatch queues as executors.
2025-05-01 11:56:43 +01:00
Konrad `ktoso` Malawski
62c6159027 Merge pull request #81229 from ktoso/wip-escalation-handler-priority-auth
[Concurrency] Fix ptr auth for task priority escalation handler
2025-05-01 19:53:54 +09:00
Konrad 'ktoso' Malawski
8fccafd2fa [Concurrency] Fix ptr auth for task priority escalation handler
We missed to sign the handler. Along the way the signature of it
changed, so adjust for that.

How to get the number:

```
func PROPER(bar: (TaskPriority, TaskPriority) -> Void) {
    let p = TaskPriority.default
    bar(p, p)
}
```

```
-> % swiftc -target arm64e-apple-macos13 example.swift -S -o - | swift demangle | grep -a3 autda
	stur	x8, [x29, #-64]
	mov	x17, x8
	movk	x17, #11839, lsl #48 <<<<<<<<<
	autda	x16, x17
	ldr	x8, [x16, #64]
	lsr	x8, x8, #0
	add	x8, x8, #15
```

Resolves rdar://150378890
2025-05-01 12:07:35 +09:00
Mike Ash
158b1c56aa Merge pull request #81205 from mikeash/fix-statusRecordLock
[Concurrency] Fix alreadyLocked in withStatusRecordLock.
2025-04-30 21:20:16 -04:00