wabt
wabt copied to clipboard
Add Type::RefT to represent (ref $T)
This adds support for handling types of the form (ref $T), where $T is an index into the type section. Rather than storing an additional field in the Type struct, it's more efficient to use the extra bits in the enum to encode the index. For example, RefT is encoded as -0x13 (0xffffffff6d):
1111 1111 1111 1111 1111 1111 0110 1101
f f f f f f 6 d
We can store the index in the top bits (making sure to keep the MSB set so the number remains negative), giving us 23 bits to use for the type index.
1nnn nnnn nnnn nnnn nnnn nnnn 0110 1101
@jgravelle-google ping
Closing as stale. :-(