Commit Graph

17573 Commits

Author SHA1 Message Date
Guillaume Lessard
690f3e64de [stdlib] address 32-bit watchOS ABI issue 2025-06-27 10:18:14 -07:00
Alastair Houghton
c9606ba668 [Concurrency] Prevent negative sleeps from sleeping forever.
Requests to sleep until a negative timestamp would result in sleeping
until `UINT64_MAX` nanoseconds from the start of the relevant clock,
which is about 585 years.

rdar://154346018
2025-06-27 11:13:57 +01:00
Alastair Houghton
0dde6a561d [Concurrency] Rename Dummy(Main|Task)Executor.
`UnimplementedExecutor` seems like a better name.

rdar://153531418
2025-06-26 10:55:00 +01:00
Guillaume Lessard
484d7c7d46 Merge pull request #82422 from glessard/rdar153219174-UMBP-mutableSpan-62
[stdlib, 6.2] add missing computed properties (again)
2025-06-25 14:44:48 -07:00
Saleem Abdulrasool
b8d0749f6f Merge pull request #82223 from Steelskin/fabrice/6.2-vcruntime-modulemap
🍒 modulemap: Add missing dependency on vcruntime
2025-06-24 16:23:24 -07:00
Doug Gregor
ef622dd6e0 Merge pull request #82373 from ktoso/pick-wip-NeverErrorTaskShouldNotThrowInOperation
[6.2][Concurrency] Task.immediate returning Never error must not have thro…
2025-06-24 08:56:32 -07:00
Guillaume Lessard
5046c2a529 [stdlib] add UMBP.mutableSpan accessor 2025-06-23 11:20:48 -07:00
Guillaume Lessard
7ee3f85b7e [stdlib] add URMBP.mutableBytes accessor 2025-06-23 11:20:47 -07:00
Egor Zhdan
bf20dab48c Merge pull request #82185 from swiftlang/susmonteiro/6.2-class-metadata-private-fields
🍒 [cxx-interop] Support for printing C++ foreign references
2025-06-23 17:52:00 +01:00
Guillaume Lessard
f589a7f8fb Merge pull request #82351 from glessard/rdar153219174-UMBP-mutableSpan-62 2025-06-20 10:13:05 -07:00
Adrian Prantl
b92a10cf12 [reflection] Fine-tune error messages
(cherry picked from commit 45198dc0ee)
2025-06-20 08:26:35 -07:00
Egor Zhdan
7158f826e0 Merge pull request #82341 from swiftlang/egorzhdan/6.2-span-shared-cache
🍒[cxx-interop] Make usages of Swift Span `@_alwaysEmitIntoClient` in the overlay
2025-06-20 13:28:33 +01:00
Konrad 'ktoso' Malawski
c81a7aa1a0 [Concurrency] Task.immediate returning Never error must not have throwing operation
rdar://153855920
2025-06-20 09:55:57 +09:00
Guillaume Lessard
9de70180f7 Revert "Merge pull request #82284 from glessard/rdar153219174-UMBP-mutableSpan-62"
This reverts commit 845b68a7c4, reversing
changes made to 3d1c592456.
2025-06-18 13:55:44 -07:00
Adrian Prantl
0d5cc180fb [Reflection] Add lightweight error handling to ReflectionContext
Reflection metadata lookup failures are notoriously difficult to debug
because there is no error handling in TypeLowering outside of
compile-time #ifdef'd fprintf(stderr) calls. The nicest thing to do
would be to adopt llvm::Expected<> but TypeLowering is also included
in the standard library, which only has access to a tiny subset of the
LLVM Support library. This patch adds a place to store a pointer to
the first encountered error, which can then be converted to an
llvm::Error at the API level.

(cherry picked from commit 868c9912aa)
2025-06-18 10:10:23 -07:00
Egor Zhdan
97f9d92e2d [cxx-interop] Make usages of Swift Span @_alwaysEmitIntoClient in the overlay
This fixes a regression where projects that use the C++ stdlib overlay stop building because of a linker error:
```
ld: Shared cache eligible dylib cannot link to ineligible dylib '@rpath/libswiftCompatibilitySpan.dylib'.
```

Usages of `Span<T>` would generally cause a type metadata accessor to be emitted for `Swift.Span`. This becomes a problem with backdeployment, since Span is partially defined in a compatibility binary.

This change adds `@_alwaysEmitIntoClient` to generic usages of `Span` to prevent the type metadata accessor from being emitted into `libswiftCxx.a`.

