Conversation
|
Back in the day we did think this would make sense eventually, but meanwhile JSPI provides what Asyncify does but in the VM itself, which is a lot more efficient. That support of course includes reference-typed locals. It sounds like you might be using Asyncify in some other way? Can you explain the motivation and how important this is for you? |
|
Hi!!! I was planning to use this for Saikuro's executor abstraction ( The main issue I ran into is that reference-typed values can remain live across suspension points (which is often the case in Saikuro). In those cases Asyncify currently aborts, which makes it impossible to transform otherwise-valid modules. |
Fixes #3739.
Right now
wasm-opt --asyncifyaborts if a reference-typed value is live across an unwind. Asyncify spills locals into a linear-memory stack, and references can't be stored there, so it gives up.This was annoying for my IPC/RPC runtime, Saikuro, so I decided to go fix Asyncify.
As discussed by @kripken, @martianboy, and @surma in #3739, the fix is to spill references into tables instead of linear memory.
The Asyncify ABI/API remains unchanged, so this shouldn't impact users beyond fixing reference-type support, I believe.
Asyncify still only supports one active pause at a time, though. As a result,
asyncify_start_unwindnow traps if it sees a nonzero cursor.However, multi-pause support would need per-pause regions in the tables. As pointed out, that's a separate problem and a much bigger change, so I left it out of this PR.
Note: This is essentially a cleaned-up and "productionized" version of the proof-of-concept @alexdoesh posted in #3739.