More POWER in Firefox 62


The fixes for compilation and better performance on ppc64le yours truly contributed to Firefox are now in the release channel with Firefox 62. These were bug 1464751, bug 1464754 and bug 1465274, which was a spin-off from bug 1434589.

Unfortunately, the Fedora pre-built Firefox 62 seems to have a crippling crash bug in it when typing addresses into the location bar. Your distro's package may vary. However, building from source doesn't seem to be affected, implying some build configuration issue on their end. Note that there are build system changes in 62 which require some additional workarounds in your .mozconfig and this might have been what bit them. Here's what I use for making a debug build:

export CC=/usr/bin/gcc
export CXX=/usr/bin/g++

mk_add_options MOZ_MAKE_FLAGS="-j24"
ac_add_options --enable-application=browser
ac_add_options --enable-optimize="-Og -mcpu=power9"
ac_add_options --enable-debug
ac_add_options --disable-jemalloc
ac_add_options --disable-release
ac_add_options --enable-linker=bfd

export RUSTC_OPT_LEVEL=0
Adjust the -j24 to the number of threads you want (I like keeping some resources free, so I reserve eight threads from the 32 on this system). The linker defaults to gold, which doesn't work right on ppc64le; this configuration forces it to GNU ld ("bfd"). This config also forces the use of gcc instead of clang; you change to your tastes.

Making a release build seems to have some problems on POWER9 still, so that's disabled, along with jemalloc. I also have a binary of gn (from Chromium) used to regenerate some configurations, which I'm happy to provide upon request. If you have such a binary, then add export GN=/path/to/gn to let the build system use it.

Save this as .mozconfig in the root of the Mercurial tree you cloned or tarball you expanded, and then ./mach build to build.

For an optimized build, such as the one this blog post is being typed in, the config is nearly the same:

export CC=/usr/bin/gcc
export CXX=/usr/bin/g++

mk_add_options MOZ_MAKE_FLAGS="-j24"
ac_add_options --enable-application=browser
ac_add_options --enable-optimize="-O3 -mcpu=power9"
ac_add_options --disable-jemalloc
ac_add_options --disable-release
ac_add_options --enable-linker=bfd

export RUSTC_OPT_LEVEL=2
Unfortunately, setting MOZ_PGO (for profile-guided optimization) and MOZ_LTO (for link-time optimization), although they complete, seem to generate defective executables. That will be a project to work on later. The RUSTC_OPT_LEVEL is probably unnecessary here but doesn't hurt.

My internal builds also use a port of TenFourFox's basic adblock to reduce the amount of JavaScript it needs to run, since Firefox does not yet have a JIT for ppc64le. That's something I'm working on as well, inspired by the big-endian 32-bit PowerPC JIT in TenFourFox, but this JIT will be 64-bit and little-endian so that we can get wasm up and running. I'll be posting progress reports here as the work moves along. This is rather different than the folks working on the ppc64le Chromium port, which uses the existing Power ISA support in V8 and is trying to get the rest of the browser up. For philosophical reasons I won't be working on that project (I think Google's dissemination of Blink is not ultimately benign, a topic for another day), but I support more browser choice on our new platform, and I hope they are successful too.

Comments