| 1 | // Copyright (c) 2005, Google Inc.cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCPageMap.h`/ |
| 2 | // All rights reserved. |
| 3 | // |
| 4 | // Redistribution and use in source and binary forms, with or without |
| 5 | // modification, are permitted provided that the following conditions are |
| 6 | // met: |
| 7 | // |
| 8 | // * Redistributions of source code must retain the above copyright |
| 9 | // notice, this list of conditions and the following disclaimer. |
| 10 | // * Redistributions in binary form must reproduce the above |
| 11 | // copyright notice, this list of conditions and the following disclaimer |
| 12 | // in the documentation and/or other materials provided with the |
| 13 | // distribution. |
| 14 | // * Neither the name of Google Inc. nor the names of its |
| 15 | // contributors may be used to endorse or promote products derived from |
| 16 | // this software without specific prior written permission. |
| 17 | // |
| 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | |
| 30 | // --- |
| 31 | // Author: Sanjay Ghemawat <[email protected]> |
| 32 | // |
| 33 | // A data structure used by the caching malloc. It maps from page# to |
| 34 | // a pointer that contains info about that page. We use two |
| 35 | // representations: one for 32-bit addresses, and another for 64 bit |
| 36 | // addresses. Both representations provide the same interface. The |
| 37 | // first representation is implemented as a flat array, the seconds as |
| 38 | // a three-level radix tree that strips away approximately 1/3rd of |
| 39 | // the bits every time. |
| 40 | // |
| 41 | // The BITS parameter should be the number of bits required to hold |
| 42 | // a page number. E.g., with 32 bit pointers and 4K pages (i.e., |
| 43 | // page offset fits in lower 12 bits), BITS == 20. |
| 44 | |
| 45 | #ifndef TCMALLOC_PAGEMAP_H__ |
| 46 | #define TCMALLOC_PAGEMAP_H__cxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCPageMap.h:46:9`! |
| 47 | |
| 48 | #if HAVEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:46:9`!(STDINT_H) |
| 49 | #include <stdint.h> |
| 50 | #elif HAVE(INTTYPES_H) |
| 51 | #include <inttypes.h> |
| 52 | #else |
| 53 | #include <sys/types.h> |
| 54 | #endif |
| 55 | |
| 56 | #include <string.h> |
| 57 | #include "Assertions.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h`/ |
| 58 | |
| 59 | // Single-level array |
| 60 | template <int BITS> |
| 61 | class TCMalloc_PageMap1cxx . . $ TCMalloc_PageMap1# { |
| 62 | private: |
| 63 | void** array_cxx . . $ TCMalloc_PageMap1#array_.; |
| 64 | |
| 65 | public: |
| 66 | typedef uintptr_tcxx . . $ uintptr_t# Numbercxx . . $ TCMalloc_PageMap1#Number#; |
| 67 | |
| 68 | void initcxx . . $ TCMalloc_PageMap1#init(3f32ebbd18822f30).(void* (*allocator)(size_t)) { |
| 69 | array_cxx . . $ TCMalloc_PageMap1#array_. = reinterpret_cast<void**>((*allocator)(sizeof(void*) << BITS)); |
| 70 | memset(array_cxx . . $ TCMalloc_PageMap1#array_., 0, sizeof(void*) << BITS); |
| 71 | } |
| 72 | |
| 73 | // Ensure that the map contains initialized entries "x .. x+n-1". |
| 74 | // Returns true if successful, false if we could not allocate memory. |
| 75 | bool Ensurecxx . . $ TCMalloc_PageMap1#Ensure(7dc03904b9dbe7ff).(Numbercxx . . $ TCMalloc_PageMap1#Number# x, size_t n) { |
| 76 | // Nothing to do since flat array was allocate at start |
| 77 | return true; |
| 78 | } |
| 79 | |
| 80 | void PreallocateMoreMemorycxx . . $ TCMalloc_PageMap1#PreallocateMoreMemory(49f6e7a06ebc5aa8).() {} |
| 81 | |
| 82 | // REQUIRES "k" is in range "[0,2^BITS-1]". |
| 83 | // REQUIRES "k" has been ensured before. |
| 84 | // |
| 85 | // Return the current value for KEY. Returns "Value()" if not |
| 86 | // yet set. |
| 87 | void* getcxx . . $ TCMalloc_PageMap1#get(4e1099794cea8682).(Numbercxx . . $ TCMalloc_PageMap1#Number# k) const { |
| 88 | return array_cxx . . $ TCMalloc_PageMap1#array_.[k]; |
| 89 | } |
| 90 | |
| 91 | // REQUIRES "k" is in range "[0,2^BITS-1]". |
| 92 | // REQUIRES "k" has been ensured before. |
| 93 | // |
| 94 | // Sets the value for KEY. |
| 95 | void setcxx . . $ TCMalloc_PageMap1#set(3bdecba87b0fe3d5).(Numbercxx . . $ TCMalloc_PageMap1#Number# k, void* v) { |
| 96 | array_cxx . . $ TCMalloc_PageMap1#array_.[k] = v; |
| 97 | } |
| 98 | }; |
| 99 | |
| 100 | // Two-level radix tree |
| 101 | template <int BITS> |
| 102 | class TCMalloc_PageMap2cxx . . $ TCMalloc_PageMap2# { |
| 103 | private: |
| 104 | // Put 32 entries in the root and (2^BITS)/32 entries in each leaf. |
| 105 | static const int ROOT_BITScxx . . $ TCMalloc_PageMap2#ROOT_BITS. = 5; |
| 106 | static const int ROOT_LENGTHcxx . . $ TCMalloc_PageMap2#ROOT_LENGTH. = 1 << ROOT_BITScxx . . $ TCMalloc_PageMap2#ROOT_BITS.; |
| 107 | |
| 108 | static const int LEAF_BITScxx . . $ TCMalloc_PageMap2#LEAF_BITS. = BITS - ROOT_BITScxx . . $ TCMalloc_PageMap2#ROOT_BITS.; |
| 109 | static const int LEAF_LENGTHcxx . . $ TCMalloc_PageMap2#LEAF_LENGTH. = 1 << LEAF_BITScxx . . $ TCMalloc_PageMap2#LEAF_BITS.; |
| 110 | |
| 111 | // Leaf node |
| 112 | struct Leafcxx . . $ TCMalloc_PageMap2#Leaf# { |
| 113 | void* valuescxx . . $ TCMalloc_PageMap2#Leaf#values.[LEAF_LENGTHcxx . . $ TCMalloc_PageMap2#LEAF_LENGTH.]; |
| 114 | }; |
| 115 | |
| 116 | Leafcxx . . $ TCMalloc_PageMap2#Leaf#* root_cxx . . $ TCMalloc_PageMap2#root_.[ROOT_LENGTHcxx . . $ TCMalloc_PageMap2#ROOT_LENGTH.]; // Pointers to 32 child nodes |
| 117 | void* (*allocator_cxx . . $ TCMalloc_PageMap2#allocator_.)(size_t); // Memory allocator |
| 118 | |
| 119 | public: |
| 120 | typedef uintptr_tcxx . . $ uintptr_t# Numbercxx . . $ TCMalloc_PageMap2#Number#; |
| 121 | |
| 122 | void initcxx . . $ TCMalloc_PageMap2#init(3f32ebbd18822f30).(void* (*allocator)(size_t)) { |
| 123 | allocator_cxx . . $ TCMalloc_PageMap2#allocator_. = allocator; |
| 124 | memset(root_cxx . . $ TCMalloc_PageMap2#root_., 0, sizeof(root_cxx . . $ TCMalloc_PageMap2#root_.)); |
| 125 | } |
| 126 | |
| 127 | void* getcxx . . $ TCMalloc_PageMap2#get(4e1099794cea8682).(Numbercxx . . $ TCMalloc_PageMap2#Number# k) const { |
| 128 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(k >> BITS == 0); |
| 129 | const Numbercxx . . $ TCMalloc_PageMap2#Number# i1 = k >> LEAF_BITScxx . . $ TCMalloc_PageMap2#LEAF_BITS.; |
| 130 | const Numbercxx . . $ TCMalloc_PageMap2#Number# i2 = k & (LEAF_LENGTHcxx . . $ TCMalloc_PageMap2#LEAF_LENGTH.-1); |
| 131 | return root_cxx . . $ TCMalloc_PageMap2#root_.[i1]->valuescxx . . $ TCMalloc_PageMap2#Leaf#values.[i2]; |
| 132 | } |
| 133 | |
| 134 | void setcxx . . $ TCMalloc_PageMap2#set(3bdecba87b0fe3d5).(Numbercxx . . $ TCMalloc_PageMap2#Number# k, void* v) { |
| 135 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(k >> BITS == 0); |
| 136 | const Numbercxx . . $ TCMalloc_PageMap2#Number# i1 = k >> LEAF_BITScxx . . $ TCMalloc_PageMap2#LEAF_BITS.; |
| 137 | const Numbercxx . . $ TCMalloc_PageMap2#Number# i2 = k & (LEAF_LENGTHcxx . . $ TCMalloc_PageMap2#LEAF_LENGTH.-1); |
| 138 | root_cxx . . $ TCMalloc_PageMap2#root_.[i1]->valuescxx . . $ TCMalloc_PageMap2#Leaf#values.[i2] = v; |
| 139 | } |
| 140 | |
| 141 | bool Ensurecxx . . $ TCMalloc_PageMap2#Ensure(7dc03904b9dbe7ff).(Numbercxx . . $ TCMalloc_PageMap2#Number# start, size_t n) { |
| 142 | for (Numbercxx . . $ TCMalloc_PageMap2#Number# key = start; key <= start + n - 1; ) { |
| 143 | const Numbercxx . . $ TCMalloc_PageMap2#Number# i1 = key >> LEAF_BITScxx . . $ TCMalloc_PageMap2#LEAF_BITS.; |
| 144 | |
| 145 | // Make 2nd level node if necessary |
| 146 | if (root_cxx . . $ TCMalloc_PageMap2#root_.[i1] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 147 | Leafcxx . . $ TCMalloc_PageMap2#Leaf#* leaf = reinterpret_cast<Leafcxx . . $ TCMalloc_PageMap2#Leaf#*>((*allocator_cxx . . $ TCMalloc_PageMap2#allocator_.)(sizeof(Leafcxx . . $ TCMalloc_PageMap2#Leaf#))); |
| 148 | if (leaf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) return false; |
| 149 | memset(leaf, 0, sizeof(*leaf)); |
| 150 | root_cxx . . $ TCMalloc_PageMap2#root_.[i1] = leaf; |
| 151 | } |
| 152 | |
| 153 | // Advance key past whatever is covered by this leaf node |
| 154 | key = ((key >> LEAF_BITScxx . . $ TCMalloc_PageMap2#LEAF_BITS.) + 1) << LEAF_BITScxx . . $ TCMalloc_PageMap2#LEAF_BITS.; |
| 155 | } |
| 156 | return true; |
| 157 | } |
| 158 | |
| 159 | void PreallocateMoreMemorycxx . . $ TCMalloc_PageMap2#PreallocateMoreMemory(49f6e7a06ebc5aa8).() { |
| 160 | // Allocate enough to keep track of all possible pages |
| 161 | Ensurecxx . . $ TCMalloc_PageMap2#Ensure(7dc03904b9dbe7ff).(0, 1 << BITS); |
| 162 | } |
| 163 | |
| 164 | #ifdef WTF_CHANGEScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/config.h:63:9`! |
| 165 | template<class Visitor, class MemoryReader> |
| 166 | void visitValuescxx . . $ TCMalloc_PageMap2#visitValues(c818ec4e37d7fca2).(Visitor& visitor, const MemoryReader& reader) |
| 167 | { |
| 168 | for (int i = 0; i < ROOT_LENGTHcxx . . $ TCMalloc_PageMap2#ROOT_LENGTH.; i++) { |
| 169 | if (!root_cxx . . $ TCMalloc_PageMap2#root_.[i]) |
| 170 | continue; |
| 171 | |
| 172 | Leafcxx . . $ TCMalloc_PageMap2#Leaf#* l = reader(reinterpret_cast<Leafcxx . . $ TCMalloc_PageMap2#Leaf#*>(root_cxx . . $ TCMalloc_PageMap2#root_.[i])); |
| 173 | for (int j = 0; j < LEAF_LENGTHcxx . . $ TCMalloc_PageMap2#LEAF_LENGTH.; j += visitor.visit(l->valuescxx . . $ TCMalloc_PageMap2#Leaf#values.[j])) |
| 174 | ; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | template<class Visitor, class MemoryReader> |
| 179 | void visitAllocationscxx . . $ TCMalloc_PageMap2#visitAllocations(c818ec4e37d7fca2).(Visitor& visitor, const MemoryReader&) { |
| 180 | for (int i = 0; i < ROOT_LENGTHcxx . . $ TCMalloc_PageMap2#ROOT_LENGTH.; i++) { |
| 181 | if (root_cxx . . $ TCMalloc_PageMap2#root_.[i]) |
| 182 | visitor.visit(root_cxx . . $ TCMalloc_PageMap2#root_.[i], sizeof(Leafcxx . . $ TCMalloc_PageMap2#Leaf#)); |
| 183 | } |
| 184 | } |
| 185 | #endif |
| 186 | }; |
| 187 | |
| 188 | // Three-level radix tree |
| 189 | template <int BITS> |
| 190 | class TCMalloc_PageMap3cxx . . $ TCMalloc_PageMap3# { |
| 191 | private: |
| 192 | // How many bits should we consume at each interior level |
| 193 | static const int INTERIOR_BITScxx . . $ TCMalloc_PageMap3#INTERIOR_BITS. = (BITS + 2) / 3; // Round-up |
| 194 | static const int INTERIOR_LENGTHcxx . . $ TCMalloc_PageMap3#INTERIOR_LENGTH. = 1 << INTERIOR_BITScxx . . $ TCMalloc_PageMap3#INTERIOR_BITS.; |
| 195 | |
| 196 | // How many bits should we consume at leaf level |
| 197 | static const int LEAF_BITScxx . . $ TCMalloc_PageMap3#LEAF_BITS. = BITS - 2*INTERIOR_BITScxx . . $ TCMalloc_PageMap3#INTERIOR_BITS.; |
| 198 | static const int LEAF_LENGTHcxx . . $ TCMalloc_PageMap3#LEAF_LENGTH. = 1 << LEAF_BITScxx . . $ TCMalloc_PageMap3#LEAF_BITS.; |
| 199 | |
| 200 | // Interior node |
| 201 | struct Nodecxx . . $ TCMalloc_PageMap3#Node# { |
| 202 | Nodecxx . . $ TCMalloc_PageMap3#Node#* ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[INTERIOR_LENGTHcxx . . $ TCMalloc_PageMap3#INTERIOR_LENGTH.]; |
| 203 | }; |
| 204 | |
| 205 | // Leaf node |
| 206 | struct Leafcxx . . $ TCMalloc_PageMap3#Leaf# { |
| 207 | void* valuescxx . . $ TCMalloc_PageMap3#Leaf#values.[LEAF_LENGTHcxx . . $ TCMalloc_PageMap3#LEAF_LENGTH.]; |
| 208 | }; |
| 209 | |
| 210 | Nodecxx . . $ TCMalloc_PageMap3#Node#* root_cxx . . $ TCMalloc_PageMap3#root_.; // Root of radix tree |
| 211 | void* (*allocator_cxx . . $ TCMalloc_PageMap3#allocator_.)(size_t); // Memory allocator |
| 212 | |
| 213 | Nodecxx . . $ TCMalloc_PageMap3#Node#* NewNodecxx . . $ TCMalloc_PageMap3#NewNode(cfcdcf99d21121f8).() { |
| 214 | Nodecxx . . $ TCMalloc_PageMap3#Node#* result = reinterpret_cast<Nodecxx . . $ TCMalloc_PageMap3#Node#*>((*allocator_cxx . . $ TCMalloc_PageMap3#allocator_.)(sizeof(Nodecxx . . $ TCMalloc_PageMap3#Node#))); |
| 215 | if (result != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 216 | memset(result, 0, sizeof(*result)); |
| 217 | } |
| 218 | return result; |
| 219 | } |
| 220 | |
| 221 | public: |
| 222 | typedef uintptr_tcxx . . $ uintptr_t# Numbercxx . . $ TCMalloc_PageMap3#Number#; |
| 223 | |
| 224 | void initcxx . . $ TCMalloc_PageMap3#init(3f32ebbd18822f30).(void* (*allocator)(size_t)) { |
| 225 | allocator_cxx . . $ TCMalloc_PageMap3#allocator_. = allocator; |
| 226 | root_cxx . . $ TCMalloc_PageMap3#root_. = NewNodecxx . . $ TCMalloc_PageMap3#NewNode(cfcdcf99d21121f8).(); |
| 227 | } |
| 228 | |
| 229 | void* getcxx . . $ TCMalloc_PageMap3#get(4e1099794cea8682).(Numbercxx . . $ TCMalloc_PageMap3#Number# k) const { |
| 230 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(k >> BITS == 0); |
| 231 | const Numbercxx . . $ TCMalloc_PageMap3#Number# i1 = k >> (LEAF_BITScxx . . $ TCMalloc_PageMap3#LEAF_BITS. + INTERIOR_BITScxx . . $ TCMalloc_PageMap3#INTERIOR_BITS.); |
| 232 | const Numbercxx . . $ TCMalloc_PageMap3#Number# i2 = (k >> LEAF_BITScxx . . $ TCMalloc_PageMap3#LEAF_BITS.) & (INTERIOR_LENGTHcxx . . $ TCMalloc_PageMap3#INTERIOR_LENGTH.-1); |
| 233 | const Numbercxx . . $ TCMalloc_PageMap3#Number# i3 = k & (LEAF_LENGTHcxx . . $ TCMalloc_PageMap3#LEAF_LENGTH.-1); |
| 234 | return reinterpret_cast<Leafcxx . . $ TCMalloc_PageMap3#Leaf#*>(root_cxx . . $ TCMalloc_PageMap3#root_.->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[i1]->ptrs[i2])->valuescxx . . $ TCMalloc_PageMap3#Leaf#values.[i3]; |
| 235 | } |
| 236 | |
| 237 | void setcxx . . $ TCMalloc_PageMap3#set(3bdecba87b0fe3d5).(Numbercxx . . $ TCMalloc_PageMap3#Number# k, void* v) { |
| 238 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(k >> BITS == 0); |
| 239 | const Numbercxx . . $ TCMalloc_PageMap3#Number# i1 = k >> (LEAF_BITScxx . . $ TCMalloc_PageMap3#LEAF_BITS. + INTERIOR_BITScxx . . $ TCMalloc_PageMap3#INTERIOR_BITS.); |
| 240 | const Numbercxx . . $ TCMalloc_PageMap3#Number# i2 = (k >> LEAF_BITScxx . . $ TCMalloc_PageMap3#LEAF_BITS.) & (INTERIOR_LENGTHcxx . . $ TCMalloc_PageMap3#INTERIOR_LENGTH.-1); |
| 241 | const Numbercxx . . $ TCMalloc_PageMap3#Number# i3 = k & (LEAF_LENGTHcxx . . $ TCMalloc_PageMap3#LEAF_LENGTH.-1); |
| 242 | reinterpret_cast<Leafcxx . . $ TCMalloc_PageMap3#Leaf#*>(root_cxx . . $ TCMalloc_PageMap3#root_.->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[i1]->ptrs[i2])->valuescxx . . $ TCMalloc_PageMap3#Leaf#values.[i3] = v; |
| 243 | } |
| 244 | |
| 245 | bool Ensurecxx . . $ TCMalloc_PageMap3#Ensure(7dc03904b9dbe7ff).(Numbercxx . . $ TCMalloc_PageMap3#Number# start, size_t n) { |
| 246 | for (Numbercxx . . $ TCMalloc_PageMap3#Number# key = start; key <= start + n - 1; ) { |
| 247 | const Numbercxx . . $ TCMalloc_PageMap3#Number# i1 = key >> (LEAF_BITScxx . . $ TCMalloc_PageMap3#LEAF_BITS. + INTERIOR_BITScxx . . $ TCMalloc_PageMap3#INTERIOR_BITS.); |
| 248 | const Numbercxx . . $ TCMalloc_PageMap3#Number# i2 = (key >> LEAF_BITScxx . . $ TCMalloc_PageMap3#LEAF_BITS.) & (INTERIOR_LENGTHcxx . . $ TCMalloc_PageMap3#INTERIOR_LENGTH.-1); |
| 249 | |
| 250 | // Make 2nd level node if necessary |
| 251 | if (root_cxx . . $ TCMalloc_PageMap3#root_.->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[i1] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 252 | Nodecxx . . $ TCMalloc_PageMap3#Node#* n = NewNodecxx . . $ TCMalloc_PageMap3#NewNode(cfcdcf99d21121f8).(); |
| 253 | if (n == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) return false; |
| 254 | root_cxx . . $ TCMalloc_PageMap3#root_.->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[i1] = n; |
| 255 | } |
| 256 | |
| 257 | // Make leaf node if necessary |
| 258 | if (root_cxx . . $ TCMalloc_PageMap3#root_.->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[i1]->ptrs[i2] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 259 | Leafcxx . . $ TCMalloc_PageMap3#Leaf#* leaf = reinterpret_cast<Leafcxx . . $ TCMalloc_PageMap3#Leaf#*>((*allocator_cxx . . $ TCMalloc_PageMap3#allocator_.)(sizeof(Leafcxx . . $ TCMalloc_PageMap3#Leaf#))); |
| 260 | if (leaf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) return false; |
| 261 | memset(leaf, 0, sizeof(*leaf)); |
| 262 | root_cxx . . $ TCMalloc_PageMap3#root_.->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[i1]->ptrs[i2] = reinterpret_cast<Nodecxx . . $ TCMalloc_PageMap3#Node#*>(leaf); |
| 263 | } |
| 264 | |
| 265 | // Advance key past whatever is covered by this leaf node |
| 266 | key = ((key >> LEAF_BITScxx . . $ TCMalloc_PageMap3#LEAF_BITS.) + 1) << LEAF_BITScxx . . $ TCMalloc_PageMap3#LEAF_BITS.; |
| 267 | } |
| 268 | return true; |
| 269 | } |
| 270 | |
| 271 | void PreallocateMoreMemorycxx . . $ TCMalloc_PageMap3#PreallocateMoreMemory(49f6e7a06ebc5aa8).() { |
| 272 | } |
| 273 | |
| 274 | #ifdef WTF_CHANGEScxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/config.h:63:9`! |
| 275 | template<class Visitor, class MemoryReader> |
| 276 | void visitValuescxx . . $ TCMalloc_PageMap3#visitValues(c818ec4e37d7fca2).(Visitor& visitor, const MemoryReader& reader) { |
| 277 | Nodecxx . . $ TCMalloc_PageMap3#Node#* root = reader(root_cxx . . $ TCMalloc_PageMap3#root_.); |
| 278 | for (int i = 0; i < INTERIOR_LENGTHcxx . . $ TCMalloc_PageMap3#INTERIOR_LENGTH.; i++) { |
| 279 | if (!root->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[i]) |
| 280 | continue; |
| 281 | |
| 282 | Nodecxx . . $ TCMalloc_PageMap3#Node#* n = reader(root->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[i]); |
| 283 | for (int j = 0; j < INTERIOR_LENGTHcxx . . $ TCMalloc_PageMap3#INTERIOR_LENGTH.; j++) { |
| 284 | if (!n->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[j]) |
| 285 | continue; |
| 286 | |
| 287 | Leafcxx . . $ TCMalloc_PageMap3#Leaf#* l = reader(reinterpret_cast<Leafcxx . . $ TCMalloc_PageMap3#Leaf#*>(n->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[j])); |
| 288 | for (int k = 0; k < LEAF_LENGTHcxx . . $ TCMalloc_PageMap3#LEAF_LENGTH.; k += visitor.visit(l->valuescxx . . $ TCMalloc_PageMap3#Leaf#values.[k])) |
| 289 | ; |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | template<class Visitor, class MemoryReader> |
| 295 | void visitAllocationscxx . . $ TCMalloc_PageMap3#visitAllocations(c818ec4e37d7fca2).(Visitor& visitor, const MemoryReader& reader) { |
| 296 | visitor.visit(root_cxx . . $ TCMalloc_PageMap3#root_., sizeof(Nodecxx . . $ TCMalloc_PageMap3#Node#)); |
| 297 | |
| 298 | Nodecxx . . $ TCMalloc_PageMap3#Node#* root = reader(root_cxx . . $ TCMalloc_PageMap3#root_.); |
| 299 | for (int i = 0; i < INTERIOR_LENGTHcxx . . $ TCMalloc_PageMap3#INTERIOR_LENGTH.; i++) { |
| 300 | if (!root->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[i]) |
| 301 | continue; |
| 302 | |
| 303 | visitor.visit(root->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[i], sizeof(Nodecxx . . $ TCMalloc_PageMap3#Node#)); |
| 304 | Nodecxx . . $ TCMalloc_PageMap3#Node#* n = reader(root->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[i]); |
| 305 | for (int j = 0; j < INTERIOR_LENGTHcxx . . $ TCMalloc_PageMap3#INTERIOR_LENGTH.; j++) { |
| 306 | if (!n->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[j]) |
| 307 | continue; |
| 308 | |
| 309 | visitor.visit(n->ptrscxx . . $ TCMalloc_PageMap3#Node#ptrs.[j], sizeof(Leafcxx . . $ TCMalloc_PageMap3#Leaf#)); |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | #endif |
| 314 | }; |
| 315 | |
| 316 | #endif // TCMALLOC_PAGEMAP_H__ |