Monday, November 3, 2008

So Close!

I appears that the enabling of PGO for Thunderbird might be really easy. All I had to due was change the Thunderbird client.mk file to include the profiledbuild option that is available in the Firefox client.mk file.

Thunderbird has a clone of the mozilla-central source which already has PGO enabled for individual modules.

To turn it own all that really happens is the setting of two environment variables.


####################################
# Profile-Guided Optimization
# To use this, you should set the following variables in your mozconfig
# mk_add_options PROFILE_GEN_SCRIPT=/path/to/profile-script
#
# The profile script should exercise the functionality to be included
# in the profile feedback.
#
# This is up here, outside of the MOZ_CURRENT_PROJECT logic so that this
# is usable in multi-pass builds, where you might not have a runnable
# application until all the build passes and postflight scripts have run.
ifdef MOZ_OBJDIR
PGO_OBJDIR = $(MOZ_OBJDIR)
else
PGO_OBJDIR := $(TOPSRCDIR)
endif

profiledbuild::
$(MAKE) -f $(TOPSRCDIR)/client.mk build MOZ_PROFILE_GENERATE=1
OBJDIR=${PGO_OBJDIR} $(PROFILE_GEN_SCRIPT)
$(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
$(MAKE) -f $(TOPSRCDIR)/client.mk build MOZ_PROFILE_USE=1



So the first build has the environment variable MOZ_PROFILE_GENERATE=1 set. This causes a instrumental build to be built. This is used for profiling and gathering performance data. Then a script is run to profile the build. After some clean up it is built again with the performance data included. The environment variable MOZ_PROFILE_USE=1 indicates that.

But alas my build failed. It created the first build and opened Thunderbird but the second build failed. It looks like a compiler error. I have seen the error before but I cannot remember what caused it.

f:\mozilla\thunderbird\mozilla\modules\lcms\src\cmscgats.c(875) : fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\rtm\vctools\compiler\utc\src\P2\main.c[0x10CA10D0:0x00000008]', line 182)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information

LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage

Version 8.00.50727.42

ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 10CA10D0 (10B00000) "f:\Program Files\Microsoft Visual Studio 8\VC\BIN\c2.dll"
NumberParameters = 00000002
ExceptionInformation[ 0] = 00000000
ExceptionInformation[ 1] = 00000008

CONTEXT:
Eax = 00000000 Esp = 0012ED28
Ebx = 00000015 Ebp = 0012ED3C
Ecx = 028DDA01 Esi = 02866060
Edx = 0297AE12 Edi = 00000000
Eip = 10CA10D0 EFlags = 00010246
SegCs = 0000001B SegDs = 00000023
SegSs = 00000023 SegEs = 00000023
SegFs = 0000003B SegGs = 00000000
Dr0 = 00000000 Dr3 = 00000000
Dr1 = 00000000 Dr6 = 00000000
Dr2 = 00000000 Dr7 = 00000000
make[6]: *** [mozlcms.dll] Error 232
make[6]: *** Deleting file `mozlcms.dll'
make[6]: Leaving directory `/i/mozilla/thunderbird/tb-pgo/tb/mozilla/modules/lcms/src'
make[5]: *** [libs] Error 2
make[5]: Leaving directory `/i/mozilla/thunderbird/tb-pgo/tb/mozilla/modules/lcms'
make[4]: *** [libs_tier_external] Error 2
make[4]: Leaving directory `/i/mozilla/thunderbird/tb-pgo/tb/mozilla'
make[3]: *** [tier_external] Error 2
make[3]: Leaving directory `/i/mozilla/thunderbird/tb-pgo/tb/mozilla'
make[2]: *** [default] Error 2
make[2]: Leaving directory `/i/mozilla/thunderbird/tb-pgo/tb/mozilla'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/i/mozilla/thunderbird/tb-pgo/tb'
make: *** [build] Error 2


So close....

No comments: