Glen12/22/2021, 7:14 PM
napperley12/22/2021, 10:08 PM
Svyatoslav Kuzmich [JB]12/22/2021, 11:26 PM
Arkady Bazhanov12/23/2021, 9:16 AM
Rather than hoisting the code into a separate process, we instead compile it into WebAssembly and then compile that WebAssembly into native code. This doesn’t result in us shipping any .wasm files in Firefox, since the WebAssembly step is only an intermediate representation in our build process.
We accomplished this with wasm2c, which performs a straightforward translation of WebAssembly into equivalent C code, which we can then feed back into Clang along with the rest of the Firefox source code. This approach is very simple, and automatically enables a number of important features that we support for regular Firefox code: profile-guided optimization, inlining across sandbox boundaries, crash reporting, debugger support, source-code indexing, and likely other things that we have yet to appreciate.
napperley12/24/2021, 12:53 AM
Svyatoslav Kuzmich [JB]12/24/2021, 9:27 AM
Arkady Bazhanov12/24/2021, 11:21 AM
before the code is converted to WASM againNo, it’s not. It’s compiled to native code and shipped as part of Firefox. This is not about WASM support in Firefox, this is about Firefox team using WASM internally as an intermediate step to achieve sandboxing for different parts of the Firefox itself (like parsers and such), which interact with user data.
napperley12/24/2021, 10:14 PM
Svyatoslav Kuzmich [JB]12/24/2021, 11:13 PM