Bug 1456382 - LUL: Convert mAdminThreadId check to MOZ_RELEASE_ASSERT. r=njn.

LUL::mAdminThreadId is used only to assert that certain calls into the LUL
object are made on the correct thread.  Because those assertions are done
using MOZ_ASSERT, some compilers spot that LUL::mAdminThreadId is unused in
non-debug builds, emit a warning to that effect, and then cause the build to
fail due to the presence of -Werror.

Given that (1) it's unlikely that people will use the profiler in debug
builds, (2) failure of these assertions is likely to lead to deadlocking or
crashing in the profiler, and (3) they don't occur on high-frequency paths,
a good solution seems to be to convert them to MOZ_RELEASE_ASSERTs, hence
causing LUL::mAdminThreadId to be used in even in non-debug builds.

In some cases, related MOZ_ASSERTs relating to LUL::mAdminMode have also
been upgraded to MOZ_RELEASE_ASSERTs, for consistency with the
LUL::mAdminThreadId changes.

--HG--
extra : rebase_source : 554a31060a828db01246ece6d1e3afbcc0b42cd2
This commit is contained in:
Julian Seward 2018-04-26 19:08:23 +02:00
parent 1cbc813260
commit 5c0c6834f5

View File

@ -743,7 +743,7 @@ LUL::EnableUnwinding()
LUL_LOG("LUL::EnableUnwinding");
// Don't assert for Admin mode here. That is, tolerate a call here
// if we are already in Unwinding mode.
MOZ_ASSERT(gettid() == mAdminThreadId);
MOZ_RELEASE_ASSERT(gettid() == mAdminThreadId);
mAdminMode = false;
}
@ -753,8 +753,8 @@ void
LUL::NotifyAfterMap(uintptr_t aRXavma, size_t aSize,
const char* aFileName, const void* aMappedImage)
{
MOZ_ASSERT(mAdminMode);
MOZ_ASSERT(gettid() == mAdminThreadId);
MOZ_RELEASE_ASSERT(mAdminMode);
MOZ_RELEASE_ASSERT(gettid() == mAdminThreadId);
mLog(":\n");
char buf[200];
@ -804,8 +804,8 @@ LUL::NotifyAfterMap(uintptr_t aRXavma, size_t aSize,
void
LUL::NotifyExecutableArea(uintptr_t aRXavma, size_t aSize)
{
MOZ_ASSERT(mAdminMode);
MOZ_ASSERT(gettid() == mAdminThreadId);
MOZ_RELEASE_ASSERT(mAdminMode);
MOZ_RELEASE_ASSERT(gettid() == mAdminThreadId);
mLog(":\n");
char buf[200];
@ -826,8 +826,8 @@ LUL::NotifyExecutableArea(uintptr_t aRXavma, size_t aSize)
void
LUL::NotifyBeforeUnmap(uintptr_t aRXavmaMin, uintptr_t aRXavmaMax)
{
MOZ_ASSERT(mAdminMode);
MOZ_ASSERT(gettid() == mAdminThreadId);
MOZ_RELEASE_ASSERT(mAdminMode);
MOZ_RELEASE_ASSERT(gettid() == mAdminThreadId);
mLog(":\n");
char buf[100];
@ -857,8 +857,8 @@ LUL::NotifyBeforeUnmap(uintptr_t aRXavmaMin, uintptr_t aRXavmaMax)
size_t
LUL::CountMappings()
{
MOZ_ASSERT(mAdminMode);
MOZ_ASSERT(gettid() == mAdminThreadId);
MOZ_RELEASE_ASSERT(mAdminMode);
MOZ_RELEASE_ASSERT(gettid() == mAdminThreadId);
return mPriMap->CountSecMaps();
}
@ -1178,7 +1178,7 @@ LUL::Unwind(/*OUT*/uintptr_t* aFramePCs,
size_t aFramesAvail,
UnwindRegs* aStartRegs, StackImage* aStackImg)
{
MOZ_ASSERT(!mAdminMode);
MOZ_RELEASE_ASSERT(!mAdminMode);
/////////////////////////////////////////////////////////
// BEGIN UNWIND