Backed out changeset 8d8165293e9b (bug 976372) because of Windows debug bustage on a CLOSED TREE
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 24 Feb 2014 23:01:54 -0500
changeset 187502 22d6c5982c53e12468379372280d5695781e9462
parent 187501 12661b7737d42db4edf9f172929c52611bb79a28
child 187503 653d606f540c05dad380f2dc4bc0d39cc88b69ea
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs976372
milestone30.0a1
backs out8d8165293e9b34761a1517f7904488742d47dcd8
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
Backed out changeset 8d8165293e9b (bug 976372) because of Windows debug bustage on a CLOSED TREE
configure.in
js/src/configure.in
xpcom/base/nsTraceRefcntImpl.cpp
xpcom/xpcom-config.h.in
--- a/configure.in
+++ b/configure.in
@@ -3184,16 +3184,40 @@ AC_CACHE_CHECK(whether the C++ \"using\"
                                };,
                                X x; Y y; y.jo(x);,
                                ac_cv_cpp_ambiguity_resolving_using=yes,
                                ac_cv_cpp_ambiguity_resolving_using=no)])
 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
 fi
 
+dnl See if a dynamic_cast to void* gives the most derived object.
+AC_CACHE_CHECK(for C++ dynamic_cast to void*,
+               ac_cv_cpp_dynamic_cast_void_ptr,
+               [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
+                            class Y { int j; public: virtual ~Y() { } };
+                            class Z : public X, public Y { int k; };
+
+                            int main() {
+                                 Z mdo;
+                                 X *subx = (X*)&mdo;
+                                 Y *suby = (Y*)&mdo;
+                                 return !((((void*)&mdo != (void*)subx) &&
+                                           ((void*)&mdo == dynamic_cast<void*>(subx))) ||
+                                          (((void*)&mdo != (void*)suby) &&
+                                           ((void*)&mdo == dynamic_cast<void*>(suby))));
+                            }],
+                           ac_cv_cpp_dynamic_cast_void_ptr=yes,
+                           ac_cv_cpp_dynamic_cast_void_ptr=no,
+                           ac_cv_cpp_dynamic_cast_void_ptr=no)])
+if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
+   AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
+fi
+
+
 dnl note that this one is reversed - if the test fails, then
 dnl we require implementations of unused virtual methods. Which
 dnl really blows because it means we'll have useless vtable
 dnl bloat.
 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
                ac_cv_cpp_unused_required,
                [AC_TRY_LINK(class X {private: virtual void never_called();};,
                                X x;,
@@ -8713,16 +8737,17 @@ AC_SUBST(ac_configure_args)
 
 dnl Spit out some output
 dnl ========================================================
 
 dnl The following defines are used by xpcom
 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
 CPP_THROW_NEW
 HAVE_CPP_AMBIGUITY_RESOLVING_USING
+HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
 HAVE_CPP_PARTIAL_SPECIALIZATION
 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
 NEED_CPP_UNUSED_IMPLEMENTATIONS
 HAVE_GETPAGESIZE
 HAVE_ICONV
 HAVE_ICONV_WITH_CONST_INPUT
 HAVE_MBRTOWC
 HAVE_WCRTOMB
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2583,16 +2583,40 @@ AC_CACHE_CHECK(whether the C++ \"using\"
                                };,
                                X x; Y y; y.jo(x);,
                                ac_cv_cpp_ambiguity_resolving_using=yes,
                                ac_cv_cpp_ambiguity_resolving_using=no)])
 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
 fi
 
