Bug 1594598 - Improve some PHC comments. r=glandium
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 06 Nov 2019 23:56:48 +0000
changeset 501023 ba5dde550477b6902efd0185b33bf9dd22bba06d
parent 501022 f17d8e2af670fb037e668575e1813702c3e25eee
child 501024 ec3308aa7246d40c57b9b1da9194ef461ee9c52e
push id99937
push usernnethercote@mozilla.com
push dateThu, 07 Nov 2019 00:37:00 +0000
treeherderautoland@ec3308aa7246 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1594598
milestone72.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 1594598 - Improve some PHC comments. r=glandium Differential Revision: https://phabricator.services.mozilla.com/D43838
memory/replace/phc/PHC.cpp
memory/replace/phc/PHC.h
--- a/memory/replace/phc/PHC.cpp
+++ b/memory/replace/phc/PHC.cpp
@@ -527,35 +527,31 @@ class GMut {
     // to allocate the 8192 bytes in the correct arena, and to do that, it must
     // call sMallocTable.moz_arena_malloc with the correct arenaId under the
     // covers. Therefore it must record that arenaId.
     //
     // This field is also needed for jemalloc_ptr_info() to work, because it
     // also returns the arena ID (but only in debug builds).
     //
     // - NeverAllocated: must be 0.
-    // - InUse: can be any valid arena ID value.
-    // - Freed: can be any valid arena ID value.
+    // - InUse | Freed: can be any valid arena ID value.
     Maybe<arena_id_t> mArenaId;
 
     // The usable size, which could be bigger than the requested size.
     // - NeverAllocated: must be 0.
-    // - InUse: must be > 0.
-    // - Freed: must be > 0.
+    // - InUse | Freed: must be > 0.
     size_t mUsableSize;
 
     // The allocation stack.
     // - NeverAllocated: Nothing.
-    // - InUse: Some.
-    // - Freed: Some.
+    // - InUse | Freed: Some.
     Maybe<StackTrace> mAllocStack;
 
     // The free stack.
-    // - NeverAllocated: Nothing.
-    // - InUse: Some.
+    // - NeverAllocated | InUse: Nothing.
     // - Freed: Some.
     Maybe<StackTrace> mFreeStack;
 
     // The time at which the page is available for reuse, as measured against
     // GAtomic::sNow. When the page is in use this value will be kMaxTime.
     // - NeverAllocated: must be 0.
     // - InUse: must be kMaxTime.
     // - Freed: must be > 0 and < kMaxTime.
--- a/memory/replace/phc/PHC.h
+++ b/memory/replace/phc/PHC.h
@@ -58,27 +58,37 @@ class AddrInfo {
     // address most likely indicates a buffer overflow. (Again, a sufficiently
     // wild write could unluckily trigger it, but this is less likely.)
     //
     // NOTE: guard pages are not yet implemented. This value is present so they
     // can be added easily in the future.
     GuardPage = 4,
   };
 
+  // The page kind.
   Kind mKind;
 
-  // The base address of the containing PHC allocation, if there is one.
+  // The starting address of the allocation.
+  // - Unknown | NeverAllocatedPage: nullptr.
+  // - InUsePage | FreedPage: the address of the allocation within the page.
   const void* mBaseAddr;
 
-  // The usable size of the containing PHC allocation, if there is one.
+  // The usable size, which could be bigger than the requested size.
+  // - Unknown | NeverAllocatePage: 0.
+  // - InUsePage | FreedPage: the usable size of the allocation within the page.
   size_t mUsableSize;
 
-  // The allocation and free stack traces of the containing PHC allocation, if
-  // there is one.
+  // The allocation stack.
+  // - Unknown | NeverAllocatedPage: Nothing.
+  // - InUsePage | FreedPage: Some.
   mozilla::Maybe<StackTrace> mAllocStack;
+
+  // The free stack.
+  // - Unknown | NeverAllocatedPage | InUsePage: Nothing.
+  // - FreedPage: Some.
   mozilla::Maybe<StackTrace> mFreeStack;
 
   // Default to no PHC info.
   AddrInfo()
       : mKind(Kind::Unknown),
         mBaseAddr(nullptr),
         mUsableSize(0),
         mAllocStack(),