Glen
12/22/2021, 7:14 PMnapperley
12/22/2021, 10:08 PMSvyatoslav Kuzmich [JB]
12/22/2021, 11:26 PMArkady Bazhanov
12/23/2021, 9:16 AMRather 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.
napperley
12/24/2021, 12:53 AMSvyatoslav Kuzmich [JB]
12/24/2021, 9:27 AMArkady Bazhanov
12/24/2021, 11:21 AMbefore 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.
napperley
12/24/2021, 10:14 PMSvyatoslav Kuzmich [JB]
12/24/2021, 11:13 PM