it seems that the instructions inside the block can't pop anything off the stack (aside from the items that they previously pushed) right? then why is the block type still t1* -> t2*? that implies that there is a mechanism for a block to pop items from outside the stack right? if that is true, how could I express that in WAT?
apologies in advance, I'm new here.
and new to webassembly in general
oops this chat room is dead, maybe I should look for an answer on my own, sorry
oops I mean outside the block not outside the stack, message editing is disabled for some reason
the block can pop any values in the t1*
or that it pushes itself, but it can't pop any off from before the t1*
this is somewhat... unclear. this implies that t1* can be nonempty, but can you post an example where t1* is nonempty? because I don't think a block can pop anything from outside the block
also... I can understand the reduction rules but the typing rules are really confusing to me. do you have any resources to help me understand WASM typing better? by typing I mean the validation aspect of the spec
ah answered my own question. a block can take parameters. wow.
https://github.com/WebAssembly/spec/blob/master/test/core/block.wast#L277
I think this was introduced by the multi-value wasm proposal: https://github.com/WebAssembly/spec/commit/484180ba3d9d7638ba1cb400b699ffede796927c#diff-cfc42e9323c5feaffe9643627c8a9853faa19bf583ceb07e30580e0896055d20R169
Last updated: Dec 23 2024 at 12:05 UTC