QEMU TCI on WASI
For weval support, one option would to be to use QEMU's TCI and instrument it with weval syscalls. However, weval surrently only supports WASI, which would require QEMU to support WASI, and then the TCI on it as well.
There is QEMU compiled with emscripten (not WASI) at https://github.com/ktock/qemu-wasm so this might be a good start point. To compile TCI for WASI, we need at least the following:
- Compiling dependencies (including glib and libffi) using wasi-sdk
- Implement a coroutine backend for wasi (existing backends: ucontext, emscripten fiber, etc...)
- We might need wasi-thread to enable pthread or modify QEMU to run with single thread
There is QEMU compiled with emscripten (not WASI) at https://github.com/ktock/qemu-wasm so this might be a good start point. To compile TCI for WASI, we need at least the following:
- Compiling dependencies (including glib and libffi) using wasi-sdk
- Implement a coroutine backend for wasi (existing backends: ucontext, emscripten fiber, etc...)
Binaryen's asyncify could be one, which powers coroutine libraries like minicoro
- We might need wasi-thread to enable pthread or modify QEMU to run with single thread
We could also use coroutines to mimic threads with yielding points inserted into QEMU, which would be less of a pain than fully removing threads.