GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    mcc (mcc@mastodon.social)'s status on Wednesday, 04-Jun-2025 11:26:40 JST mcc mcc

    Wasm question

    I was given https://hachyderm.io/@unlambda/114582671790895240 as some example code for printing to stdout from inside wasmtime/WASI

    It calls a function named "fd_write" taken from "wasi_snapshot_preview1"

    "wasi_snapshot_preview1" does not Google well and one link https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md seems to suggest this is deprecated. How were the functions in wasi_snapshot_preview1 chosen? Is there a wasi_snapshot_preview2 or whatever?

    In conversation about 5 days ago from mastodon.social permalink

    Attachments

    1. No result found on File_thumbnail lookup.
      Brian Campbell (@unlambda@hachyderm.io)
      from Brian Campbell
      @mcc@mastodon.social @whitequark@mastodon.social @tedmielczarek@mastodon.social I think this is the example you're looking for: https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-tutorial.md#web-assembly-text-example
    2. Domain not in remote thumbnail source whitelist: opengraph.githubassets.com
      WASI/legacy/preview1/docs.md at main · WebAssembly/WASI
      WebAssembly System Interface. Contribute to WebAssembly/WASI development by creating an account on GitHub.
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Wednesday, 04-Jun-2025 11:26:39 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to

      @mcc there is preview2 (and preview3) but the latter two are component model based. component model is an additional layer of complexity on top of wasm, comparable with wasm itself in terms of the amount required to learn

      In conversation about 5 days ago permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Wednesday, 04-Jun-2025 11:30:51 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to

      @mcc the functions in preview1 were chosen based on something called "cloudlibc" / "cloudabi"

      In conversation about 5 days ago permalink
    • Embed this notice
      mcc (mcc@mastodon.social)'s status on Wednesday, 04-Jun-2025 11:31:10 JST mcc mcc
      in reply to
      • ✧✦Catherine✦✧

      @whitequark all right. if i'm trying to implement "putc" by pulling fd_write out of preview1 and telling it to print a single char from a single iov , am I to your knowledge missing a simpler method?

      In conversation about 5 days ago permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Wednesday, 04-Jun-2025 11:33:38 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to

      @mcc this is the simplest thing you can do to accomplish this task in plain wasm, yes

      In conversation about 5 days ago permalink
    • Embed this notice
      mcc (mcc@mastodon.social)'s status on Wednesday, 04-Jun-2025 12:47:57 JST mcc mcc
      in reply to

      By the way if anyone has an easy way to point me to any of the following it would be much appreciated

      - An example of the (block) syntax in textual wasm
      - An "alignment" is described in "memarg" in the spec, but this shows up nowhere in the textual wasm examples I find. Is this implicit in the use of `i32.` instructions?
      - Is there a way to query the current wasm stack depth?

      In conversation about 4 days ago permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Wednesday, 04-Jun-2025 12:47:57 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to

      @mcc block example: https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Control_flow/block

      querying stack depth: no, you're not allowed to do anything that would make stack depth dynamic, therefore there is no need to have an operation to query it

      In conversation about 4 days ago permalink

      Attachments


    • Embed this notice
      mcc (mcc@mastodon.social)'s status on Wednesday, 04-Jun-2025 12:47:58 JST mcc mcc
      in reply to

      OK so

      I'm struggling with this week due to many issues that feel to me artificial. I don't like how this spec is written. I don't like a lot of the decisions

      Buuut *sigh*

      I guess I got the Good Idea out of the wasm spec I was hoping to find when I picked it. I was feeling like this S-expression form didn't "feel like" a LISP. And then I found this bit in the PDF spec. Using a syntax reordering trick to represent a Forth in LISP style. That's *saying this as if miserable* really smart actually

      In conversation about 4 days ago permalink

      Attachments


      1. https://files.mastodon.social/media_attachments/files/114/622/981/456/614/802/original/5958eb916423a37c.png
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Wednesday, 04-Jun-2025 12:48:59 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to

      @mcc alignment: i think it works like this:

      i32.load align=2

      In conversation about 4 days ago permalink
    • Embed this notice
      mcc (mcc@mastodon.social)'s status on Wednesday, 04-Jun-2025 13:00:37 JST mcc mcc
      in reply to
      • ✧✦Catherine✦✧

      @whitequark well that's good to know because the next thing i was about to do was use a counter in a local to make the stack depth dynamic lol

      In conversation about 4 days ago permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Wednesday, 04-Jun-2025 13:06:51 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to

      @mcc I do emphasize the similarity between the Wasm stack and LLVM variables here! you can't create new LLVM %n variables at runtime in the same way

      the Wasm stack is conceptual, it is not an actual physical stack you can use for normal stack type things. it's basically a compression mechanism (oversimplifying)

      In conversation about 4 days ago permalink
    • Embed this notice
      mcc (mcc@mastodon.social)'s status on Wednesday, 04-Jun-2025 14:08:57 JST mcc mcc
      in reply to
      • ✧✦Catherine✦✧

      @whitequark by the way, the block example, Katelyn G was saying there's some sort of unusual limitation on which basic blocks may follow each other, is there anything that stops me from br'ing between blocks?

      In conversation about 4 days ago permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Wednesday, 04-Jun-2025 14:10:36 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to

      @mcc Wasm does not have basic blocks. (block) is structured control flow: think {...} in C, and there's no `goto`

      In conversation about 4 days ago permalink
    • Embed this notice
      mcc (mcc@mastodon.social)'s status on Wednesday, 04-Jun-2025 14:12:00 JST mcc mcc
      in reply to
      • ✧✦Catherine✦✧

      @whitequark fuck's sake this is worse than LLVM IR

      In conversation about 4 days ago permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Wednesday, 04-Jun-2025 14:14:42 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to

      @mcc it allows for linear time verification, which is pretty important for the web, where anything you can encounter can be malicious. not having the equivalent of a zipbomb in my wasm engine is pretty important

      In conversation about 4 days ago permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Wednesday, 04-Jun-2025 14:15:42 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to

      @mcc that being said, it's a pain, and even lowering LLVM IR to Wasm is... nontrivial. when I build Yosys (which has dozens or hundreds of `goto`s) to Wasm, LLVM spends about 10 minutes in codegen resolving those `goto`s to reducible control flow

      In conversation about 4 days ago permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Wednesday, 04-Jun-2025 14:16:52 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to
      • Brian Swetland

      @swetland @mcc yeah, I also found the spec difficult to navigate (to make it worse it has some obnoxiously resource-hungry javascript that renders formulas)

      my understanding is that the spec is written with one main consumer in mind: people doing formal verification of the spec. the secondary consumer is people with a lot of PL experience writing runtimes. everyone else isn't really considered, in practice if not in theory

      In conversation about 4 days ago permalink
    • Embed this notice
      Brian Swetland (swetland@chaos.social)'s status on Wednesday, 04-Jun-2025 14:16:53 JST Brian Swetland Brian Swetland
      in reply to
      • ✧✦Catherine✦✧

      @mcc @whitequark Between that and how just incredibly convoluted the spec is (any needed piece of information on an opcode or how it works is inevitably spread between 3-5 different sections of the spec), WASM really makes my head hurt. There are some good ideas in there and people are doing good things with it, but from a "sit down and understand how it all works" standpoint it's a pain in the butt.

      In conversation about 4 days ago permalink
    • Embed this notice
      mcc (mcc@mastodon.social)'s status on Wednesday, 04-Jun-2025 14:20:21 JST mcc mcc
      in reply to
      • ✧✦Catherine✦✧
      • Brian Swetland

      @whitequark @swetland really startling to find a situation where I'm like "this HTML page is so hard to read and navigate, I'll switch to the PDF ahh that's better"

      In conversation about 4 days ago permalink
    • Embed this notice
      ✧✦Catherine✦✧ (whitequark@mastodon.social)'s status on Wednesday, 04-Jun-2025 14:20:44 JST ✧✦Catherine✦✧ ✧✦Catherine✦✧
      in reply to
      • Brian Swetland

      @swetland @mcc yeah I basically entirely agree with you

      In conversation about 4 days ago permalink
    • Embed this notice
      Brian Swetland (swetland@chaos.social)'s status on Wednesday, 04-Jun-2025 14:20:46 JST Brian Swetland Brian Swetland
      in reply to
      • ✧✦Catherine✦✧

      @whitequark @mcc That definitely aligns with my experience trying to read it from a "how do I build a functional WASM runtime" and "how do I generate correct WASM binaries" standpoint.

      Some notes from my initial encounters with it illustrate specific grumbles with the presentation:
      https://chaos.social/@swetland/111271568378452789

      In conversation about 4 days ago permalink

      Attachments

      1. No result found on File_thumbnail lookup.
        Brian Swetland (@swetland@chaos.social)
        from Brian Swetland
        Am I the only one who finds that the WASM spec takes a lot of effort to understand? I've been able to find answers to my questions, but it has taken a lot more time and effort than I'd expect for something that feels like a straightforward and sensible design. The presentation feels needlessly convoluted. I'd love a quick reference "green card" that lays out the bytecode and file format in the style of traditional CPU docs. #WebAssembly #Documentation

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.