multi-value webassembly in firefox: from 1 to n -- wingolog
DRANK

Greetings, hackers! Today I'd like to write about something I worked on recently: implementation of the multi-value future feature of WebAssembly in Firefox, as sponsored by Bloomberg.In the "minimum viable product" version of WebAssembly published in 2018, there were a few artificial restrictions placed on the language. Functions could only return a single value; if a function would naturally return two values, it would have to return at least one of them by writing to memory. Loops couldn't take parameters; any loop state variables had to be stored to and loaded from indexed local variables at each iteration. Similarly, any block that would naturally return more than one result would also have to do so via locals.This restruction is lifted with the multi-value proposal. Function type now map from result type to result type, where a result type is a sequence of value types. That is to say, just as functions can multiple arguments, they can return multiple results. Similarly, with the…

wingolog.org
Related Topics: HTML5 WebAssembly Firefox