rdar://152192080
2025-06-18 17:34:32 +01:00
Guillaume Lessard
ea14407cb1 [stdlib] add UMBP.mutableSpan accessor 2025-06-17 15:57:52 -07:00
Guillaume Lessard
7ab45ca442 [stdlib] add URMBP.mutableBytes accessor 2025-06-17 15:57:52 -07:00
Ian Anderson
eb8da5e248 Merge pull request #82117 from ian-twilightcoder/builtin-float-embedded
[6.2][embedded][overlay] _Builtin_float and Synchronization cannot be imported in embedded Swift mode
2025-06-16 12:31:43 -07:00
Mike Ash
fbda570183 [6.2][Runtime] Remove redundant swift_auth_code_function, use existing swift_auth_code.
rdar://153169049
(cherry picked from commit ec6a042831)
2025-06-13 18:50:37 -04:00
Alastair Houghton
5f48a7e1c6 Merge pull request #82204 from al45tair/eng/PR-153152063-6.2
[Concurrency] Fix null pointer dereference for task-to-thread model.
2025-06-13 10:51:22 +01:00
Saleem Abdulrasool
d0ca623854 🍒 modulemap: Add missing dependency on vcruntime
`stdlib.h` includes `limits.h`, which is defined in the `vcruntime`
module.
2025-06-12 11:05:21 -07:00
Valeriy Van
4e46dc5f3e Fix typo
(cherry picked from commit c14699310f)
2025-06-12 10:05:59 -07:00
Philippe Hausler
90f6a8a876 [Observation] Initial implementation of Observed for transactional tracked values over time (#79817) (#82197)
- **Explanation**:
This is an implementation for the feature
https://github.com/swiftlang/swift-evolution/pull/2726
- **Scope**:
This is targeted specifically to the Observation module, no language or
runtime changes
- **Issues**:

- **Original PRs**:
https://github.com/swiftlang/swift/pull/79817
- **Risk**:
Low
- **Testing**:
This was tested in external forms (which need to be merged in)
- **Reviewers**:

---------

Co-authored-by: Stephen Canon <scanon@apple.com>
2025-06-12 09:14:18 -04:00
Alastair Houghton
b3cbdf84ed [Concurrency] Fix null pointer dereference for task-to-thread model.
In task-to-thread concurrency mode, `_getMainExecutorAsSerialExecutor`
returns `SerialExecutorRef::generic()`, which is, give or take, NULL.
Unfortunately we'd declared it as returning `any SerialExecutor`,
rather than `(any SerialExecutor)?`, and then the `getMainExecutor()`
function was calling `asUnownedSerialExecutor()` on it, which then
crashes.

rdar://153152063
2025-06-12 11:53:35 +01:00
Alastair Houghton
9bf75384d0 Merge pull request #82182 from al45tair/eng/PR-150531873-6.2
[Concurrency] Remove deprecation attribute for now.
2025-06-12 09:37:14 +01:00
susmonteiro
862efcf3a0 [cxx-interop] Support for printing C++ foreign references
Adds support for printing a C++ foreign reference in Swift.

Also skips metadata of private fields in C++ records imported as Swift classes, following up on #81035

(cherry-picked from 848fad0021)
2025-06-11 17:13:01 +01:00
Alastair Houghton
008df00262 [Concurrency] Remove deprecation attribute for now.
This deprecation attribute is possibly a little premature.

rdar://150531873
2025-06-11 15:09:55 +01:00
Konrad 'ktoso' Malawski
b690384baf [Concurrency] Correct memory effect attributes of task_create
Without this, llvm would sometimes wrongly assume there's no indirect
accesses and the optimizations can lead to a runtime crash, by
optimizing away initializing options properly.

Resolves rdar://152548190
2025-06-11 22:05:17 +09:00
Saleem Abdulrasool
dbd4325955 Merge pull request #82025 from Steelskin/fabrice/6.2-update-modulemaps-26100-static-sdk
[6.2] Windows module maps update
2025-06-10 22:59:15 -07:00
Guillaume Lessard
0130dea4a1 [stdlib] fix small string usage for Substring.utf8Span 2025-06-09 14:19:41 -07:00
Guillaume Lessard
664cc69556 [stdlib] fix small-string usage for String.utf8Span 2025-06-09 14:19:40 -07:00
Guillaume Lessard
9c016215e0 [stdlib] make annotation adjustments 2025-06-09 14:19:38 -07:00
Guillaume Lessard
3a0f890ef0 Merge pull request #80742 from glessard/rdar137710901-addressable-utf8view-span
[6.2, SE-0456] enable span properties for the small-String representation
2025-06-09 14:11:58 -07:00
Ian Anderson
83577a7d66 [6.2][embedded][overlay] _Builtin_float and Synchronization cannot be imported in embedded Swift mode
The _Builtin_float and Synchronization modules are getting the SDK_NAME encoded in their embedded modules, preventing them from being used outside of macOS in embedded mode.

rdar://152665402
2025-06-09 14:04:52 -07:00
Doug Gregor
cef7f42a4c Fix more typos 2025-06-05 18:10:53 -07:00
Doug Gregor
999b03a31e Fix typos 2025-06-05 18:10:13 -07:00
Doug Gregor
da6c2c428f Improve SendableMetatype documentation 2025-06-05 16:54:59 -07:00
Saleem Abdulrasool
35e9b0bcfd Merge pull request #81951 from Steelskin/fabrice/ucrt-modulemap-26100-3916
Platform: Windows SDK 26100.3916 module map update
2025-06-05 10:05:02 -07:00
Saleem Abdulrasool
8a64f4105e Merge pull request #81826 from Steelskin/fabrice/update-ucrt-vcruntime-modulemap
Platform: Update module maps for the static SDK
2025-06-05 10:04:34 -07:00
Henrik G. Olsson
18a3f083ba Merge pull request #81827 from hnrklssn/swiftify-fixes-6.2
Swiftify fixes for 6.2
2025-06-04 11:30:34 -07:00
Konrad 'ktoso' Malawski
11fb1ad419 [Concurrency] Prefer swift_auth_code_function over swift_auth_code
This allows us to use constants, and not hardcoded numbers
2025-06-03 07:02:48 +09:00
Konrad 'ktoso' Malawski
e18f553eab Correct priority cancellation handler signing once more
Resolves rdar://150378890 for real this time, verified on arm64e myself
2025-06-02 21:40:18 +09:00
Henrik G. Olsson
8584d343cb [Swiftify] Update availability for CxxSpan<->Span, fix lifetimebound on parameters with reference type (#81634)
Update availability for CxxSpan<->Span, fix lifetimebound on parameters
with reference type

Because swift-ide-test doesn't care about typechecking,
std-span-interface.swift passed despite containing 2 separate errors.
This updates the test file to properly exercise the entire compilation
pipeline for the macro expansions, by running swift-frontend
-emit-module and calling each macro expansion.

The first issue was that CxxSpan initializers taking [Mutable]Span still
had their availability set to Swift 6.2+, even after back-deploying
caused [Mutable]Span to have availability back to Swift 5.0. Since
_SwiftifyImport expansions copy the availbility of Span, this resulted
in the macro expansions calling unavailable initializers. Interestingly
enough, this manifested itself in the form of a tripped assert in SIL
verification, because although we do now typecheck the expansions from
_SwiftifyImport, the compilation can still keep going after
`shouldEmitFunctionBody` returns false: the macro expansion declaration
is still there, but is now missing its definition, despite not being
external.

The second issue was when parameters with C++ reference types were
annotated with `[[clang::lifetimebound]]`. For parameters with a type
that is `Escapable`, this is normally done using `@lifetime(borrow
foo)`. However C++ reference parameters are imported as `inout`, which
requires the `@lifetime(&foo)` syntax.

rdar://151493400
rdar://151678415
(cherry picked from commit 262a53f599)
2025-05-30 18:19:57 -07:00
Guillaume Lessard
3a3ea0cb10 Merge pull request #81871 from glessard/rdar138440979-mutablespan-abi-fix-62
[6.2, stdlib] fix an extraneous symbol exported by MutableSpan
2025-05-30 18:01:25 -07:00
Guillaume Lessard
6acbdde394 [stdlib] fix an extraneous symbol exported by MutableSpan 2025-05-30 08:23:42 -07:00
Alastair Houghton
6beca9639f Merge pull request #81528 from al45tair/fix-static-sdk-build-6.2
[6.2][Cxx] Build the C++ interop support library for the Static SDK for Linux.
2025-05-29 15:53:37 +01:00
Mike Ash
90b232caa4 Merge pull request #81815 from mikeash/taskgroup-fixes-6.2
[6.2][Concurrency] Fix races/overflows in TaskGroup implementation.
2025-05-29 05:16:58 -04:00
Konrad `ktoso` Malawski
5baa624085 Merge pull request #81820 from ktoso/pick-abi-fix-startSynchronously
[6.2][Concurrent] Restored old symbol for obsoleted `Task.startSynchronously`
2025-05-29 16:19:38 +09:00
Mike Ash
b42c7fa172 [6.2][Concurrency] Fix races/overflows in TaskGroup implementation.
statusCompletePendingReadyWaiting(), offer(), and poll() did a one-off compare_exchange_strong which could fail if the group was concurrently cancelled. Put these into loops so that they are retried when needed.

DiscardingTaskGroup creation passed the group result type as the task result type. waitAll() would then use the group result type when collecting task results. Since the task result type is always Void in this case, this would overflow the result buffer if the group result type was larger. This often works as it writes into the free space of the task allocator, but can crash if it happens to be at the end of a page or the group result type is particularly large.

rdar://151663730
(cherry picked from commit 5be22fa7cc)
2025-05-28 20:59:17 -04:00