i should port something else to webassembly. maybe that'll bring me happiness
@whitequark that is certainly *a* coping mechanism
@azonenberg it does genuinely make me feel better
@whitequark "Nobody's really sure why, but 2026 was the year everybody used Bank Street Writer from Chromebooks..."

@whitequark

@tigerhiddenadam has been trying to get one of the CHERIoT simulators working in a browser so that we can have a complete demo environment working on the web site…

@david_chisnall @tigerhiddenadam is there a repo i can look at

@whitequark @david_chisnall thank you. This is quite rough at the moment. I can get the simulator to display the help flags but it doesn't currently run an ELF. It also wouldn't build for me on aarch64.

https://github.com/tigerhiddenadam/cheriot-sim.wasm

GitHub - tigerhiddenadam/cheriot-sim.wasm

Contribute to tigerhiddenadam/cheriot-sim.wasm development by creating an account on GitHub.

GitHub
@tigerhiddenadam @david_chisnall oh that's fascianting; i've never used Sail before!

@whitequark @tigerhiddenadam

If we can, the MPact simulator would be the best one to run in WAsm because it's much faster than the Sail and it also has an integrated debugger, so is more interesting for a live development environment.

@david_chisnall @tigerhiddenadam ok yeah that looks like it'd be *way* easier, "just" use the official emsdk bazel configuration with the build (i'm sure it'll break in some exciting manner)
@whitequark @david_chisnall let me give it a go. I did promise Tor we'd try it.
@whitequark no, it's writing a good tutored tutorial for it that would make you happy.
@Netux you're oddly confident talking about my internal state

@whitequark is there any stumbling blocks I need to be aware of if i have a program - programming language VM - that uses libuv for I/O and timers, or can I take some one-and-done thing where I put a heap of files in on one end and get all files back out on the other end or something?

https://github.com/moarvm/moarvm/ if you would like to take a look yourself

GitHub - MoarVM/MoarVM: A VM with adaptive optimization and JIT compilation, built for Rakudo

A VM with adaptive optimization and JIT compilation, built for Rakudo - MoarVM/MoarVM

GitHub
@timotimo yes. libuv doesn't have a wasm port. if you use JSPI (which is basically still experimental, though available across browsers) you should be able to do that anyways. if you want to port it to WASI however (think "run in the terminal" not "run in a browser") things are a little easier though. what's your deployment target?

@whitequark being able to run in browser would be dope, even though the full Rakudo (the raku language compiler) may be a little too big to fit in a typical user's patience limit.

the best way we can currently offer to run some Raku code without anything but your browser is compiler explorer; there's also glot.io which supports multiple code files as input, but is one and a half years behind on versions.

With MoarVM we run on a bunch of architectures already, so WASI would not necessarily be a big expansion of available targets.

Maybe if a JIT that spits out web assembly at run time is not too much work to write, it would let us target more than just x86_64 with jit compilation?

@timotimo loading dynamically compiled chunks of Wasm is definitely possible, *but* it's quite a bit of work to implement; it is not something that even a really good developer could do in, say, a week of work

if you run in the browser and rely on libuv i think you first need to do a port of libuv that uses JSPI for waiting and IO, then you can test that on simpler applications and eventually the full language runtime

@whitequark not having spent much time inside libuv's code itself, and not knowing anything about JSPI or the different wasm runtimes / environments, that sounds to me like I'll need a rather enormous Round Tuit before that becomes feasible (completely ignoring the JIT part for now).

thank you for the pointers!

@timotimo yes i would say it is quite a task to bite off and chew on

personally, i would bill two months of time for it and do it in two weeks, if this gives you any sort of useful indication of complexity and uncertainty