(context: WebAssembly/function-references#44)
An idea I've had is to annotate validated branches. The key thing is that the set of validated branch targets is monotonic - just like the set of set locals. That is, once we see that a branch to $b
validates, any subsequent branch must also validate, since we can only add more locals that are set. So as an optimization, the validator could track those until the end of the current block. That basically means to handle the set of valid branch targets in a 1a
-like manner, and could be a nice speedup on stuff like this:
(br_if $b ..) ;; Linear time here.
(br_if $b ..) ;; But constant time here
(br_if $b ..) ;; and here!