Bug 697301 - Avoid the compiler making optimizations to mozalloc_abort that end up corrupting stack traces. r=cjones
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 13 Jan 2012 07:24:17 +0100
changeset 84405 9f00bf6379a6a7b30c14906cf56817a6f1cee562
parent 84404 065691d7581cfc7100d6f9a3def53f7229f70126
child 84406 4a9747a88eab2a59133ba877bcc35c0f243e353c
push id21848
push usermak77@bonardo.net
push dateSat, 14 Jan 2012 09:02:20 +0000
treeherdermozilla-central@27a7f197c6fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs697301
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 697301 - Avoid the compiler making optimizations to mozalloc_abort that end up corrupting stack traces. r=cjones
memory/mozalloc/mozalloc_abort.cpp
--- a/memory/mozalloc/mozalloc_abort.cpp
+++ b/memory/mozalloc/mozalloc_abort.cpp
@@ -53,17 +53,19 @@
 #if defined(XP_WIN) || defined(XP_OS2)
 #  define MOZALLOC_EXPORT __declspec(dllexport)
 #endif
 
 #include "mozilla/mozalloc_abort.h"
 
 static int gDummyCounter;
 
-static void
+// Not inlining this function avoids the compiler making optimizations
+// that end up corrupting stack traces.
+MOZ_NEVER_INLINE static void
 TouchBadMemory()
 {
     // XXX this should use the frame poisoning code
     volatile int *p = 0;
     gDummyCounter += *p;   // TODO annotation saying we know 
                            // this is crazy
 }