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