+dnl See if a dynamic_cast to void* gives the most derived object.
+AC_CACHE_CHECK(for C++ dynamic_cast to void*,
+               ac_cv_cpp_dynamic_cast_void_ptr,
+               [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
+                            class Y { int j; public: virtual ~Y() { } };
+                            class Z : public X, public Y { int k; };
+
+                            int main() {
+                                 Z mdo;
+                                 X *subx = (X*)&mdo;
+                                 Y *suby = (Y*)&mdo;
+                                 return !((((void*)&mdo != (void*)subx) &&
+                                           ((void*)&mdo == dynamic_cast<void*>(subx))) ||
+                                          (((void*)&mdo != (void*)suby) &&
+                                           ((void*)&mdo == dynamic_cast<void*>(suby))));
+                            }],
+                           ac_cv_cpp_dynamic_cast_void_ptr=yes,
+                           ac_cv_cpp_dynamic_cast_void_ptr=no,
+                           ac_cv_cpp_dynamic_cast_void_ptr=no)])
+if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
+   AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
+fi
+
+
 dnl note that this one is reversed - if the test fails, then
 dnl we require implementations of unused virtual methods. Which
 dnl really blows because it means we'll have useless vtable
 dnl bloat.
 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
                ac_cv_cpp_unused_required,
                [AC_TRY_LINK(class X {private: virtual void never_called();};,
                                X x;,
--- a/xpcom/base/nsTraceRefcntImpl.cpp
+++ b/xpcom/base/nsTraceRefcntImpl.cpp
@@ -442,22 +442,30 @@ GetBloatEntry(const char* aTypeName, uin
     }
   }
   return entry;
 }
 
 static int DumpSerialNumbers(PLHashEntry* aHashEntry, int aIndex, void* aClosure)
 {
   serialNumberRecord* record = reinterpret_cast<serialNumberRecord *>(aHashEntry->value);
+#ifdef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
   fprintf((FILE*) aClosure, "%" PRIdPTR
                             " @%p (%d references; %d from COMPtrs)\n",
                             record->serialNumber,
                             NS_INT32_TO_PTR(aHashEntry->key),
                             record->refCount,
                             record->COMPtrCount);
+#else
+  fprintf((FILE*) aClosure, "%" PRIdPTR
+                            " @%p (%d references)\n",
+                            record->serialNumber,
+                            NS_INT32_TO_PTR(aHashEntry->key),
+                            record->refCount);
+#endif
   return HT_ENUMERATE_NEXT;
 }
 
 
 template <>
 class nsDefaultComparator <BloatEntry*, BloatEntry*> {
   public:
     bool Equals(BloatEntry* const& aA, BloatEntry* const& aB) const {
@@ -577,17 +585,17 @@ static int32_t* GetRefCount(void* aPtr)
   PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
   if (hep && *hep) {
     return &((reinterpret_cast<serialNumberRecord*>((*hep)->value))->refCount);
   } else {
     return nullptr;
   }
 }
 
-#if defined(NS_IMPL_REFCNT_LOGGING)
+#if defined(NS_IMPL_REFCNT_LOGGING) && defined(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
 static int32_t* GetCOMPtrCount(void* aPtr)
 {
   PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
   if (hep && *hep) {
     return &((reinterpret_cast<serialNumberRecord*>((*hep)->value))->COMPtrCount);
   } else {
     return nullptr;
   }
@@ -712,23 +720,30 @@ static void InitTraceLog(void)
       gLogToLeaky = false;
       fprintf(stdout, "### ERROR: XPCOM_MEM_LEAKY_LOG defined, but can't locate __log_addref and __log_release symbols\n");
       fflush(stdout);
     }
   }
 
   const char* classes = getenv("XPCOM_MEM_LOG_CLASSES");
 
+#ifdef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
   if (classes) {
     (void)InitLog("XPCOM_MEM_COMPTR_LOG", "nsCOMPtr", &gCOMPtrLog);
   } else {
     if (getenv("XPCOM_MEM_COMPTR_LOG")) {
       fprintf(stdout, "### XPCOM_MEM_COMPTR_LOG defined -- but XPCOM_MEM_LOG_CLASSES is not defined\n");
     }
   }
+#else
+  const char* comptr_log = getenv("XPCOM_MEM_COMPTR_LOG");
+  if (comptr_log) {
+    fprintf(stdout, "### XPCOM_MEM_COMPTR_LOG defined -- but it will not work without dynamic_cast\n");
+  }
+#endif
 
   if (classes) {
     // if XPCOM_MEM_LOG_CLASSES was set to some value, the value is interpreted
     // as a list of class names to track
     gTypesToLog = PL_NewHashTable(256,
                                   PL_HashString,
                                   PL_CompareStrings,
                                   PL_CompareValues,
@@ -1145,17 +1160,17 @@ NS_LogDtor(void* aPtr, const char* aType
   }
 #endif
 }
 
 
 EXPORT_XPCOM_API(void)
 NS_LogCOMPtrAddRef(void* aCOMPtr, nsISupports* aObject)
 {
-#if defined(NS_IMPL_REFCNT_LOGGING)
+#if defined(NS_IMPL_REFCNT_LOGGING) && defined(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
   // Get the most-derived object.
   void *object = dynamic_cast<void *>(aObject);
 
   // This is a very indirect way of finding out what the class is
   // of the object being logged.  If we're logging a specific type,
   // then
   if (!gTypesToLog || !gSerialNumbers) {
     return;
@@ -1186,17 +1201,17 @@ NS_LogCOMPtrAddRef(void* aCOMPtr, nsISup
   }
 #endif
 }
 
 
 EXPORT_XPCOM_API(void)
 NS_LogCOMPtrRelease(void* aCOMPtr, nsISupports* aObject)
 {
-#if defined(NS_IMPL_REFCNT_LOGGING)
+#if defined(NS_IMPL_REFCNT_LOGGING) && defined(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
   // Get the most-derived object.
   void *object = dynamic_cast<void *>(aObject);
 
   // This is a very indirect way of finding out what the class is
   // of the object being logged.  If we're logging a specific type,
   // then
   if (!gTypesToLog || !gSerialNumbers) {
     return;
--- a/xpcom/xpcom-config.h.in
+++ b/xpcom/xpcom-config.h.in
@@ -10,16 +10,19 @@
 /* Define this to throw() if the compiler complains about 
  * constructors returning NULL
  */
 #undef CPP_THROW_NEW
 
 /* Define if the c++ compiler can resolve ambiguity with |using| */
 #undef HAVE_CPP_AMBIGUITY_RESOLVING_USING
 
+/* Define if a dyanmic_cast to void* gives the most derived object */
+#undef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
+
 /* Define if the c++ compiler has trouble comparing a constant
  * reference to a templatized class to zero
  */
 #undef HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
 
 /* Define if the c++ compiler requires implementations of 
  * unused virtual methods
  */