Home | Notifications | New Note | Local | Federated | Search | Logout

Note Detail


Reply to @mcc@mastodon.social
mcc@mcc@mastodon.social (2026-10-01 13:15:56)
OK. An update of how this attempt to write a small, simple program in textual WASM went.

I read the basics. It made sense. I attempted to write the simplest of code. I was immediately horrifically stymied by unreadable (apparently intended for implementors of validation tools, not coders) documentation, underdocumented and in other places literally unfinished tooling, the three (?) WASI standards, and different wasm targets (web, wasi) having entirely different ways of invoking "printf". (1/2)
---Reply--- mcc@mcc@mastodon.social (2026-10-01 13:17:31) At this point I ragequit the project, didn't look at it for 16 months, picked it up today, attempted to restart from scratch with the Spritely Hoot toolchain (https://files.spritely.institute/docs/guile-hoot/latest/Wasm-REPL-commands.html), failed at THAT,, looked at my 16-month-old code, suddenly realized I understood the conceptual issue that had stymied me before (as if I'd taken a 16-month shower and suddenly the problem made sense), threw out the huge block of code in which I failed to implement "printf", and successfully printed a number. (2/2) ---Attachments--- image: https://files.mastodon.social/media_attachments/files/117/363/715/325/126/782/original/0eaec78d057b0943.png
image: https://files.mastodon.social/media_attachments/files/117/363/715/743/226/045/original/125ba055781ab3d0.png
image: https://files.mastodon.social/media_attachments/files/117/363/716/056/606/684/original/842b09ef1c1d3cdc.png
Reply

---Replies---
mcc@mcc@mastodon.social (2026-10-02 02:58:29)
ME: Hey so is there a way to detect or prevent an integer overflow in multiplication in wasm? Carry flag, saturation, traps, anything?

HELPFUL FRIEND: No, wasm is conservative to the point of being unhelpful and you have to do those kind of checks yourself, they didn't want to commit to integer ops that some CPUs might not support

ME: Well okay I guess that's reasonable

WASM SPEC: Hey guys check it out I made an instruction that counts the number of 1 bits in a number https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Numeric/popcnt