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 85630 9f00bf6379a6a7b30c14906cf56817a6f1cee562
parent 85629 065691d7581cfc7100d6f9a3def53f7229f70126
child 85631 4a9747a88eab2a59133ba877bcc35c0f243e353c
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs697301
milestone12.0a1
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
 }