how do plugin developers debug their code? Is there a way for them to do breakpoint debugging for example? What happens if their code crash, do they get a stacktrace?
I Wrote a WebAssembly VM in C
51–60 of 104 posts
Re: I Wrote a WebAssembly VM in C
#52This is an interesting approach, great work! For anyone that wants to check where the meat is at, is mostly in this file: https://github.com/irrio/semblance/blob/main/src/wrun.c Thinking out loud, I think it would have been a great idea to conform with the Wasm-C-API ( https://github.com/WebAssembly/wasm-c-api ) as a standard interface for the project (which most of the Wasm runtimes: Wasmer, V8, wasmi, etc. have ado…
Um, the author is clearly familiar enough with Wasm, but probably knows enough to know to avoid a company that tried to trademark WebAssembly. > understandable concerns about the fact we, Wasmer, a VC-backed corporation, attempted to trademark the name of a non-profit organization, specifically WebAssembly Acknowledgement of wrongdoing.
Re: I Wrote a WebAssembly VM in C
#53Earlier quoted context omitted.
I know one of WebAssembly's biggest features by design is security / "sandbox". But I've always gotten confused with... it is secure because by default it can't do much. I don't quite understand how to view WebAssembly. You write in one language, it compiles things like basic math (nothing with network or filesystem) to another and it runs in an interpreter. I feel like I have a severe lack/misunderstanding. There's…
WebAssembly can communicate through buffers. WebAssembly can also import foreign functions (Javascript functions in the browser). You can get output by reading the buffer at the end of execution/when receiving callbacks. So, for instance, you pass a few frames worth of buffers to WASM, WASM renders pixels into the buffers, calls a callback, and the Javascript reads data from the buffer (sending it to a or similar). T…
Re: tty support in container2wasm and fixed 80x25 due to lack of SIGWINCH support in WASI Preview 1: https://github.com/ktock/container2wasm/issues/146
The File System Access API requires granting each app access to each folder.
jupyterlab-filesystem-access only works with Chromium based browsers, because FF doesn't support the File System Access API: https://github.com/jupyterlab-contrib/jupyterlab-filesystem-...
The File System Access API is useful for opening a local .ipynb and .csv with JupyterLite, which builds CPython for WASM as Pyodide.
There is a "Direct Sockets API in Chrome 131" but not in FF; so WebRTC and WebSocket relaying is unnecessary for WASM apps like WebVM: https://news.ycombinator.com/item?id=42029188
Re: I Wrote a WebAssembly VM in C
#54Earlier quoted context omitted.
WebAssembly can communicate through buffers. WebAssembly can also import foreign functions (Javascript functions in the browser). You can get output by reading the buffer at the end of execution/when receiving callbacks. So, for instance, you pass a few frames worth of buffers to WASM, WASM renders pixels into the buffers, calls a callback, and the Javascript reads data from the buffer (sending it to a or similar). T…
WASI Preview 1 and WASI Preview 2 can do file and network I/O IIUC. Re: tty support in container2wasm and fixed 80x25 due to lack of SIGWINCH support in WASI Preview 1: https://github.com/ktock/container2wasm/issues/146 The File System Access API requires granting each app access to each folder. jupyterlab-filesystem-access only works with Chromium based browsers, because FF doesn't support the File System Access API…
> wasi-io, wasi-clocks, wasi-random, wasi-filesystem, wasi-sockets, wasi-cli, wasi-http
Re: I Wrote a WebAssembly VM in C
#55Re: I Wrote a WebAssembly VM in C
#56Earlier quoted context omitted.
Indeed, we need to improve further the base binary size! Most of the size comes from the LLVM backend, which is a bit heavy. Wasmer ships many backends by default, and if you were to use Wasmer headless that would be just a bit less than a Mb. If you want, you can always customize the build with only the backends that you are interested in using. Note: I've seen some builds of LLVM under 5-10Mb, but those require hea…
So you are shipping all of llvm?
They are now in the size realm of Lisp and Smalltalk. Forth may lean towards the lighter side.
Re: I Wrote a WebAssembly VM in C
#57The WASM spec people rejected it for being too "high-level". But the C committee also rejected proposals from Dennis Ritchie. My money is still on Ritchie. Rob Pike's money seems to be on Ritchie direction as well. Otherwise, why create Golang?
Tail-calls are only high-level if calls are high-level.
Re: I Wrote a WebAssembly VM in C
#58Earlier quoted context omitted.
So you are shipping all of llvm?
Well, if you want to just-in-time compile, then it seems like a compiler is one way to go. They are now in the size realm of Lisp and Smalltalk. Forth may lean towards the lighter side.
tcc is 100KB
Re: I Wrote a WebAssembly VM in C
#59How do you debug an interpreter when you aren't coding for it directly? How far does fuzzing strings of opcodes get you?
How much practical difference is there between a server side WASM engine and a browser-based one? How much work would be involved converting one to the other?
Re: I Wrote a WebAssembly VM in C
#60One tip for the author from another one, the spec-test contains various weird forms of textual wasm that isn't obvious how to compile but the wast2json converter can produce a simpler JSON desc accompanies by regular binary wasm files.