WASM is not quite a stack machine

(purplesyringa.moe)

28 points | by signa11 5 hours ago

2 comments

  • stevefan1999 1 hour ago
    I'm trying to implement a WASM to C compiler, and because of that not-quite-so-stack behavior, I can actually guarantee that it will always build an expression and I don't have to discard or reset stack value! Everything stays within that function, which is very neat, and I think it is one of the reason WAT, the textual format is so neat, that you can represent it with a S-Expression.
  • kg 8 minutes ago
    The lack of a dup opcode in Wasm as mentioned in the post is quite annoying when trying to generate compact code. I wish something like it had made it into the spec.