Whole-known-network
<p><span class="h-card" translate="no"><a href="https://with.iridium.ink/@artemis" class="u-url mention">@<span>artemis</span></a></span> this but unironically</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> 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</p>
<p>Wasm question</p><p>I was given <a href="https://hachyderm.io/@unlambda/114582671790895240" target="_blank" rel="nofollow noopener" translate="no"><span class="invisible">https://</span><span class="ellipsis">hachyderm.io/@unlambda/1145826</span><span class="invisible">71790895240</span></a> as some example code for printing to stdout from inside wasmtime/WASI</p><p>It calls a function named "fd_write" taken from "wasi_snapshot_preview1"</p><p>"wasi_snapshot_preview1" does not Google well and one link <a href="https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md" target="_blank" rel="nofollow noopener" translate="no"><span class="invisible">https://</span><span class="ellipsis">github.com/WebAssembly/WASI/bl</span><span class="invisible">ob/main/legacy/preview1/docs.md</span></a> seems to suggest this is deprecated. How were the functions in wasi_snapshot_preview1 chosen? Is there a wasi_snapshot_preview2 or whatever?</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@shriramk" class="u-url mention">@<span>shriramk</span></a></span> I haven't watched these videos and maybe you have, but just in case: seems relevant: <a href="https://www.youtube.com/playlist?list=PLl5qdV4C5xJdzOt8Y4pVk7gDSNuIzmMUx" target="_blank" rel="nofollow noopener noreferrer" translate="no"><span class="invisible">https://www.</span><span class="ellipsis">youtube.com/playlist?list=PLl5</span><span class="invisible">qdV4C5xJdzOt8Y4pVk7gDSNuIzmMUx</span></a> (RCB's IPL 2025 Auction Planning)</p>
<p><span class="h-card" translate="no"><a href="https://pleroma.envs.net/users/easrng" class="u-url mention">@<span>easrng</span></a></span> <span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> <span class="h-card" translate="no"><a href="https://social.treehouse.systems/@rcombs" class="u-url mention">@<span>rcombs</span></a></span> yep looks reasonable to me!</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> <span class="h-card" translate="no"><a href="https://chaos.social/@mega" class="u-url mention">@<span>mega</span></a></span> the stack machine that JVM and Wasm have, and the SSA form that LLVM has, are literally equivalent (they are different ways to serialize the same IR, essentially; with the caveat that Wasm forbids irreducible control flow)</p><p>if you have your code in SSA/CPS form you would find it easy to emit stack bytecode, if you do not, it is most convenient to use locals (and the runtimes are aware of this and optimize for it)</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@whitequark" class="u-url mention">@<span>whitequark</span></a></span> <span class="h-card" translate="no"><a href="https://chaos.social/@mega" class="u-url mention">@<span>mega</span></a></span> if i am writing/generating code why would i use the stack for live variables instead of the locals, or vice versa?</p>
<p><span class="h-card" translate="no"><a href="https://chaos.social/@mega" class="u-url mention">@<span>mega</span></a></span> <span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> there is the caveat that both wasm and java have the separate concept of locals, which is why i said "temporaries"; you still have to do liveness analysis for locals-locals if you want high quality codegen</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@whitequark" class="u-url mention">@<span>whitequark</span></a></span> <span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> Also (maybe relevant for the JIT comment): the stack at any given point *is* the set of live variables.</p><p>If you calculate a kind of "virtual stack" for a given basic block you will end up with the amount of elements that it pops from the stack (phi nodes/basic block arguments/whatever you want to call them) and the amount of elements it adds to the stack at the end of its execution (values that will be consumed by another block).</p>