Skip to content

[Concurrency] Add _concurrency_current_task_storage_kind to Debug.h#90290

Open
felipepiovezan wants to merge 2 commits into
swiftlang:mainfrom
felipepiovezan:felipe/concurrency_task_storage
Open

[Concurrency] Add _concurrency_current_task_storage_kind to Debug.h#90290
felipepiovezan wants to merge 2 commits into
swiftlang:mainfrom
felipepiovezan:felipe/concurrency_task_storage

Conversation

@felipepiovezan

@felipepiovezan felipepiovezan commented Jun 30, 2026

Copy link
Copy Markdown
Contributor
This variable is used to tell the debugger how the runtime stores the
currently executing task. Prior to this patch, the debugger had no way
of knowing how the concurrency library was configured for the target, as
this is a build-time decision; as a result, it is forced to assume the
"common" configuration of swift for macos targets.

Bumping the concurrency version number is not necessary, as this is not
changing the debug ABI in any way. The debugger can simply test the
presence of the symbol.

This PR is required for swiftlang/llvm-project#13279

…on in static linked libs

This symbol is currently removed by the linker on static builds e.g. in
embedded swift or linux.

@ktoso ktoso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable enough

#include "ExecutorBridge.h"
#include "TaskPrivate.h"
#include "swift/ABI/Actor.h"
#include "swift/ABI/Task.h"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is clang-format's doing..

@ktoso

ktoso commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@swift-ci please smoke test

@al45tair al45tair left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did briefly wonder whether we should just have an API for the debugger to call, though of course that means doing a call in the inferior, which is a lot more expensive than just poking about in its memory.

@felipepiovezan

Copy link
Copy Markdown
Contributor Author

I did briefly wonder whether we should just have an API for the debugger to call, though of course that means doing a call in the inferior, which is a lot more expensive than just poking about in its memory.

Yeah, actually I should have linked a post on the forums about this. Let me quote what I said there:

An important consideration: this mapping of Threads -> Task has to be fast. It happens on every single stop (there are usually many non-visible stops when a user is stepping over lines of code, and there are many non-visible stops during program startup). This is particularly important when communication between the debugger and the target is slower than local (e.g. over a wire, even a fast wire).

(https://forums.swift.org/t/exploring-multicore-concurrency-for-embedded-swift/87129/10)

@felipepiovezan

Copy link
Copy Markdown
Contributor Author
026-07-01T10:21:32.390Z] diff -u /Users/ec2-user/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/swift/test/abi/macOS/x86_64/../../Inputs/macOS/x86_64/concurrency/baseline-asserts /Users/ec2-user/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/build/buildbot_incremental/swift-macosx-x86_64/test-macosx-x86_64/abi/macOS/x86_64/Output/concurrency-asserts.swift.tmp/symbols
[2026-07-01T10:21:32.390Z] # executed command: diff -u /Users/ec2-user/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/swift/test/abi/macOS/x86_64/../../Inputs/macOS/x86_64/concurrency/baseline-asserts /Users/ec2-user/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/build/buildbot_incremental/swift-macosx-x86_64/test-macosx-x86_64/abi/macOS/x86_64/Output/concurrency-asserts.swift.tmp/symbols
[2026-07-01T10:21:32.390Z] # .---command stdout------------
[2026-07-01T10:21:32.390Z] # | --- /Users/ec2-user/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/swift/test/abi/macOS/x86_64/../../Inputs/macOS/x86_64/concurrency/baseline-asserts
[2026-07-01T10:21:32.390Z] # | +++ /Users/ec2-user/jenkins/workspace/swift-PR-macos-smoke-test/branch-main/build/buildbot_incremental/swift-macosx-x86_64/test-macosx-x86_64/abi/macOS/x86_64/Output/concurrency-asserts.swift.tmp/symbols
[2026-07-01T10:21:32.390Z] # | @@ -1055,6 +1055,7 @@
[2026-07-01T10:21:32.390Z] # |  __swift_concurrency_debug_asyncTaskMetadata
[2026-07-01T10:21:32.390Z] # |  __swift_concurrency_debug_asyncTaskSize
[2026-07-01T10:21:32.390Z] # |  __swift_concurrency_debug_asyncTaskSlabMetadata
[2026-07-01T10:21:32.390Z] # | +__swift_concurrency_debug_currentTaskStorageKind
[2026-07-01T10:21:32.390Z] # |  __swift_concurrency_debug_future_adapter
[2026-07-01T10:21:32.390Z] # |  __swift_concurrency_debug_jobMetadata
[2026-07-01T10:21:32.390Z] # |  __swift_concurrency_debug_non_future_adapter

I need to update this test

This variable is used to tell the debugger how the runtime stores the
currently executing task. Prior to this patch, the debugger has no way
of knowing how the concurrency library was configured for the target, as
this is a build-time decision; as a result, it is forced to assume the
"common" configuration of swift for macos targets.

Bumping the concurrency version number is not necessary, as this is not
changing the debug ABI in any way. The debugger can simply test the
presence of the symbol.
@felipepiovezan felipepiovezan force-pushed the felipe/concurrency_task_storage branch from 2027c96 to a81d13d Compare July 1, 2026 14:10
@felipepiovezan felipepiovezan requested a review from a team as a code owner July 1, 2026 14:10
@felipepiovezan

Copy link
Copy Markdown
Contributor Author

@swift-ci please smoke test

@felipepiovezan

Copy link
Copy Markdown
Contributor Author

Compiler seems broken:

09:22:49  2.	Compiling with effective version 5.10
09:22:49  Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
09:22:49  0  swift-frontend           0x0000000108ff4e78 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 40
09:22:49  1  swift-frontend           0x0000000108ff2b1b llvm::sys::RunSignalHandlers() + 283
09:22:49  2  swift-frontend           0x0000000108ff59d6 SignalHandler(int, __siginfo*, void*) + 278
09:22:49  3  libsystem_platform.dylib 0x00007ff819be9e9d _sigtramp + 29
09:22:49  4  (error)                  0x00007fcd2c90ee60
09:22:49  5  libsystem_c.dylib        0x00007ff819ad5b19 abort + 126
09:22:49  6  libsystem_c.dylib        0x00007ff819ad4ddc err + 0
09:22:49  7  swift-frontend           0x00000001096453c3 swift::importer::SwiftNameLookupExtension::createExtensionReader(clang::ModuleFileExtensionMetadata const&, clang::ASTReader&, clang::serialization::ModuleFile&, llvm::BitstreamCursor const&) (.cold.1) + 35
09:22:49  8  swift-frontend           0x000000010391d092 swift::importer::SwiftNameLookupExtension::createExtensionReader(clang::ModuleFileExtensionMetadata const&, clang::ASTReader&, clang::serialization::ModuleFile&, llvm::BitstreamCursor const&) + 1010
09:22:49  9  swift-frontend           0x0000000106a7e638 clang::ASTReader::ReadExtensionBlock(clang::serialization::ModuleFile&) + 984

@felipepiovezan

Copy link
Copy Markdown
Contributor Author

@swift-ci smoke test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants