116 lines
5.0 KiB
Diff
116 lines
5.0 KiB
Diff
diff -up firefox-96.0/build/moz.configure/lto-pgo.configure.pgo firefox-96.0/build/moz.configure/lto-pgo.configure
|
|
--- firefox-96.0/build/moz.configure/lto-pgo.configure.pgo 2022-01-06 19:32:35.000000000 +0100
|
|
+++ firefox-96.0/build/moz.configure/lto-pgo.configure 2022-01-11 15:43:02.193378698 +0100
|
|
@@ -248,8 +248,8 @@ def lto(
|
|
cflags.append("-flto")
|
|
ldflags.append("-flto")
|
|
else:
|
|
- cflags.append("-flto=thin")
|
|
- ldflags.append("-flto=thin")
|
|
+ cflags.append("-flto")
|
|
+ ldflags.append("-flto")
|
|
|
|
if target.os == "Android" and value == "cross":
|
|
# Work around https://github.com/rust-lang/rust/issues/90088
|
|
@@ -265,7 +265,7 @@ def lto(
|
|
if value == "full":
|
|
cflags.append("-flto")
|
|
else:
|
|
- cflags.append("-flto=thin")
|
|
+ cflags.append("-flto")
|
|
# With clang-cl, -flto can only be used with -c or -fuse-ld=lld.
|
|
# AC_TRY_LINKs during configure don't have -c, so pass -fuse-ld=lld.
|
|
cflags.append("-fuse-ld=lld")
|
|
diff -up firefox-96.0/build/pgo/profileserver.py.pgo firefox-96.0/build/pgo/profileserver.py
|
|
--- firefox-96.0/build/pgo/profileserver.py.pgo 2022-01-06 16:56:23.000000000 +0100
|
|
+++ firefox-96.0/build/pgo/profileserver.py 2022-01-11 15:43:02.193378698 +0100
|
|
@@ -11,7 +11,7 @@ import glob
|
|
import subprocess
|
|
|
|
import mozcrash
|
|
-from mozbuild.base import MozbuildObject, BinaryNotFoundException
|
|
+from mozbuild.base import MozbuildObject, BinaryNotFoundException, BuildEnvironmentNotFoundException
|
|
from mozfile import TemporaryDirectory
|
|
from mozhttpd import MozHttpd
|
|
from mozprofile import FirefoxProfile, Preferences
|
|
@@ -87,9 +87,22 @@ if __name__ == "__main__":
|
|
locations = ServerLocations()
|
|
locations.add_host(host="127.0.0.1", port=PORT, options="primary,privileged")
|
|
|
|
- old_profraw_files = glob.glob("*.profraw")
|
|
- for f in old_profraw_files:
|
|
- os.remove(f)
|
|
+ using_gcc = False
|
|
+ try:
|
|
+ if build.config_environment.substs.get('CC_TYPE') == 'gcc':
|
|
+ using_gcc = True
|
|
+ except BuildEnvironmentNotFoundException:
|
|
+ pass
|
|
+
|
|
+ if using_gcc:
|
|
+ for dirpath, _, filenames in os.walk('.'):
|
|
+ for f in filenames:
|
|
+ if f.endswith('.gcda'):
|
|
+ os.remove(os.path.join(dirpath, f))
|
|
+ else:
|
|
+ old_profraw_files = glob.glob('*.profraw')
|
|
+ for f in old_profraw_files:
|
|
+ os.remove(f)
|
|
|
|
with TemporaryDirectory() as profilePath:
|
|
# TODO: refactor this into mozprofile
|
|
@@ -212,6 +225,10 @@ if __name__ == "__main__":
|
|
print("Firefox exited successfully, but produced a crashreport")
|
|
sys.exit(1)
|
|
|
|
+ print('Copying profile data....')
|
|
+ os.system('pwd');
|
|
+ os.system('tar cf profdata.tar.gz `find . -name "*.gcda"`; cd ..; tar xf instrumented/profdata.tar.gz;');
|
|
+
|
|
llvm_profdata = env.get("LLVM_PROFDATA")
|
|
if llvm_profdata:
|
|
profraw_files = glob.glob("*.profraw")
|
|
diff -up firefox-96.0/build/unix/mozconfig.unix.pgo firefox-96.0/build/unix/mozconfig.unix
|
|
--- firefox-96.0/build/unix/mozconfig.unix.pgo 2022-01-06 16:56:24.000000000 +0100
|
|
+++ firefox-96.0/build/unix/mozconfig.unix 2022-01-11 15:43:02.193378698 +0100
|
|
@@ -4,6 +4,15 @@ if [ -n "$FORCE_GCC" ]; then
|
|
CC="$MOZ_FETCHES_DIR/gcc/bin/gcc"
|
|
CXX="$MOZ_FETCHES_DIR/gcc/bin/g++"
|
|
|
|
+ if [ -n "$MOZ_PGO" ]; then
|
|
+ if [ -z "$USE_ARTIFACT" ]; then
|
|
+ ac_add_options --enable-lto
|
|
+ fi
|
|
+ export AR="$topsrcdir/gcc/bin/gcc-ar"
|
|
+ export NM="$topsrcdir/gcc/bin/gcc-nm"
|
|
+ export RANLIB="$topsrcdir/gcc/bin/gcc-ranlib"
|
|
+ fi
|
|
+
|
|
# We want to make sure we use binutils and other binaries in the tooltool
|
|
# package.
|
|
mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$PATH"
|
|
diff -up firefox-96.0/extensions/spellcheck/src/moz.build.pgo firefox-96.0/extensions/spellcheck/src/moz.build
|
|
--- firefox-96.0/extensions/spellcheck/src/moz.build.pgo 2022-01-11 15:43:02.193378698 +0100
|
|
+++ firefox-96.0/extensions/spellcheck/src/moz.build 2022-01-11 15:49:52.929362701 +0100
|
|
@@ -28,3 +28,5 @@ EXPORTS.mozilla += [
|
|
"mozInlineSpellChecker.h",
|
|
"mozSpellChecker.h",
|
|
]
|
|
+
|
|
+CXXFLAGS += ['-fno-devirtualize']
|
|
diff -up firefox-96.0/toolkit/components/terminator/nsTerminator.cpp.pgo firefox-96.0/toolkit/components/terminator/nsTerminator.cpp
|
|
--- firefox-96.0/toolkit/components/terminator/nsTerminator.cpp.pgo 2022-01-06 16:58:15.000000000 +0100
|
|
+++ firefox-96.0/toolkit/components/terminator/nsTerminator.cpp 2022-01-11 15:43:02.193378698 +0100
|
|
@@ -466,6 +466,11 @@ void nsTerminator::StartWatchdog() {
|
|
}
|
|
#endif
|
|
|
|
+ // Disable watchdog for PGO train builds - writting profile information at
|
|
+ // exit may take time and it is better to make build hang rather than
|
|
+ // silently produce poorly performing binary.
|
|
+ crashAfterMS = INT32_MAX;
|
|
+
|
|
UniquePtr<Options> options(new Options());
|
|
const PRIntervalTime ticksDuration =
|
|
PR_MillisecondsToInterval(HEARTBEAT_INTERVAL_MS);
|