Skip to content

Fix/wasix subprocess feature detection#6532

Draft
Arshia001 wants to merge 17 commits intomainfrom
fix/wasix-subprocess-feature-detection
Draft

Fix/wasix subprocess feature detection#6532
Arshia001 wants to merge 17 commits intomainfrom
fix/wasix-subprocess-feature-detection

Conversation

@Arshia001
Copy link
Copy Markdown
Member

This PR allows WASIX subprocesses to select a different engine or different feature set relative to the parent process.

Fixes #6515.

Copilot AI review requested due to automatic review settings May 1, 2026 11:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves WASIX subprocess execution by allowing child modules to be compiled with a different engine backend and/or an extended Wasm feature set than the parent process (addressing macOS failures where subprocess modules require features like exceptions).

Changes:

  • Add runtime-side module feature detection and sys-backend selection/caching so subprocesses can compile with a compatible backend/features.
  • Update PluggableRuntime construction to take an Engine up-front (removing post-construction engine mutation patterns) and adjust call sites.
  • Add a new WASIX test that runs a --singlepass parent which execs an exception-using child module to validate engine/feature switching.

Reviewed changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/wasix/subprocess-engine-selection/run.sh Builds parent/child WASIX modules with different feature requirements and runs the parent under Singlepass.
tests/wasix/subprocess-engine-selection/main.c Parent module vfork/execs the child and validates its exit code.
tests/wasix/subprocess-engine-selection/child.cc Child module uses C++ exceptions to require exception-handling support.
tests/wasix/subprocess-engine-selection/.no-build Marks the test as manually built via run.sh.
tests/lib/wast/src/wasi_wast.rs Updates PluggableRuntime construction to pass the current store engine.
lib/wasix/tests/wasm_tests/reflection_tests/wasix-reflection-and-closures/main.c Attempts to make closure/reflection test more conditional, but changes affect compilation.
lib/wasix/tests/wasm_tests/.gitignore Normalizes an ignore entry formatting (no functional change).
lib/wasix/tests/runners.rs Updates runtime construction to pass an engine argument.
lib/wasix/src/syscalls/wasix/proc_exec3.rs Removes an unused new_store local related to exec/spawn flow.
lib/wasix/src/state/builder.rs Constructs PluggableRuntime with an engine derived from the builder config.
lib/wasix/src/runtime/mod.rs Core change: add sys-backend selection, engine caching, and per-module feature detection in resolve_module; update PluggableRuntime::new signature.
lib/wasix/src/runners/wasi.rs Updates tests to the new PluggableRuntime::new(..., engine) signature.
lib/wasix/src/os/console/mod.rs Updates tests to the new PluggableRuntime::new(..., engine) signature.
lib/wasix/src/bin_factory/binary_package.rs Updates tests to the new PluggableRuntime::new(..., engine) signature.
lib/wasix/Cargo.toml Adds sys/compiler backend feature wiring (sys-default, singlepass, cranelift, llvm) and an optional compiler dependency.
lib/swift/src/lib.rs Updates runtime construction to pass an engine.
lib/compiler/src/engine/inner.rs Adds Engine::new_with_extended_features(...) helper for sys engine rebuilding.
lib/compiler/src/compiler.rs Extends the Compiler trait with a configuration() accessor.
lib/compiler-singlepass/src/compiler.rs Implements new Compiler::configuration() API.
lib/compiler-llvm/src/compiler.rs Implements new Compiler::configuration() API.
lib/compiler-cranelift/src/compiler.rs Implements new Compiler::configuration() API.
lib/cli/src/commands/run/wasi.rs Passes the selected engine into PluggableRuntime::new and removes set_engine chaining.
lib/cli/Cargo.toml Ensures CLI backend feature flags also enable corresponding wasmer-wasix/* backend features.
lib/c-api/src/wasm_c_api/wasi/mod.rs Passes the store engine into PluggableRuntime::new.
lib/c-api/Cargo.toml Ensures C-API backend feature flags also enable corresponding wasmer-wasix/* backend features.
examples/wasi.rs Updates example to construct PluggableRuntime with Engine::default().
Cargo.toml Ensures workspace backend features also enable corresponding wasmer-wasix/* backend features.
Cargo.lock Records the added wasmer-compiler dependency.

Comment thread lib/wasix/src/runtime/mod.rs
Comment thread lib/compiler/src/engine/inner.rs Outdated
Comment thread lib/wasix/tests/wasm_tests/reflection_tests/wasix-reflection-and-closures/main.c Outdated
Comment thread lib/wasix/src/runtime/mod.rs Outdated
Comment thread lib/wasix/src/runtime/mod.rs
@Arshia001 Arshia001 requested a review from theduke May 4, 2026 06:55
/// Build a new Engine with the same compiler and configuration, but with this Engine's
/// features extended by the given features.
#[cfg(feature = "compiler")]
pub fn new_with_extended_features(&self, features: &Features) -> Result<Self, CompileError> {
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 thought it's already something we've been doing, see #6222.

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.

macOS: bash invoking a coreutils command leads to: compile error: "exceptions proposal not enabled"

3 participants