Bug 1411786 - Rename chunk recycling-related globals. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 26 Oct 2017 09:43:43 +0900
changeset 686647 edebf42d73d0e7367d6cc56a03e0ff31bcc913c9
parent 686646 9ac16f7e3e9eb1cc600edf0bd2f0581e58e46576
child 686648 6a3e1d1984081fbda11e9225ab74ec798537a63e
push id86234
push userbmo:mh+mozilla@glandium.org
push dateThu, 26 Oct 2017 05:06:52 +0000
reviewersnjn
bugs1411786
milestone58.0a1
Bug 1411786 - Rename chunk recycling-related globals. r?njn
memory/build/mozjemalloc.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -475,20 +475,20 @@ static size_t arena_maxclass; /* Max siz
 #endif
 
 /*
  * Recycle at most 128 chunks. With 1 MiB chunks, this means we retain at most
  * 6.25% of the process address space on a 32-bit OS for later use.
  */
 #define CHUNK_RECYCLE_LIMIT 128
 
-static const size_t recycle_limit = CHUNK_RECYCLE_LIMIT * CHUNKSIZE_DEFAULT;
+static const size_t gRecycleLimit = CHUNK_RECYCLE_LIMIT * CHUNKSIZE_DEFAULT;
 
 /* The current amount of recycled bytes, updated atomically. */
-static size_t recycled_size;
+static size_t gRecycledSize;
 
 /******************************************************************************/
 
 /* MALLOC_DECOMMIT and MALLOC_DOUBLE_PURGE are mutually exclusive. */
 #if defined(MALLOC_DECOMMIT) && defined(MALLOC_DOUBLE_PURGE)
 #error MALLOC_DECOMMIT and MALLOC_DOUBLE_PURGE are mutually exclusive.
 #endif
 
@@ -1992,17 +1992,17 @@ chunk_recycle(size_t aSize, size_t aAlig
     node->addr = (void*)((uintptr_t)(ret) + aSize);
     node->size = trailsize;
     node->chunk_type = chunk_type;
     gChunksBySize.Insert(node);
     gChunksByAddress.Insert(node);
     node = nullptr;
   }
 
-  recycled_size -= aSize;
+  gRecycledSize -= aSize;
 
   chunks_mtx.Unlock();
 
   if (node) {
     base_node_dealloc(node);
   }
 #ifdef MALLOC_DECOMMIT
   pages_commit(ret, aSize);
@@ -2159,34 +2159,34 @@ chunk_record(void* aChunk, size_t aSize,
     if (node->chunk_type != prev->chunk_type) {
       node->chunk_type = RECYCLED_CHUNK;
     }
     gChunksBySize.Insert(node);
 
     xprev.reset(prev);
   }
 
-  recycled_size += aSize;
+  gRecycledSize += aSize;
 }
 
 static void
 chunk_dealloc(void* aChunk, size_t aSize, ChunkType aType)
 {
   MOZ_ASSERT(aChunk);
   MOZ_ASSERT(CHUNK_ADDR2BASE(aChunk) == aChunk);
   MOZ_ASSERT(aSize != 0);
   MOZ_ASSERT((aSize & chunksize_mask) == 0);
 
   gChunkRTree.Unset(aChunk);
 
   if (CAN_RECYCLE(aSize)) {
-    size_t recycled_so_far = load_acquire_z(&recycled_size);
+    size_t recycled_so_far = load_acquire_z(&gRecycledSize);
     // In case some race condition put us above the limit.
-    if (recycled_so_far < recycle_limit) {
-      size_t recycle_remaining = recycle_limit - recycled_so_far;
+    if (recycled_so_far < gRecycleLimit) {
+      size_t recycle_remaining = gRecycleLimit - recycled_so_far;
       size_t to_recycle;
       if (aSize > recycle_remaining) {
         to_recycle = recycle_remaining;
         // Drop pages that would overflow the recycle limit
         pages_trim(aChunk, aSize, 0, to_recycle);
       } else {
         to_recycle = aSize;
       }
@@ -4331,17 +4331,17 @@ MALLOC_OUT:
   nsbins = pagesize_2pow - SMALL_MAX_2POW_DEFAULT - 1;
 
   chunk_npages = (chunksize >> pagesize_2pow);
 
   arena_chunk_header_npages = calculate_arena_header_pages();
   arena_maxclass = calculate_arena_maxclass();
 #endif
 
-  recycled_size = 0;
+  gRecycledSize = 0;
 
   /* Various sanity checks that regard configuration. */
   MOZ_ASSERT(quantum >= sizeof(void *));
   MOZ_ASSERT(quantum <= pagesize);
   MOZ_ASSERT(chunksize >= pagesize);
   MOZ_ASSERT(quantum * 4 <= chunksize);
 
   /* Initialize chunks data. */