PGO Related Bugs/Patches

From CDOT Wiki
Jump to: navigation, search

465592

This patch disables the lcms (local color management system) from being optimized if it is not linked into the xul libraray.

diff --git a/modules/lcms/src/Makefile.in b/modules/lcms/src/Makefile.in
--- a/modules/lcms/src/Makefile.in
+++ b/modules/lcms/src/Makefile.in
@@ -57,16 +57,21 @@ endif
 
 ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
 DEFINES	+= -DLCMS_DLL=1 -DLCMS_DLL_BUILD=1
 else
 VISIBILITY_FLAGS =
 endif
 endif
 
+#Disable PGO for this module in non-libxul builds, where it breaks.
+ifndef MOZ_ENABLE_LIBXUL
+NO_PROFILE_GUIDED_OPTIMIZE = 1
+endif
+
 # LCMS is on the critical path, so force it O2 on all platforms
 MODULE_OPTIMIZE_FLAGS=-O2
 
 REQUIRES	= $(LCMS_REQUIRES) \
 		  $(NULL)
 
 CSRCS = cmscnvrt.c cmserr.c cmsgamma.c cmsgmt.c cmsintrp.c cmsio1.c \
 	cmslut.c cmsmatsh.c cmsmtrx.c cmspack.c cmspcs.c cmswtpnt.c \

468285

Patch 1

This patch will stop the deletion of the profiled data.

diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
@@ -44,17 +44,21 @@ include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
 default alldep all::
 	$(RM) -rf $(DIST)/sdk
 	$(RM) -rf $(DIST)/include
 	$(RM) -rf $(DIST)/private
 	$(RM) -rf $(DIST)/public
+# Do not clear this directory if second pass on profiledbuild
+ifndef MOZ_PROFILE_USE
 	$(RM) -rf $(DIST)/bin/components
+endif
+
 	$(RM) -rf _tests
 
 TIERS += base
 
 #
 # tier "base" - basic setup
 #
 tier_base_dirs = \

Patch 2

This patch will merge any profile data into its corresponding program database.

diff --git a/build/win32/pgomerge.py b/build/win32/pgomerge.py
--- a/build/win32/pgomerge.py
+++ b/build/win32/pgomerge.py
@@ -17,24 +17,26 @@ def MergePGOFiles(basename, pgddir, pgcd
      containing basename!N.pgc files, which is probably dist/bin.
      Calls pgomgr to merge each pgc file into the pgd, then deletes
      the pgc files."""
   if not os.path.isdir(pgddir) or not os.path.isdir(pgcdir):
     return
   pgdfile = os.path.abspath(os.path.join(pgddir, basename + ".pgd"))
   if not os.path.isfile(pgdfile):
     return
-  for file in os.listdir(pgcdir):
-    if file.startswith(basename) and file.endswith(".pgc"):
-      try:
-        pgcfile = os.path.normpath(os.path.join(pgcdir, file))
-        subprocess.call(['pgomgr', '-merge',
-                         pgcfile,
-                         pgdfile])
-        os.remove(pgcfile)
-      except OSError:
-        pass
+	for root, dirs, files in os.walk(pgcdir):
+		for dir in dirs:		
+		  for file in os.listdir(dir):
+		    if file.startswith(basename) and file.endswith(".pgc"):
+		      try:
+		        pgcfile = os.path.normpath(os.path.join(pgcdir, file))
+		        subprocess.call(['pgomgr', '-merge',
+		                         pgcfile,
+		                         pgdfile])
+		        os.remove(pgcfile)
+		      except OSError:
+		        pass
 
 if __name__ == '__main__':
   if len(sys.argv) != 3:
       print >>sys.stderr, "Usage: pgomerge.py <binary basename> <dist/bin>"
       sys.exit(1)
   MergePGOFiles(sys.argv[1], os.getcwd(), sys.argv[2])