summaryrefslogtreecommitdiff
path: root/waterfox/mozilla-1516081.patch
blob: b9a6ec66d6d06c56600413b9ea48dd351ece1169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From f652a5490a2fb0774f21a5c5bfd48f0ef40c412c Mon Sep 17 00:00:00 2001
From: Phantom X <PhantomX@users.noreply.github.com>
Date: Fri, 20 Aug 2021 19:33:56 -0300
Subject: [PATCH] Mozilla 1516081 rebase for Waterfox

---
 build/moz.configure/toolchain.configure        | 4 ++--
 nsprpub/configure.in                           | 4 ++--
 toolkit/components/terminator/nsTerminator.cpp | 7 +++++++
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
index 98b1ee6..2b889d7 100755
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1157,10 +1157,10 @@ set_config('VISIBILITY_FLAGS', visibility_flags)
 def pgo_flags(compiler):
     if compiler.type in ('gcc', 'clang'):
         return namespace(
-            gen_cflags=['-fprofile-generate'],
+            gen_cflags=['-fprofile-generate', '-DMOZ_PROFILE_INSTRUMENTATION'],
             gen_ldflags=['-fprofile-generate'],
             use_cflags=['-fprofile-use', '-fprofile-correction',
-                        '-Wcoverage-mismatch'],
+                        '-Wcoverage-mismatch', '-DMOZ_PROFILE_INSTRUMENTATION'],
             use_ldflags=['-fprofile-use'],
         )
 
diff --git a/nsprpub/configure.in b/nsprpub/configure.in
index b82dfa5..de8d88f 100644
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -740,7 +740,7 @@ dnl Test for profiling options
 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
 
 _SAVE_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
+CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction -DMOZ_PROFILE_INSTRUMENTATION"
 
 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
 AC_TRY_COMPILE([], [return 0;],
@@ -750,7 +750,7 @@ AC_MSG_RESULT([$result])
 
 if test $result = "yes"; then
    PROFILE_GEN_LDFLAGS="-fprofile-generate"
-   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
+   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -DMOZ_PROFILE_INSTRUMENTATION"
    PROFILE_USE_LDFLAGS="-fprofile-use"
 fi
 
diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp
index e72335f..eb70f15 100644
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -389,6 +389,13 @@ nsTerminator::StartWatchdog()
     crashAfterMS += ADDITIONAL_WAIT_BEFORE_CRASH_MS;
   }
 
+  // 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.
+#ifdef MOZ_PROFILE_INSTRUMENTATION
+  crashAfterMS = INT32_MAX;
+#endif
+
   UniquePtr<Options> options(new Options());
   const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000);
   options->crashAfterTicks = crashAfterMS / ticksDuration;
-- 
2.31.1

bgstack15