Commit Graph

21492 Commits

Author SHA1 Message Date
Alastair Houghton
8caa5c5c0d [Concurrency] Add a missing public.
The default implementation of `traits` on `Clock` needs to be `public`.

rdar://141348916
2025-03-14 10:01:37 +00:00
Doug Gregor
1fafebccdf Merge pull request #80006 from DougGregor/concurrency-if-task-to-thread
[Concurrency] Remove unnecessary #ifs that break task-to-thread model
2025-03-13 21:39:04 -07:00
Guillaume Lessard
39ca3dee4d Merge pull request #80003 from glessard/span-gardening
[stdlib] fix `Span`'s `Sendable` conformance
2025-03-13 18:54:42 -07:00
Doug Gregor
a1132ca169 [Concurrency] Remove unnecessary #ifs that break task-to-thread model
Fixes rdar://146968199
2025-03-13 16:43:19 -07:00
Guillaume Lessard
e81a2ee3a1 [stdlib] correctly express Span sendability 2025-03-13 13:54:18 -07:00
Alejandro Alonso
5d745fe5d5 Update MinimalCollections.swift 2025-03-13 10:50:06 -07:00
Alejandro Alonso
0646c61cf5 Fix bidirectional test to account for RandomAccess 2025-03-13 10:11:51 -07:00
Alejandro Alonso
b0d98549cb Update to match api acceptance 2025-03-13 09:58:44 -07:00
Alejandro Alonso
9894440454 Conditionally conform EnumeratedSequence to Collections 2025-03-13 09:58:09 -07:00
Alastair Houghton
d197f38226 [Concurrency] Make currentExecutor return a non-optional.
If we don't have any other executor to return, return the default
executor.

rdar://141348916
2025-03-13 13:37:43 +00:00
Alastair Houghton
00e7ef2d21 [Concurrency] Remove EventableExecutor, alter asSchedulable.
EventableExecutor is being removed, for now, but hopefully will
return in some form in the future.

The `asSchedulable` implementation needs to change for reasons of
ABI stability.

rdar://141348916
2025-03-13 13:37:43 +00:00
Alastair Houghton
444bbd5b00 [Concurrency] Update following pitch comments.
Remove `supportsScheduling` in favour of a type-based approach.

Update the storage for `ClockTraits` to `UInt32`.

Adjust ordering of executors for `currentExecutor`.

rdar://141348916
2025-03-13 13:37:43 +00:00
Alastair Houghton
23d0ca7a6a [Concurrency] Update header file.
This needed an update to make things build on Linux and Windows.

rdar://141348916
2025-03-13 13:37:43 +00:00
Alastair Houghton
fc67cc3b60 [Concurrency] Mark expressions as unsafe.
Also fix a missing availability annotation.

rdar://141348916
2025-03-13 13:37:43 +00:00
Alastair Houghton
b33666cf08 [Concurrency] Fixes from initial review.
Rename `DispatchTaskExecutor` to `DispatchGlobalTaskExecutor` as we
may want to use the former for an executor that runs things on an
arbitrary Dispatch queue.

Rename `DispatchExecutor` to `DispatchExecutorProtocol`; again, we
might want the name for something else.

Add `@Sendable` attribute to `registerEvent`.

Fix missing `extern "C" SWIFT_CC(swift)` on `_swift_exit` (merge
error).

Remove stray whitespace from `CMakeLists.txt`

rdar://141348916
2025-03-13 13:37:43 +00:00
Alastair Houghton
d14b9370fb [Concurrency] Don't use blocks.
We can't use blocks, because Swift doesn't support them on Linux or
Windows.  Instead, use a C function pointer, and box up the handler.

rdar://141348916
2025-03-13 13:37:43 +00:00
Alastair Houghton
ef0e09d0b7 [Concurrency][Embedded] Remove MainActor/MainExecutor everywhere.
Embedded Swift doesn't have MainActor, so remove it.

rdar://141348916
2025-03-13 13:37:43 +00:00
Alastair Houghton
229865192f [Concurrency] Rename ExecutorJob back to PartialAsyncTask.
The rename appears to have had some kind of potentially ABI breaking
consequence.

rdar://141348916
2025-03-13 13:37:43 +00:00
Alastair Houghton
5ae6de288a [Concurrency] Fix potential ABI breakages.
Fix a couple of potential ABI breaks.  Also add the new functions and types
to the baseline lists.

rdar://141348916
2025-03-13 13:37:36 +00:00
Alastair Houghton
d89ea190bb [Concurrency] Add clock traits.
Remove the hacky support for mapping clocks to a Dispatch clock ID,
in favour of clocks publishing traits and having the Dispatch
executor select the clock on the basis of those traits.
2025-03-13 13:34:41 +00:00
Alastair Houghton
55afa47bea [Concurrency] More work on the custom executor implementation.
Added an `-executor-factory` argument to the compiler to let you safely
specify the executors you wish to use (by naming a type that returns
them).

Also added some tests of the new functionality.

rdar://141348916
2025-03-13 13:34:41 +00:00
Alastair Houghton
090c375b7b [Concurrency] Swift interface for custom main and global executors.
Reorganise the Concurrency code so that it's possible to completely
implement executors (both main and global) in Swift.

Provide API to choose the desired executors for your application.

Also make `Task.Sleep` wait using the current executor, not the global
executor, and expose APIs on `Clock` to allow for conversion between
time bases.

