|
|
42bafbe |
diff -up a/build/moz.configure/lto-pgo.configure.pgo b/build/moz.configure/lto-pgo.configure
|
|
|
42bafbe |
--- a/build/moz.configure/lto-pgo.configure.pgo 2020-09-30 19:41:10.000000000 +0200
|
|
|
42bafbe |
+++ b/build/moz.configure/lto-pgo.configure 2020-10-01 14:48:15.459225300 +0200
|
|
|
42bafbe |
@@ -69,12 +69,14 @@ set_config('PGO_PROFILE_PATH', pgo_profi
|
|
|
42bafbe |
@imports(_from='__builtin__', _import='min')
|
|
|
42bafbe |
def pgo_flags(compiler, profdata, target_is_windows):
|
|
|
42bafbe |
if compiler.type == 'gcc':
|
|
|
42bafbe |
+ #profile_use = '-fprofile-use=$(topobjdir)'
|
|
|
42bafbe |
+ profile_use = '-fprofile-use'
|
|
|
42bafbe |
return namespace(
|
|
|
42bafbe |
gen_cflags=['-fprofile-generate'],
|
|
|
42bafbe |
gen_ldflags=['-fprofile-generate'],
|
|
|
42bafbe |
- use_cflags=['-fprofile-use', '-fprofile-correction',
|
|
|
42bafbe |
+ use_cflags=[profile_use, '-fprofile-correction',
|
|
|
42bafbe |
'-Wcoverage-mismatch'],
|
|
|
42bafbe |
- use_ldflags=['-fprofile-use'],
|
|
|
42bafbe |
+ use_ldflags=[profile_use],
|
|
|
42bafbe |
)
|
|
|
42bafbe |
|
|
|
42bafbe |
if compiler.type in ('clang-cl', 'clang'):
|
|
|
42bafbe |
@@ -192,13 +194,13 @@ def lto(value, c_compiler, ld64_known_go
|
|
|
42bafbe |
cflags.append("-flto")
|
|
|
42bafbe |
ldflags.append("-flto")
|
|
|
42bafbe |
else:
|
|
|
42bafbe |
- cflags.append("-flto=thin")
|
|
|
42bafbe |
- ldflags.append("-flto=thin")
|
|
|
42bafbe |
+ cflags.append("-flto")
|
|
|
42bafbe |
+ ldflags.append("-flto")
|
|
|
42bafbe |
elif c_compiler.type == 'clang-cl':
|
|
|
42bafbe |
if len(value) and value[0].lower() == 'full':
|
|
|
42bafbe |
cflags.append("-flto")
|
|
|
42bafbe |
else:
|
|
|
42bafbe |
- cflags.append("-flto=thin")
|
|
|
42bafbe |
+ cflags.append("-flto")
|
|
|
42bafbe |
# With clang-cl, -flto can only be used with -c or -fuse-ld=lld.
|
|
|
42bafbe |
# AC_TRY_LINKs during configure don't have -c, so pass -fuse-ld=lld.
|
|
|
42bafbe |
cflags.append("-fuse-ld=lld");
|
|
|
42bafbe |
diff -up a/build/pgo/profileserver.py.pgo b/build/pgo/profileserver.py
|
|
|
42bafbe |
--- a/build/pgo/profileserver.py.pgo 2020-09-30 19:41:10.000000000 +0200
|
|
|
42bafbe |
+++ b/build/pgo/profileserver.py 2020-10-01 13:54:58.535312905 +0200
|
|
|
42bafbe |
@@ -11,7 +11,7 @@
|
|
|
42bafbe |
import subprocess
|
|
|
42bafbe |
|
|
|
42bafbe |
import mozcrash
|
|
|
42bafbe |
-from mozbuild.base import MozbuildObject, BinaryNotFoundException
|
|
|
42bafbe |
+from mozbuild.base import MozbuildObject, BinaryNotFoundException, BuildEnvironmentNotFoundException
|
|
|
42bafbe |
from mozfile import TemporaryDirectory
|
|
|
42bafbe |
from mozhttpd import MozHttpd
|
|
|
42bafbe |
from mozprofile import IceCatProfile, Preferences
|
|
|
42bafbe |
@@ -84,9 +84,22 @@ if __name__ == '__main__':
|
|
|
42bafbe |
port=PORT,
|
|
|
42bafbe |
options='primary,privileged')
|
|
|
42bafbe |
|
|
|
42bafbe |
- old_profraw_files = glob.glob('*.profraw')
|
|
|
42bafbe |
- for f in old_profraw_files:
|
|
|
42bafbe |
- os.remove(f)
|
|
|
42bafbe |
+ using_gcc = False
|
|
|
42bafbe |
+ try:
|
|
|
42bafbe |
+ if build.config_environment.substs.get('CC_TYPE') == 'gcc':
|
|
|
42bafbe |
+ using_gcc = True
|
|
|
42bafbe |
+ except BuildEnvironmentNotFoundException:
|
|
|
42bafbe |
+ pass
|
|
|
42bafbe |
+
|
|
|
42bafbe |
+ if using_gcc:
|
|
|
42bafbe |
+ for dirpath, _, filenames in os.walk('.'):
|
|
|
42bafbe |
+ for f in filenames:
|
|
|
42bafbe |
+ if f.endswith('.gcda'):
|
|
|
42bafbe |
+ os.remove(os.path.join(dirpath, f))
|
|
|
42bafbe |
+ else:
|
|
|
42bafbe |
+ old_profraw_files = glob.glob('*.profraw')
|
|
|
42bafbe |
+ for f in old_profraw_files:
|
|
|
42bafbe |
+ os.remove(f)
|
|
|
42bafbe |
|
|
|
42bafbe |
with TemporaryDirectory() as profilePath:
|
|
|
42bafbe |
# TODO: refactor this into mozprofile
|
|
|
42bafbe |
@@ -191,6 +204,11 @@
|
|
|
42bafbe |
print("IceCat exited successfully, but produced a crashreport")
|
|
|
42bafbe |
sys.exit(1)
|
|
|
42bafbe |
|
|
|
42bafbe |
+
|
|
|
42bafbe |
+ print('Copying profile data....')
|
|
|
42bafbe |
+ os.system('pwd');
|
|
|
42bafbe |
+ os.system('tar cf profdata.tar.gz `find . -name "*.gcda"`; cd ..; tar xf instrumented/profdata.tar.gz;');
|
|
|
42bafbe |
+
|
|
|
42bafbe |
llvm_profdata = env.get('LLVM_PROFDATA')
|
|
|
42bafbe |
if llvm_profdata:
|
|
|
42bafbe |
profraw_files = glob.glob('*.profraw')
|
|
|
42bafbe |
diff -up a/build/unix/mozconfig.unix.pgo b/build/unix/mozconfig.unix
|
|
|
42bafbe |
--- a/build/unix/mozconfig.unix.pgo 2020-09-30 19:41:10.000000000 +0200
|
|
|
42bafbe |
+++ b/build/unix/mozconfig.unix 2020-10-01 13:54:58.535312905 +0200
|
|
|
42bafbe |
@@ -6,6 +6,15 @@ if [ -n "$FORCE_GCC" ]; then
|
|
|
42bafbe |
CC="$MOZ_FETCHES_DIR/gcc/bin/gcc"
|
|
|
42bafbe |
CXX="$MOZ_FETCHES_DIR/gcc/bin/g++"
|
|
|
42bafbe |
|
|
|
42bafbe |
+ if [ -n "$MOZ_PGO" ]; then
|
|
|
42bafbe |
+ if [ -z "$USE_ARTIFACT" ]; then
|
|
|
42bafbe |
+ ac_add_options --enable-lto
|
|
|
42bafbe |
+ fi
|
|
|
42bafbe |
+ export AR="$topsrcdir/gcc/bin/gcc-ar"
|
|
|
42bafbe |
+ export NM="$topsrcdir/gcc/bin/gcc-nm"
|
|
|
42bafbe |
+ export RANLIB="$topsrcdir/gcc/bin/gcc-ranlib"
|
|
|
42bafbe |
+ fi
|
|
|
42bafbe |
+
|
|
|
42bafbe |
# We want to make sure we use binutils and other binaries in the tooltool
|
|
|
42bafbe |
# package.
|
|
|
42bafbe |
mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$PATH"
|
|
|
42bafbe |
diff -up a/extensions/spellcheck/src/moz.build.pgo b/extensions/spellcheck/src/moz.build
|
|
|
42bafbe |
--- a/extensions/spellcheck/src/moz.build.pgo 2020-09-30 19:41:17.000000000 +0200
|
|
|
42bafbe |
+++ b/extensions/spellcheck/src/moz.build 2020-10-01 13:54:58.535312905 +0200
|
|
|
42bafbe |
@@ -31,3 +31,5 @@ EXPORTS.mozilla += [
|
|
|
42bafbe |
|
|
|
42bafbe |
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
|
|
42bafbe |
CXXFLAGS += ['-Wno-error=shadow']
|
|
|
42bafbe |
+
|
|
|
42bafbe |
+CXXFLAGS += ['-fno-devirtualize']
|
|
|
42bafbe |
\ No newline at end of file
|
|
|
42bafbe |
diff -up a/python/mozbuild/mozbuild/build_commands.py.pgo b/python/mozbuild/mozbuild/build_commands.py
|
|
|
42bafbe |
--- a/python/mozbuild/mozbuild/build_commands.py.pgo 2020-09-30 19:41:46.000000000 +0200
|
|
|
42bafbe |
+++ b/python/mozbuild/mozbuild/build_commands.py 2020-10-01 13:54:58.535312905 +0200
|
|
|
42bafbe |
@@ -108,7 +108,8 @@ class Build(MachCommandBase):
|
|
|
42bafbe |
return status
|
|
|
42bafbe |
|
|
|
42bafbe |
pgo_env = os.environ.copy()
|
|
|
42bafbe |
- pgo_env['LLVM_PROFDATA'] = instr.config_environment.substs.get('LLVM_PROFDATA')
|
|
|
42bafbe |
+ if instr.config_environment.substs.get('CC_TYPE') != 'gcc':
|
|
|
42bafbe |
+ pgo_env['LLVM_PROFDATA'] = instr.config_environment.substs.get('LLVM_PROFDATA')
|
|
|
42bafbe |
pgo_env['JARLOG_FILE'] = mozpath.join(orig_topobjdir, 'jarlog/en-US.log')
|
|
|
42bafbe |
pgo_cmd = [
|
|
|
42bafbe |
instr.virtualenv_manager.python_path,
|
|
|
ba3d3fd |
--- a/toolkit/components/terminator/nsTerminator.cpp.pgo 2020-10-07 09:22:26.698243673 +0200
|
|
|
ba3d3fd |
+++ b/toolkit/components/terminator/nsTerminator.cpp 2020-10-07 09:22:43.026312999 +0200
|
|
|
ba3d3fd |
@@ -418,6 +418,11 @@ void nsTerminator::StartWatchdog() {
|
|
|
ba3d3fd |
}
|
|
|
ba3d3fd |
#endif
|
|
|
ba3d3fd |
|
|
|
ba3d3fd |
+ // Disable watchdog for PGO train builds - writting profile information at
|
|
|
ba3d3fd |
+ // exit may take time and it is better to make build hang rather than
|
|
|
ba3d3fd |
+ // silently produce poorly performing binary.
|
|
|
ba3d3fd |
+ crashAfterMS = INT32_MAX;
|
|
|
ba3d3fd |
+
|
|
|
ba3d3fd |
UniquePtr<Options> options(new Options());
|
|
|
ba3d3fd |
const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000);
|
|
|
ba3d3fd |
options->crashAfterTicks = crashAfterMS / ticksDuration;
|