Commit Graph

21665 Commits

Author SHA1 Message Date
Mykola Pokhylets
d8cbaebbd4 Added explicit availability attribute for each protocol requirement
To fix failing test/api-digester/stability-concurrency-abi.test
2025-04-13 13:23:56 +02:00
Mykola Pokhylets
1b2e03189b Added Hashable conformance to Async(Throwing)Stream.Continuation 2025-04-12 14:12:54 +02:00
Alastair Houghton
8310c8aa69 Merge pull request #80761 from al45tair/eng/PR-149067144
[Concurrency] Fix size of AsyncTask::PrivateStorage.
2025-04-12 10:36:14 +01:00
Michael Ilseman
e6e4bd6056 UTF8Span (#78531)
Add support for UTF8Span

Also, refactor validation and grapheme breaking
2025-04-11 16:11:11 -06:00
Max Desiatov
99a4b887f9 NFC: fix comment in WasmImpl.swift (#80760)
Wasm is not an acronym, thus it's not uppercased [per the spec](https://webassembly.github.io/spec/core/intro/introduction.html#wasm).
2025-04-11 12:30:01 -07:00
Meghana Gupta
f462bc5d93 Revert "Merge pull request #79707 from DougGregor/transparent-integer-conversions"
This reverts commit 9c2c4ea07f, reversing
changes made to 829e03c104.
2025-04-11 10:42:17 -07:00
Alastair Houghton
ef3ea9bd27 [Concurrency] Fix size of AsyncTask::PrivateStorage.
Because `TaskAllocator` is not a round multiple of the machine word
size on 64-bit platforms, I think we end up with padding before the
`TaskLocal::Storage` following it, which makes the `PrivateStorage`
structure larger than the calculation in `ABI/Task.h`.

rdar://149067144
2025-04-11 17:12:16 +01:00
Kuba (Brecka) Mracek
c119f3fd76 Merge pull request #80725 from kubamracek/embedded-concurrency-for-non-darwin
[embedded] Start building Concurrency.swiftmodule/.a for non-Darwin target triples too
2025-04-11 07:59:23 -07:00
Alastair Houghton
94b054479b [Concurrency] Remove -executor-factory option and replace with magic type.
We decided that using a magic typealias to set the executor factory was better
than using a compiler option. Remove the `-executor-factory` option, and replace
by looking up the `DefaultExecutorFactory` type, first in the main module, and
then if that fails in Concurrency.

rdar://149058236
2025-04-11 13:55:38 +01:00
Mike Ash
433ca8ea81 Merge pull request #80516 from mikeash/function-cast
[Runtime] Add function_cast, switch from std::bit_cast.
2025-04-11 05:15:25 -04:00
Mike Ash
185b739cf1 [Runtime] Add function_cast, switch from std::bit_cast.
Function types aren't always trivially copyable, e.g. with address-discriminated signed pointers on ARM64e. Introduce a function_cast helper and use that instead.
2025-04-10 20:29:02 -04:00
Kuba (Brecka) Mracek
faefcfd413 [embedded] Also build Concurrency module for x86_64 2025-04-10 16:39:57 -07:00
Kuba Mracek
24507dc37e [embedded] Concurrency/CMakeLists.txt: Use -isystem instead of -I for SDK search paths 2025-04-10 12:22:20 -07:00
Kuba Mracek
08c8b416b4 [embedded] Start building Concurrency.swiftmodule/.a for non-Darwin target triples too 2025-04-10 10:32:33 -07:00
Guillaume Lessard
cb390140d6 [stdlib] correct MutableRawSpan sizing 2025-04-10 10:31:18 -07:00
Guillaume Lessard
53b6b45bda [stdlib] update lifetime annotation syntax 2025-04-10 10:31:18 -07:00
Guillaume Lessard
77431f5217 [stdlib] add MutableSpan.mutableBytes 2025-04-10 10:31:05 -07:00
Meghana Gupta
fc90619254 Add @_transparent to some integer operations in the stdlib
@_transparent will ensure there are inlined in MandatoryInlining which runs before OSLogOptimization.

OSLogOptimization does not look through their calls because they are not marked with
@_semantics("constant_evaluable") which requires them to also be annotated as @_optimize(none)

rdar://148256435
2025-04-10 07:24:02 -07:00
Max Desiatov
cb0e1da0cb Revert "Revert "Concurrency: Move code between Executor{Bridge,Impl}.cpp"" (#80692)
* Revert "Revert "Concurrency: Move code between `Executor{Bridge,Impl}.cpp`""

* Update CMakeLists.txt
2025-04-10 05:35:28 -07:00
Slava Pestov
822083872b Merge pull request #80678 from slavapestov/visionos-stdlib
CompatibilitySpan: Fix stdlib build on visionOS
2025-04-10 07:55:49 -04:00
Guillaume Lessard
5c54e3aea5 Merge pull request #80257 from glessard/rdar137710901-addressable-span-properties
[SE-0456, -0467] enable span properties for inline-storage types
2025-04-09 19:51:46 -07:00
Artem Chikin
ef6cf5785b Revert "Concurrency: Move code between Executor{Bridge,Impl}.cpp (#80601)"
This reverts commit ccd9cf7b5e.
2025-04-09 11:07:31 -07:00
Mike Ash
ee5290a5ee Merge pull request #80600 from mikeash/check-witness-table-isolation-ptrauth
[Runtime] Handle relative witness tables in _checkWitnessTableIsolation.
2025-04-09 13:14:48 -04:00
Mike Ash
4290f0add4 Merge pull request #80447 from mikeash/fix-task-sizes
[Concurrency] Fix task status and private storage sizes.
2025-04-09 13:14:40 -04:00
Kuba Mracek
55f12fe13a [embedded] Add back LosslessStringConvertible to Bool and integer types 2025-04-09 10:08:58 -07:00
Guillaume Lessard
79fb06faf3 [stdlib] update lifetime annotation syntax 2025-04-09 09:56:06 -07:00
Guillaume Lessard
f931d296a2 [stdlib] add InlineArray.mutableSpan 2025-04-09 09:56:06 -07:00
Guillaume Lessard
b90a6fcb41 [stdlib] add CollectionOfOne.mutableSpan 2025-04-09 09:56:06 -07:00
Slava Pestov
17868a7b50 CompatibilitySpan: Fix stdlib build on visionOS
Swift CI tests visionOS, but PR testing does not. Oops.
2025-04-09 12:37:45 -04:00
Max Desiatov
ccd9cf7b5e Concurrency: Move code between Executor{Bridge,Impl}.cpp (#80601)
New `ExecutorImpl.cpp` is excluded when building Embedded Swift stdlib. This fixes duplicate symbol errors when using Embedded Swift.
2025-04-09 05:36:07 -07:00
Alejandro Alonso
fafdc8663b Make _Cell public 2025-04-08 16:07:54 -07:00
Mike Ash
f01d46ce38 [Runtime] Handle relative witness tables in _checkWitnessTableIsolation.
We need to use lookThroughOptionalConditionalWitnessTable when relative witness tables are being used.

rdar://148687148
2025-04-08 16:14:48 -04:00
Slava Pestov
8c11d78672 Merge pull request #80510 from slavapestov/mutable-span-compat
CompatibilitySpan: Add MutableRawSpan.swift, MutableSpan.swift
2025-04-08 15:03:59 -04:00
Mike Ash
e3057031da [RemoteMirror] Fix AsyncTask child iteration.
Iterating child tasks depends on knowing the size of AsyncTask, and changing the size of the task broke it. Instead of relying on mirroring the full structure in our out-of-process definitions, add a debug variable to libswift_Concurrency that contains the size of AsyncTask.

While we're there, add some more validation to child task enumeration. Check each child task's metadata pointer to make sure that it actually points to the AsyncTask metadata, and have the inner loop also increment and check ChildTaskLoopCount to stop runaway iteration in that loop.
2025-04-08 13:09:29 -04:00
Slava Pestov
43da773685 stdlib: Update {Mutable,}{Raw,}Span availability for backward deployment 2025-04-07 21:32:48 -04:00
Slava Pestov
4c8c3aab4f CompatibilitySpan: Add MutableRawSpan.swift, MutableSpan.swift 2025-04-07 21:32:44 -04:00
Slava Pestov
1d25522ceb cmake: Add NO_SWIFTMODULE option to add_swift_target_library() 2025-04-07 21:32:14 -04:00
Meghana Gupta
90324721ad [NFC] Update comment 2025-04-07 16:49:37 -07:00
Mike Ash
1f0696ae05 Merge pull request #80505 from mikeash/metadata-cycle-race-fix
[Runtime] Fix a false metadata cycle diagnostic when threads race to instantiate cyclical metadata.
2025-04-07 16:59:27 -04:00
Philippe Hausler
9d1d917091 [Observation] ensure event triggers on deinitialization passes as if all properties that are being observed have changed (for weak storage) (#79823)
* [Observation] ensure event triggers on deinitialziation passes as if all properties that are being observed have changed (for weak storage)

* Add missing deinitialize method for synthetically triggering willSet

* Correct the weak location for tests

* Correct the test to actually test the deinitialization willSet trigger instead of testing weak value deinitialization time

* Refine the tests for deinit triggers to more tightly trigger deinitialization and weak references

* Correct missing trailing closure on deinit replacement

* Ensure all potential ids are triggered at the deinitialization edge trigger
2025-04-07 13:03:56 -07:00
Meghana Gupta
2d9217bb4f Merge pull request #80541 from meg-gupta/inoutreland
Reland #80452
2025-04-07 10:20:10 -07:00
Egor Zhdan
1ea54588d0 Merge pull request #78841 from CrazyFanFan/feature/replace_self_type_with_generics
[cxx-interop]: Refactor `CxxDictionary` protocols to use generics instead of `Self`.
2025-04-07 11:50:36 +01:00
nate-chandler
0063af561f Merge pull request #80520 from nate-chandler/general-coro/20250403/1
[CoroutineAccessors] Use async bit in descriptors.
2025-04-04 15:47:19 -07:00
Guillaume Lessard
7dd029c372 Revert "[temporary] disable spans over inline elements"
This reverts commit e5c7dfc430.
2025-04-04 14:50:51 -07:00
Mike Ash
9ad534bc4a [Runtime] Fix a false metadata cycle diagnostic when threads race to instantiate cyclical metadata.
The metadata creation system detects cycles where metadata depends on other metadata which depends on the first one again and raises a fatal error if the cycle can't be fulfilled.

Some cycles can be fulfilled. The cycle may involve a requirement for a metadata state less than full transitive completeness which can be reached without resolving the entire cycle. We only want to raise a fatal error when we detect a cycle that can't be fulfilled.

Normally this happens because the cycle checking in `blockOnMetadataDependency` only sees a cycle when it can't be fulfilled. Metadata initialization is advanced as far as it can be at each stage, so a cycle that can be fulfilled will see a fulfilling state and won't generate the dependency in the first place, since we only generate dependencies that haven't yet been met.

However, when two threads race to create types in a cycle, we can end up with such a dependency, because the dependency may be generated before another thread fulfilled yet. The cycle checker doesn't account for this and incorrectly raises a fatal error in that case.

Fix this by checking the cyclic dependency against the metadata's current state. If we have a dependency that's already been fulfilled, then there isn't really a dependency cycle. In that case, don't raise a fatal error.

rdar://135036243
2025-04-04 17:49:55 -04:00
Meghana Gupta
ef1e94577f Revert "Merge pull request #80540 from swiftlang/revert-80452-lifetimeinout"
This reverts commit 6eaa07a880, reversing
changes made to e75ee3f4cf.
2025-04-04 09:50:13 -07:00
Artem Chikin
39e1791b67 Revert "Add support for inout lifetime dependence" 2025-04-04 09:00:09 -07:00
Doug Gregor
b850395611 Merge pull request #80518 from DougGregor/resurrect-allow-unsafe-attribute
[stdlib] Reinstate AllowUnsafeAttribute experimental feature on libraries
2025-04-04 05:20:27 -07:00
Konrad `ktoso` Malawski
8d72db58fe Merge pull request #80522 from ktoso/wip-better-assertion-pop-record
[Concurrency] Improve assertion to validate we pop the EXACT record we intend to
2025-04-04 18:11:56 +09:00
Meghana Gupta
50ea777936 Merge pull request #80452 from meg-gupta/lifetimeinout
Add support for inout lifetime dependence
2025-04-04 02:04:53 -07:00