author | Wolfgang Rosenauer <wr@rosenauer.org> |
Sat, 04 Dec 2021 11:19:16 +0100 | |
branch | firefox94 |
changeset 1168 | c384af864671 |
parent 1157 | 57fc0524b50c |
child 1169 | 7481543bab31 |
permissions | -rw-r--r-- |
1152 | 1 |
# HG changeset patch |
2 |
# User Wolfgang Rosenauer <wr@rosenauer.org> |
|
1157 | 3 |
# Parent ed9681bd4359b83145247fb6b01a56a2c84879fd |
1152 | 4 |
|
5 |
diff --git a/build/moz.configure/lto-pgo.configure b/build/moz.configure/lto-pgo.configure |
|
6 |
--- a/build/moz.configure/lto-pgo.configure |
|
7 |
+++ b/build/moz.configure/lto-pgo.configure |
|
1154 | 8 |
@@ -235,23 +235,23 @@ def lto( |
1152 | 9 |
"configure." |
10 |
) |
|
11 |
||
12 |
if c_compiler.type == "clang": |
|
13 |
if len(value) and value[0].lower() == "full": |
|
14 |
cflags.append("-flto") |
|
15 |
ldflags.append("-flto") |
|
16 |
else: |
|
17 |
- cflags.append("-flto=thin") |
|
18 |
- ldflags.append("-flto=thin") |
|
19 |
+ cflags.append("-flto") |
|
20 |
+ ldflags.append("-flto") |
|
21 |
elif c_compiler.type == "clang-cl": |
|
22 |
if len(value) and value[0].lower() == "full": |
|
23 |
cflags.append("-flto") |
|
24 |
else: |
|
25 |
- cflags.append("-flto=thin") |
|
26 |
+ cflags.append("-flto") |
|
27 |
# With clang-cl, -flto can only be used with -c or -fuse-ld=lld. |
|
28 |
# AC_TRY_LINKs during configure don't have -c, so pass -fuse-ld=lld. |
|
29 |
cflags.append("-fuse-ld=lld") |
|
30 |
||
31 |
# Explicitly set the CPU to optimize for so the linker doesn't |
|
32 |
# choose a poor default. Rust compilation by default uses the |
|
33 |
# pentium4 CPU on x86: |
|
34 |
# |
|
35 |
diff --git a/build/pgo/profileserver.py b/build/pgo/profileserver.py |
|
36 |
--- a/build/pgo/profileserver.py |
|
37 |
+++ b/build/pgo/profileserver.py |
|
38 |
@@ -6,17 +6,17 @@ |
|
39 |
||
40 |
import json |
|
41 |
import os |
|
42 |
import sys |
|
43 |
import glob |
|
44 |
import subprocess |
|
45 |
||
46 |
import mozcrash |
|
47 |
-from mozbuild.base import MozbuildObject, BinaryNotFoundException |
|
48 |
+from mozbuild.base import MozbuildObject, BinaryNotFoundException, BuildEnvironmentNotFoundException |
|
49 |
from mozfile import TemporaryDirectory |
|
50 |
from mozhttpd import MozHttpd |
|
51 |
from mozprofile import FirefoxProfile, Preferences |
|
52 |
from mozprofile.permissions import ServerLocations |
|
53 |
from mozrunner import FirefoxRunner, CLI |
|
54 |
from six import string_types |
|
55 |
||
56 |
PORT = 8888 |
|
57 |
@@ -82,19 +82,32 @@ if __name__ == "__main__": |
|
58 |
docroot=os.path.join(build.topsrcdir, "build", "pgo"), |
|
59 |
path_mappings=path_mappings, |
|
60 |
) |
|
61 |
httpd.start(block=False) |
|
62 |
||
63 |
locations = ServerLocations() |
|
64 |
locations.add_host(host="127.0.0.1", port=PORT, options="primary,privileged") |
|
65 |
||
66 |
- old_profraw_files = glob.glob("*.profraw") |
|
67 |
- for f in old_profraw_files: |
|
68 |
- os.remove(f) |
|
69 |
+ using_gcc = False |
|
70 |
+ try: |
|
71 |
+ if build.config_environment.substs.get('CC_TYPE') == 'gcc': |
|
72 |
+ using_gcc = True |
|
73 |
+ except BuildEnvironmentNotFoundException: |
|
74 |
+ pass |
|
75 |
+ |
|
76 |
+ if using_gcc: |
|
77 |
+ for dirpath, _, filenames in os.walk('.'): |
|
78 |
+ for f in filenames: |
|
79 |
+ if f.endswith('.gcda'): |
|
80 |
+ os.remove(os.path.join(dirpath, f)) |
|
81 |
+ else: |
|
82 |
+ old_profraw_files = glob.glob('*.profraw') |
|
83 |
+ for f in old_profraw_files: |
|
84 |
+ os.remove(f) |
|
85 |
||
86 |
with TemporaryDirectory() as profilePath: |
|
87 |
# TODO: refactor this into mozprofile |
|
88 |
profile_data_dir = os.path.join(build.topsrcdir, "testing", "profiles") |
|
89 |
with open(os.path.join(profile_data_dir, "profiles.json"), "r") as fh: |
|
90 |
base_profiles = json.load(fh)["profileserver"] |
|
91 |
||
92 |
prefpaths = [ |
|
93 |
@@ -207,16 +220,20 @@ if __name__ == "__main__": |
|
94 |
||
95 |
# Try to move the crash reports to the artifacts even if Firefox appears |
|
96 |
# to exit successfully, in case there's a crash that doesn't set the |
|
97 |
# return code to non-zero for some reason. |
|
98 |
if get_crashreports(profilePath, name="Firefox exited successfully?") != 0: |
|
99 |
print("Firefox exited successfully, but produced a crashreport") |
|
100 |
sys.exit(1) |
|
101 |
||
102 |
+ print('Copying profile data....') |
|
103 |
+ os.system('pwd'); |
|
104 |
+ os.system('tar cf profdata.tar.gz `find . -name "*.gcda"`; cd ..; tar xf instrumented/profdata.tar.gz;'); |
|
105 |
+ |
|
106 |
llvm_profdata = env.get("LLVM_PROFDATA") |
|
107 |
if llvm_profdata: |
|
108 |
profraw_files = glob.glob("*.profraw") |
|
109 |
if not profraw_files: |
|
110 |
print( |
|
111 |
"Could not find profraw files in the current directory: %s" |
|
112 |
% os.getcwd() |
|
113 |
) |
|
114 |
diff --git a/build/unix/mozconfig.unix b/build/unix/mozconfig.unix |
|
115 |
--- a/build/unix/mozconfig.unix |
|
116 |
+++ b/build/unix/mozconfig.unix |
|
1155
b8c834aafde2
Prepare 87.0 branch based on 86.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
1154
diff
changeset
|
117 |
@@ -1,14 +1,23 @@ |
1152 | 118 |
. "$topsrcdir/build/mozconfig.common" |
119 |
||
120 |
if [ -n "$FORCE_GCC" ]; then |
|
121 |
CC="$MOZ_FETCHES_DIR/gcc/bin/gcc" |
|
122 |
CXX="$MOZ_FETCHES_DIR/gcc/bin/g++" |
|
123 |
||
124 |
+ if [ -n "$MOZ_PGO" ]; then |
|
125 |
+ if [ -z "$USE_ARTIFACT" ]; then |
|
126 |
+ ac_add_options --enable-lto |
|
1155
b8c834aafde2
Prepare 87.0 branch based on 86.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
1154
diff
changeset
|
127 |
+ fi |
b8c834aafde2
Prepare 87.0 branch based on 86.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
1154
diff
changeset
|
128 |
+ export AR="$topsrcdir/gcc/bin/gcc-ar" |
1152 | 129 |
+ export NM="$topsrcdir/gcc/bin/gcc-nm" |
130 |
+ export RANLIB="$topsrcdir/gcc/bin/gcc-ranlib" |
|
131 |
+ fi |
|
132 |
+ |
|
133 |
# We want to make sure we use binutils and other binaries in the tooltool |
|
134 |
# package. |
|
135 |
mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$PATH" |
|
136 |
else |
|
1155
b8c834aafde2
Prepare 87.0 branch based on 86.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
1154
diff
changeset
|
137 |
# For some builds we don't want to have Clang based static-analysis activated |
b8c834aafde2
Prepare 87.0 branch based on 86.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
1154
diff
changeset
|
138 |
if [ -z "$DISABLE_CLANG_PLUGIN" ]; then |
b8c834aafde2
Prepare 87.0 branch based on 86.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
1154
diff
changeset
|
139 |
export ENABLE_CLANG_PLUGIN=1 |
b8c834aafde2
Prepare 87.0 branch based on 86.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
1154
diff
changeset
|
140 |
fi |
1152 | 141 |
diff --git a/extensions/spellcheck/src/moz.build b/extensions/spellcheck/src/moz.build |
142 |
--- a/extensions/spellcheck/src/moz.build |
|
143 |
+++ b/extensions/spellcheck/src/moz.build |
|
144 |
@@ -26,8 +26,10 @@ LOCAL_INCLUDES += [ |
|
145 |
] |
|
146 |
EXPORTS.mozilla += [ |
|
147 |
"mozInlineSpellChecker.h", |
|
148 |
"mozSpellChecker.h", |
|
149 |
] |
|
150 |
||
151 |
if CONFIG["CC_TYPE"] in ("clang", "gcc"): |
|
152 |
CXXFLAGS += ["-Wno-error=shadow"] |
|
153 |
+ |
|
154 |
+CXXFLAGS += ['-fno-devirtualize'] |
|
155 |
diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp |
|
156 |
--- a/toolkit/components/terminator/nsTerminator.cpp |
|
157 |
+++ b/toolkit/components/terminator/nsTerminator.cpp |
|
1157 | 158 |
@@ -451,16 +451,21 @@ void nsTerminator::StartWatchdog() { |
1152 | 159 |
// Defend against overflow |
160 |
crashAfterMS = INT32_MAX; |
|
161 |
} else { |
|
162 |
crashAfterMS *= scaleUp; |
|
163 |
} |
|
164 |
} |
|
165 |
#endif |
|
166 |
||
167 |
+ // Disable watchdog for PGO train builds - writting profile information at |
|
168 |
+ // exit may take time and it is better to make build hang rather than |
|
169 |
+ // silently produce poorly performing binary. |
|
170 |
+ crashAfterMS = INT32_MAX; |
|
171 |
+ |
|
172 |
UniquePtr<Options> options(new Options()); |
|
1157 | 173 |
const PRIntervalTime ticksDuration = |
174 |
PR_MillisecondsToInterval(HEARTBEAT_INTERVAL_MS); |
|
1152 | 175 |
options->crashAfterTicks = crashAfterMS / ticksDuration; |
176 |
// Handle systems where ticksDuration is greater than crashAfterMS. |
|
177 |
if (options->crashAfterTicks == 0) { |
|
1157 | 178 |
options->crashAfterTicks = crashAfterMS / HEARTBEAT_INTERVAL_MS; |
1152 | 179 |
} |