2020-12-16 23:40:17 +01:00
|
|
|
# HG changeset patch
|
|
|
|
# User Wolfgang Rosenauer <wr@rosenauer.org>
|
2021-04-20 09:57:25 +02:00
|
|
|
# Parent ed9681bd4359b83145247fb6b01a56a2c84879fd
|
2020-12-16 23:40:17 +01:00
|
|
|
|
|
|
|
diff --git a/build/moz.configure/lto-pgo.configure b/build/moz.configure/lto-pgo.configure
|
|
|
|
--- a/build/moz.configure/lto-pgo.configure
|
|
|
|
+++ b/build/moz.configure/lto-pgo.configure
|
2021-01-26 22:38:39 +01:00
|
|
|
@@ -235,23 +235,23 @@ def lto(
|
2020-12-16 23:40:17 +01:00
|
|
|
"configure."
|
|
|
|
)
|
|
|
|
|
|
|
|
if c_compiler.type == "clang":
|
|
|
|
if len(value) and value[0].lower() == "full":
|
|
|
|
cflags.append("-flto")
|
|
|
|
ldflags.append("-flto")
|
|
|
|
else:
|
|
|
|
- cflags.append("-flto=thin")
|
|
|
|
- ldflags.append("-flto=thin")
|
|
|
|
+ cflags.append("-flto")
|
|
|
|
+ ldflags.append("-flto")
|
|
|
|
elif c_compiler.type == "clang-cl":
|
|
|
|
if len(value) and value[0].lower() == "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")
|
|
|
|
|
|
|
|
# Explicitly set the CPU to optimize for so the linker doesn't
|
|
|
|
# choose a poor default. Rust compilation by default uses the
|
|
|
|
# pentium4 CPU on x86:
|
|
|
|
#
|
|
|
|
diff --git a/build/pgo/profileserver.py b/build/pgo/profileserver.py
|
|
|
|
--- a/build/pgo/profileserver.py
|
|
|
|
+++ b/build/pgo/profileserver.py
|
|
|
|
@@ -6,17 +6,17 @@
|
|
|
|
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
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
|
|
|
|
from mozprofile.permissions import ServerLocations
|
|
|
|
from mozrunner import FirefoxRunner, CLI
|
|
|
|
from six import string_types
|
|
|
|
|
|
|
|
PORT = 8888
|
|
|
|
@@ -82,19 +82,32 @@ if __name__ == "__main__":
|
|
|
|
docroot=os.path.join(build.topsrcdir, "build", "pgo"),
|
|
|
|
path_mappings=path_mappings,
|
|
|
|
)
|
|
|
|
httpd.start(block=False)
|
|
|
|
|
|
|
|
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
|
|
|
|
profile_data_dir = os.path.join(build.topsrcdir, "testing", "profiles")
|
|
|
|
with open(os.path.join(profile_data_dir, "profiles.json"), "r") as fh:
|
|
|
|
base_profiles = json.load(fh)["profileserver"]
|
|
|
|
|
|
|
|
prefpaths = [
|
|
|
|
@@ -207,16 +220,20 @@ if __name__ == "__main__":
|
|
|
|
|
|
|
|
# Try to move the crash reports to the artifacts even if Firefox appears
|
|
|
|
# to exit successfully, in case there's a crash that doesn't set the
|
|
|
|
# return code to non-zero for some reason.
|
|
|
|
if get_crashreports(profilePath, name="Firefox exited successfully?") != 0:
|
|
|
|
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")
|
|
|
|
if not profraw_files:
|
|
|
|
print(
|
|
|
|
"Could not find profraw files in the current directory: %s"
|
|
|
|
% os.getcwd()
|
|
|
|
)
|
|
|
|
diff --git a/build/unix/mozconfig.unix b/build/unix/mozconfig.unix
|
|
|
|
--- a/build/unix/mozconfig.unix
|
|
|
|
+++ b/build/unix/mozconfig.unix
|
2021-02-24 12:49:39 +01:00
|
|
|
@@ -1,14 +1,23 @@
|
2020-12-16 23:40:17 +01:00
|
|
|
. "$topsrcdir/build/mozconfig.common"
|
|
|
|
|
|
|
|
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
|
2021-02-24 12:49:39 +01:00
|
|
|
+ fi
|
|
|
|
+ export AR="$topsrcdir/gcc/bin/gcc-ar"
|
2020-12-16 23:40:17 +01:00
|
|
|
+ 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"
|
|
|
|
else
|
2021-02-24 12:49:39 +01:00
|
|
|
# For some builds we don't want to have Clang based static-analysis activated
|
|
|
|
if [ -z "$DISABLE_CLANG_PLUGIN" ]; then
|
|
|
|
export ENABLE_CLANG_PLUGIN=1
|
|
|
|
fi
|
2020-12-16 23:40:17 +01:00
|
|
|
diff --git a/extensions/spellcheck/src/moz.build b/extensions/spellcheck/src/moz.build
|
|
|
|
--- a/extensions/spellcheck/src/moz.build
|
|
|
|
+++ b/extensions/spellcheck/src/moz.build
|
|
|
|
@@ -26,8 +26,10 @@ LOCAL_INCLUDES += [
|
|
|
|
]
|
|
|
|
EXPORTS.mozilla += [
|
|
|
|
"mozInlineSpellChecker.h",
|
|
|
|
"mozSpellChecker.h",
|
|
|
|
]
|
|
|
|
|
|
|
|
if CONFIG["CC_TYPE"] in ("clang", "gcc"):
|
|
|
|
CXXFLAGS += ["-Wno-error=shadow"]
|
|
|
|
+
|
|
|
|
+CXXFLAGS += ['-fno-devirtualize']
|
|
|
|
diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp
|
|
|
|
--- a/toolkit/components/terminator/nsTerminator.cpp
|
|
|
|
+++ b/toolkit/components/terminator/nsTerminator.cpp
|
2021-04-20 09:57:25 +02:00
|
|
|
@@ -451,16 +451,21 @@ void nsTerminator::StartWatchdog() {
|
2020-12-16 23:40:17 +01:00
|
|
|
// Defend against overflow
|
|
|
|
crashAfterMS = INT32_MAX;
|
|
|
|
} else {
|
|
|
|
crashAfterMS *= scaleUp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#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());
|
2021-04-20 09:57:25 +02:00
|
|
|
const PRIntervalTime ticksDuration =
|
|
|
|
PR_MillisecondsToInterval(HEARTBEAT_INTERVAL_MS);
|
2020-12-16 23:40:17 +01:00
|
|
|
options->crashAfterTicks = crashAfterMS / ticksDuration;
|
|
|
|
// Handle systems where ticksDuration is greater than crashAfterMS.
|
|
|
|
if (options->crashAfterTicks == 0) {
|
2021-04-20 09:57:25 +02:00
|
|
|
options->crashAfterTicks = crashAfterMS / HEARTBEAT_INTERVAL_MS;
|
2020-12-16 23:40:17 +01:00
|
|
|
}
|