rdar://123720682 Local indices are encoded using ULEB128 in WebAssembly. In the work-in-progress in-place interpreter, we currently handle (U)LEB128 decoding during validation, and generate fully decoded indices in the metadata. Most functions, however, have very few locals in WebAssembly - WASM binaries that have gone through optimizations tend to treat locals like registers, and in all of JetStream 2 there is no local index that takes more than two bytes to encode. Since it's extremely common local indices will be single-byte, then it makes a lot of sense to skip the metadata entirely for all local instructions, instead having a single-byte fast path combined with an infrequently-taken ULEB128 decode at runtime. Since getting and setting locals makes up something like 1/3 of all WASM instructions in typical binaries, this should substantially reduce the size of the metadata generated for the in-place interpreter, and hopefully improve runtime performance as well.
Pull request: https://github.com/WebKit/WebKit/pull/25596
Committed 275815@main (bfe017002276): <https://commits.webkit.org/275815@main> Reviewed commits have been landed. Closing PR #25596 and removing active labels.