rdar://141348916
2025-03-13 13:34:41 +00:00
Konrad `ktoso` Malawski
8c4dea9802 Revert "[concurrency] Add support for HopToMainActorIfNeededThunk." (#79938)
* Revert "[concurrency] Add support for HopToMainActorIfNeededThunk."

This reverts commit 0e0665bfbd.

* remove some last bits of 0e0665b
2025-03-13 06:48:03 +09:00
Guillaume Lessard
35b851453d [gardening] update some copyright years 2025-03-12 09:56:41 -07:00
Doug Gregor
ad626f9c0e [Stdlib performance] Make integer conversion operations transparent
The integer conversion operations were inlinable, but aren't getting
inlined in debug builds, which results in unreasonably poor
performance. Mark them as transparent so we don't end up with
unspecialized generic code in the hot path.

Fixes https://github.com/swiftlang/swift/issues/78501
2025-03-12 07:40:49 -07:00
Ben Barham
a1a8bde65d [Runtime] Return ConformanceLookupResult from findConformanceWithDyld 2025-03-11 21:30:28 -07:00
Mike Ash
c7922b29af Merge pull request #79774 from mikeash/bigger-empty-va-list-storage
[Stdlib] Make alignedStorageForEmptyVaLists bigger.
2025-03-11 23:10:24 -04:00
Doug Gregor
2efa05d615 Merge pull request #79905 from DougGregor/DougGregor/concurrency-lib-6-2-fix
[Concurrency lib] Stdlib 9999 -> 6.2, where this code would land
2025-03-11 10:56:38 -07:00
Mike Ash
70e1931caa [Stdlib] Make alignedStorageForEmptyVaLists bigger.
Expand alignedStorageForEmptyVaLists to eight Doubles. This produces more predictable output for code that calls a variadic function without parameters where the function still expects them, such as passing an arbitary string to a string formatting function. It's still unsound, but this makes it more predictable.

rdar://145083971
2025-03-11 09:29:07 -04:00
Doug Gregor
733dd86c92 Merge pull request #79896 from DougGregor/strict-memory-safety-cleanups
Strict memory safety cleanups
2025-03-11 01:26:30 -07:00
Doug Gregor
0de53547e5 [Concurrency lib] Stdlib 9999 -> 6.2, where this code would land 2025-03-10 23:07:06 -07:00
Michael Gottesman
04bb69f426 Merge pull request #79727 from gottesmm/pr-025c1133954b74e7b4eda77e1a6f3bcafd4eb6cf
[concurrency] Add initial support for SwiftSettings to control defaultIsolation at the file level.
2025-03-10 22:35:00 -07:00
Konrad `ktoso` Malawski
e056c63c89 [Concurrency] Implement isIsolatingCurrentContext requirement and mode (#79788) 2025-03-11 09:48:38 +09:00
Michael Gottesman
f64dd5a8d5 [concurrency] Add initial support for SwiftSettings to control defaultIsolation at the file level.
We introduce a new macro called #SwiftSettings that can be used in conjunction
with a new stdlib type called SwiftSetting to control the default isolation at
the file level. It overrides the current default isolation whether it is the
current nonisolated state or main actor (when -enable-experimental-feature
UnspecifiedMeansMainActorIsolated is set).
2025-03-10 17:33:45 -07:00
Doug Gregor
53f14688a6 Update strict memory safety annotations for Synchronization module 2025-03-10 15:42:32 -07:00
Doug Gregor
9f2859edd8 Update Cxx library for strict memory safety 2025-03-10 15:42:29 -07:00
Doug Gregor
170845b864 Strict memory safety cleanups for the concurrency library 2025-03-10 15:42:11 -07:00
Doug Gregor
f668feaf64 [Standard library] Additional strict-memory-safety annotations 2025-03-10 15:42:05 -07:00
Guillaume Lessard
940628a23a [stdlib] add newly-required unsafe annotations 2025-03-10 15:20:51 -07:00
Guillaume Lessard
082aaecc9c [stdlib] update availability for CxxSpan (#79883) 2025-03-10 10:13:39 -07:00
Guillaume Lessard
39b4303e79 [stdlib] match KeyValuePairs’s Element type 2025-03-10 08:54:07 -07:00
Guillaume Lessard
83dc08d006 [stdlib] remove an unneeded annotation 2025-03-10 08:54:07 -07:00
Guillaume Lessard
7188d0b187 [stdlib] add span property to KeyValuePairs 2025-03-10 08:54:07 -07:00
Guillaume Lessard
d0d528521a [stdlib] add span property to InlineArray 2025-03-10 08:54:06 -07:00
Guillaume Lessard
264747ac77 [stdlib] add span property to CollectionOfOne 2025-03-10 08:51:56 -07:00
Guillaume Lessard
7bbb8348e3 [stdlib] add span properties to array types 2025-03-10 08:51:56 -07:00
Guillaume Lessard
acdfb3711a [stdlib] refactor lazy-eager-bridging for reusability 2025-03-10 08:51:56 -07:00
Guillaume Lessard
9cdd83b469 [stdlib] add span properties to UnsafeBufferPointer family 2025-03-10 08:51:56 -07:00
Guillaume Lessard
85b53bb023 [stdlib] add bytes property to Span 2025-03-10 08:51:56 -07:00
Doug Gregor
537be30f22 Merge pull request #79785 from DougGregor/isolated-conformances-metadata-runtime 2025-03-09 08:27:40 -07:00