Bug 684659 - Fix inline asm so that we can drop a use of -fno-omit-frame-pointer.
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Wed, 07 Sep 2011 15:33:48 -0400
changeset 76685 e4c69005dea681639ddcd5857fc95f0d9844ad5b
parent 76684 6b384ab361611b6d1c0c7b8a147f007befa3be0c
child 76686 b1fbce31b7f2f7852600912a081b490bf8c20dda
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
bugs684659
milestone9.0a1
Bug 684659 - Fix inline asm so that we can drop a use of -fno-omit-frame-pointer.
xpcom/reflect/xptcall/src/md/unix/Makefile.in
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp
--- a/xpcom/reflect/xptcall/src/md/unix/Makefile.in
+++ b/xpcom/reflect/xptcall/src/md/unix/Makefile.in
@@ -60,32 +60,16 @@ FORCE_USE_PIC	= 1
 ifeq ($(OS_ARCH),SunOS)
 ifneq (86,$(findstring 86,$(OS_TEST)))
 # disable PGO for this directory with Sun Studio on SPARC because
 # compiling with xprofile=collect will insert code into nsXPTCStubBase::Stub##n
 NO_PROFILE_GUIDED_OPTIMIZE = 1
 endif
 endif
 
-ifeq (Darwin,$(OS_ARCH))
-ifeq (86,$(findstring 86,$(OS_TEST)))
-ifneq (x86_64,$(OS_TEST))
-# If we compile xptcinvoke_unixish_x86.cpp with -fomit-frame-pointer
-# we end up crashing on startup. This is because
-# "movl  %5, %%eax\n\t"   /* function index */
-# becomes
-# mov    0x1c(%esp),%eax
-# but we have modified esp.
-# NOTE: MOZ_FRAMEPTR_FLAGS must be set before including config.mk
-# FIXME: change the file instead of using this hack.
-MOZ_FRAMEPTR_FLAGS=-fno-omit-frame-pointer
-endif
-endif
-endif
-
 include $(topsrcdir)/config/config.mk
 
 ######################################################################
 # i386 and beyond
 ######################################################################
 #
 # Lots of Unixish x86 flavors
 #
--- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp
@@ -73,16 +73,17 @@ invoke_copy_to_stack(PRUint32 paramCount
 
 }
 
 EXPORT_XPCOM_API(nsresult)
 NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
                  PRUint32 paramCount, nsXPTCVariant* params)
 {
 #ifdef __GNUC__            /* Gnu compiler. */
+  PRUint32 methodIndexReg = methodIndex;
   PRUint32 result;
   /* Each param takes at most 2, 4-byte words
      It doesn't matter if we push too many words, and calculating the exact
      amount takes time. */
   PRUint32 n = paramCount << 3;
   void (*fn_copy) (unsigned int, nsXPTCVariant *, PRUint32 *) = invoke_copy_to_stack;
   int temp1, temp2;
  
@@ -160,17 +161,18 @@ NS_InvokeByIndex_P(nsISupports* that, PR
       "=d" (temp2),         /* %2 */
 #ifdef KEEP_STACK_16_BYTE_ALIGNED
       "=&g" (saved_esp)     /* %3 */
 #else
       /* Don't waste a register, this isn't used if alignment is unimportant */
       "=m" (saved_esp)      /* %3 */
 #endif
     : "g" (that),           /* %4 */
-      "g" (methodIndex),    /* %5 */
+      /* Must be in a register since we modify esp in the assembly. */
+      "r" (methodIndexReg), /* %5 */
       "1" (paramCount),     /* %6 */
       "2" (params),         /* %7 */
 #ifdef KEEP_STACK_16_BYTE_ALIGNED
       /* Must be in a register, it's the target of an LEA instruction */
       "r" (n),              /* %8 */
 #else
       "g" (n),              /* %8 */
 #endif