Bug 1049068 - Part 5: Remove unused CallStack params. r=froydnj
authorEric Rahm <erahm@mozilla.com>
Fri, 08 Aug 2014 11:43:58 -0700
changeset 198708 6304d8304aa202ed92ed4a3409a9b83fd6060e46
parent 198707 07dadb9729e12c549ea21d908ca38b7822cd5377
child 198709 2a6b54520530f7151df9627a8d8673cbf7044c24
push id27284
push userryanvm@gmail.com
push dateSat, 09 Aug 2014 15:25:31 +0000
treeherdermozilla-central@ad8cb646fad6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1049068
milestone34.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 1049068 - Part 5: Remove unused CallStack params. r=froydnj
storage/src/SQLiteMutex.h
xpcom/glue/BlockingResourceBase.cpp
xpcom/glue/BlockingResourceBase.h
xpcom/glue/DeadlockDetector.h
--- a/storage/src/SQLiteMutex.h
+++ b/storage/src/SQLiteMutex.h
@@ -83,21 +83,20 @@ public:
 
 #else
   void lock()
   {
     NS_ASSERTION(mMutex, "No mutex associated with this wrapper!");
 
     // While SQLite Mutexes may be recursive, in our own code we do not want to
     // treat them as such.
-    CallStack callContext = CallStack();
 
-    CheckAcquire(callContext);
+    CheckAcquire();
     sqlite3_mutex_enter(mMutex);
-    Acquire(callContext); // Call is protected by us holding the mutex.
+    Acquire(); // Call is protected by us holding the mutex.
   }
 
   void unlock()
   {
     NS_ASSERTION(mMutex, "No mutex associated with this wrapper!");
 
     // While SQLite Mutexes may be recursive, in our own code we do not want to
     // treat them as such.
--- a/xpcom/glue/BlockingResourceBase.cpp
+++ b/xpcom/glue/BlockingResourceBase.cpp
@@ -84,28 +84,28 @@ BlockingResourceBase::~BlockingResourceB
   // stupid mistakes.
   mChainPrev = 0;             // racy only for stupidly buggy client code
   sDeadlockDetector->Remove(mDDEntry);
   mDDEntry = 0;               // owned by deadlock detector
 }
 
 
 void
-BlockingResourceBase::CheckAcquire(const CallStack& aCallContext)
+BlockingResourceBase::CheckAcquire()
 {
   if (mDDEntry->mType == eCondVar) {
     NS_NOTYETIMPLEMENTED(
       "FIXME bug 456272: annots. to allow CheckAcquire()ing condvars");
     return;
   }
 
   BlockingResourceBase* chainFront = ResourceChainFront();
   nsAutoPtr<DDT::ResourceAcquisitionArray> cycle(
     sDeadlockDetector->CheckAcquisition(
-      chainFront ? chainFront->mDDEntry : 0, mDDEntry, aCallContext));
+      chainFront ? chainFront->mDDEntry : 0, mDDEntry));
   if (!cycle) {
     return;
   }
 
   fputs("###!!! ERROR: Potential deadlock detected:\n", stderr);
   nsAutoCString out("Potential deadlock detected:\n");
   bool maybeImminent = PrintCycle(cycle, out);
 
@@ -122,17 +122,17 @@ BlockingResourceBase::CheckAcquire(const
   // XXX about to happen.  for example:
   // XXX   if (maybeImminent)
   //           NS_RUNTIMEABORT(out.get());
   NS_ERROR(out.get());
 }
 
 
 void
