Skip to content

psm: support stack switching on wasm32-wasip3 - #165

Open
eduardomourar wants to merge 2 commits into
rust-lang:masterfrom
eduardomourar:wasip3-disable-stack-switching
Open

eduardomourar wants to merge 2 commits into
rust-lang:masterfrom
eduardomourar:wasip3-disable-stack-switching

Conversation

@eduardomourar

@eduardomourar eduardomourar commented Nov 21, 2026 •

Copy link
Copy Markdown

wasm32-wasip3 links with --cooperative-threading, which replaces the classic __stack_pointer WebAssembly global with a component-model task-context slot. rust-lld rejects any object that references that global directly. wasi-libc reaches the slot instead through a pair of
imported functions, __wasm_get_stack_pointer/__wasm_set_stack_pointer (module "env"), which wit-component recognizes by name and rewires during componentization.

Add a wasm32-wasip3 object that imports and calls those functions in place of every global.get/global.set __stack_pointer wasm32.s has, so rust_psm_on_stack/rust_psm_replace_stack work the same way here as on other wasm32 targets, with canswitch = true.

Extend the wasm-test CI matrix to cover wasm32-wasip1/wasip2/wasip3, each run under its own wasmtime invocation.

@eduardomourar
eduardomourar force-pushed the wasip3-disable-stack-switching branch from 75611e8 to 25e511d Compare November 22, 2026 00:04
@eduardomourar
eduardomourar marked this pull request as ready for review November 22, 2026 00:19
@eduardomourar
eduardomourar force-pushed the wasip3-disable-stack-switching branch from 25e511d to 28e4145 Compare November 24, 2026 23:55
@eduardomourar eduardomourar changed the title chore(psm): add wasm32-wasip3 assembly exclusion psm: support stack switching on wasm32-wasip3 Nov 24, 2026
@eduardomourar

Copy link
Copy Markdown
Author

@nagisa, I would appreciate a review on this one, please.

This branch has not been deployed

No deployments
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.

1 participant