Skip to content

[6.2] Fix linking Embedded Swift concurrency for Wasm #83288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 19 commits into
base: release/6.2
Choose a base branch
from

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Jul 24, 2025

Explanation: Cherry-pick of #82331, #83236 and #82270, merged to main as 7ada71b, f20417c, and b1eea5e respectively.
The test is only partially enabled: we only check for IR correctness and correct linking. We don't run the tests on WASI yet due to unrelated issues that are going to be resolved separately.
Scope:
Risk:
Testing:
Issue: rdar://156506703
Reviewer:

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test linux

1 similar comment
@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test linux

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test linux

@MaxDesiatov MaxDesiatov force-pushed the deleted-method-6.2 branch 3 times, most recently from ca945bf to ee22a6c Compare July 26, 2025 10:28
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test linux

Currently `test/CMakeLists.txt` can only set `SWIFT_LIT_ARGS` for all tests uniformly. This means that we can't have tests for Embedded Swift with a different set of params.

Let's refactor computation of `lit.py` options and arguments into a separate function, which means these params can set separately for different tests.

In this change we're only using it once, but in the future we anticipate another use of `setup_lit_args` specifically for Embedded Swift testing.
# Conflicts:
#	test/CMakeLists.txt
Run new `check-swift-embedded-wasi` target from `test/CMakeLists.txt`, tweak `lit.cfg` to support both `-wasi` and `-wasip1` triples, exclude unsupported tests based on `CPU=wasm32` instead of `OS=wasi`.

# Conflicts:
#	test/embedded/builtin-float.swift
#	test/embedded/dependencies-random.swift
#	test/embedded/float-abi-hard.swift
#	test/embedded/fragile-reference.swift
#	test/embedded/no-allocations-print.swift
#	test/embedded/optionset2.swift
#	test/embedded/ouroboros-bug.swift
#	test/embedded/static-object-non-darwin.swift
#	test/embedded/stdlib-array.swift
#	test/embedded/stdlib-basic.swift
#	test/embedded/stdlib-dictionary.swift
#	test/embedded/stdlib-random.swift
#	test/embedded/stdlib-set.swift
#	test/embedded/stdlib-strings-interpolation3.swift
#	test/embedded/stdlib-types.swift
#	test/embedded/traps-fatalerror-ir.swift
# Conflicts:
#	test/embedded/classes-generic-no-stdlib.swift
@@ -677,18 +677,6 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING)
"${CMAKE_CURRENT_BINARY_DIR}${VARIANT_SUFFIX}/lit.site.cfg"
"test${VARIANT_SUFFIX}.lit.site.cfg")
swift_generate_lit_swift_features_cfg("${CMAKE_CURRENT_BINARY_DIR}${VARIANT_SUFFIX}/lit.swift-features.cfg")

set(VARIANT_SUFFIX "-embedded-wasi")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This variant is already enabled above on L610, removing as unused

`ExecutorImpl.cpp` should be moved from `SWIFT_RUNTIME_CONCURRENCY_NONEMBEDDED_C_SOURCES` to `SWIFT_RUNTIME_CONCURRENCY_C_SOURCES`. This way we can also include `ExecutorImpl.swift` and use `PlatformExecutorCooperative.swift` in embedded concurrency for WASI.

# Conflicts:
#	stdlib/public/Concurrency/CMakeLists.txt
#	stdlib/public/Concurrency/Executor.swift
…g#83236)

The test is only partially enabled: we only check for IR correctness and correct linking. We don't run the tests on WASI yet due to unrelated issues that are going to be resolved separately.
# Conflicts:
#	test/embedded/concurrency-deleted-method.swift
#	test/lit.cfg
al45tair and others added 3 commits July 28, 2025 12:50
Teach the Embedded Swift compiler to include the Impl functions for the
functions that provide Concurrency hooks.
We need to explicitly link `swift_asyncMainDrainQueueImpl` and
`swift_createDefaultExecutors` since those two do not have Concurrency
hooks and so aren't linked automatically by the macro-processing code.
@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test linux

@MaxDesiatov MaxDesiatov changed the title [6.2] Enable concurrency-deleted-method.swift test for wasip1 [6.2] Fix linking Embedded Swift Concurrency for Wasm Jul 28, 2025
@MaxDesiatov MaxDesiatov changed the title [6.2] Fix linking Embedded Swift Concurrency for Wasm [6.2] Fix linking Embedded Swift concurrency for Wasm Jul 28, 2025
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.

2 participants