-BlockingResourceBase::Acquire(const CallStack& aCallContext)
+BlockingResourceBase::Acquire()
 {
   if (mDDEntry->mType == eCondVar) {
     NS_NOTYETIMPLEMENTED(
       "FIXME bug 456272: annots. to allow Acquire()ing condvars");
     return;
   }
   NS_ASSERTION(!mDDEntry->mAcquired,
                "reacquiring already acquired resource");
@@ -214,21 +214,19 @@ BlockingResourceBase::PrintCycle(const D
 }
 
 
 //
 // Debug implementation of (OffTheBooks)Mutex
 void
 OffTheBooksMutex::Lock()
 {
-  CallStack callContext = CallStack();
-
-  CheckAcquire(callContext);
+  CheckAcquire();
   PR_Lock(mLock);
-  Acquire(callContext);       // protected by mLock
+  Acquire();       // protected by mLock
 }
 
 void
 OffTheBooksMutex::Unlock()
 {
   Release();                  // protected by mLock
   PRStatus status = PR_Unlock(mLock);
   NS_ASSERTION(PR_SUCCESS == status, "bad Mutex::Unlock()");
@@ -246,44 +244,42 @@ ReentrantMonitor::Enter()
 
   if (this == chainFront) {
     // immediately re-entered the monitor: acceptable
     PR_EnterMonitor(mReentrantMonitor);
     ++mEntryCount;
     return;
   }
 
-  CallStack callContext = CallStack();
-
   // this is sort of a hack around not recording the thread that
   // owns this monitor
   if (chainFront) {
     for (BlockingResourceBase* br = ResourceChainPrev(chainFront);
          br;
          br = ResourceChainPrev(br)) {
       if (br == this) {
         NS_WARNING(
           "Re-entering ReentrantMonitor after acquiring other resources.\n"
           "At calling context\n"
           "  [stack trace unavailable]\n");
 
         // show the caller why this is potentially bad
-        CheckAcquire(callContext);
+        CheckAcquire();
 
         PR_EnterMonitor(mReentrantMonitor);
         ++mEntryCount;
         return;
       }
     }
   }
 
-  CheckAcquire(callContext);
+  CheckAcquire();
   PR_EnterMonitor(mReentrantMonitor);
   NS_ASSERTION(mEntryCount == 0, "ReentrantMonitor isn't free!");
-  Acquire(callContext);       // protected by mReentrantMonitor
+  Acquire();       // protected by mReentrantMonitor
   mEntryCount = 1;
 }
 
 void
 ReentrantMonitor::Exit()
 {
   if (--mEntryCount == 0) {
     Release();              // protected by mReentrantMonitor
--- a/xpcom/glue/BlockingResourceBase.h
+++ b/xpcom/glue/BlockingResourceBase.h
@@ -150,31 +150,25 @@ protected:
   BlockingResourceBase(const char* aName, BlockingResourceType aType);
 
   ~BlockingResourceBase();
 
   /**
    * CheckAcquire
    *
    * Thread safe.
-   *
-   * @param aCallContext the client's calling context from which the
-   *        original acquisition request was made.
    **/
-  void CheckAcquire(const CallStack& aCallContext);
+  void CheckAcquire();
 
   /**
    * Acquire
    *
    * *NOT* thread safe.  Requires ownership of underlying resource.
-   *
-   * @param aCallContext the client's calling context from which the
-   *        original acquisition request was made.
    **/
-  void Acquire(const CallStack& aCallContext); //NS_NEEDS_RESOURCE(this)
+  void Acquire(); //NS_NEEDS_RESOURCE(this)
 
   /**
    * Release
    * Remove this resource from the current thread's acquisition chain.
    * The resource does not have to be at the front of the chain, although
    * it is confusing to release resources in a different order than they
    * are acquired.  This generates a warning.
    *
--- a/xpcom/glue/DeadlockDetector.h
+++ b/xpcom/glue/DeadlockDetector.h
@@ -293,17 +293,17 @@ public:
 
     // Now the entry can be safely removed.
     mOrdering.Remove(aResource);
     delete aResource;
   }
 
   /**
    * CheckAcquisition This method is called after acquiring |aLast|,
-   * but before trying to acquire |aProposed| from |aCallContext|.
+   * but before trying to acquire |aProposed|.
    * It determines whether actually trying to acquire |aProposed|
    * will create problems.  It is OK if |aLast| is nullptr; this is
    * interpreted as |aProposed| being the thread's first acquisition
    * of its current chain.
    *
    * Iff acquiring |aProposed| may lead to deadlock for some thread
    * interleaving (including the current one!), the cyclical
    * dependency from which this was deduced is returned.  Otherwise,
@@ -311,21 +311,19 @@ public:
    *
    * If a potential deadlock is detected and a resource cycle is
    * returned, it is the *caller's* responsibility to free it.
    *
    * Thread safe.
    *
    * @param aLast Last resource acquired by calling thread (or 0).
    * @param aProposed Resource calling thread proposes to acquire.
-   * @param aCallContext Calling context whence acquisiton request came.
    */
   ResourceAcquisitionArray* CheckAcquisition(const T* aLast,
-                                             const T* aProposed,
-                                             const CallStack& aCallContext)
+                                             const T* aProposed)
   {
     if (!aLast) {
       // don't check if |0 < aProposed|; just vamoose
       return 0;
     }
 
     NS_ASSERTION(aProposed, "null resource");
     PRAutoLock _(mLock);