RESOLVED FIXED270376
[JSC] Decode local indices at runtime in WASM in-place interpreter
https://bugs.webkit.org/show_bug.cgi?id=270376
Summary [JSC] Decode local indices at runtime in WASM in-place interpreter
David Degazio
Reported 2024-03-01 13:43:49 PST
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.
Attachments
David Degazio
Comment 1 2024-03-07 13:21:37 PST
EWS
Comment 2 2024-03-07 17:48:18 PST
Committed 275815@main (bfe017002276): <https://commits.webkit.org/275815@main> Reviewed commits have been landed. Closing PR #25596 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.