| 134 | } |
| 135 | |
| 136 | static bool slab_map_indices(uintptr_t base, size_t *i1, size_t *i2, size_t *i3) { |
| 137 | uintptr_t pnum = base >> SLAB_PAGE_SHIFT; |
| 138 | if ((pnum >> SLAB_MAP_TOTAL_BITS) != 0) { |
| 139 | return false; /* address beyond coverage — never produced by malloc here */ |
| 140 | } |
| 141 | *i1 = (size_t)((pnum >> (SLAB_MAP_L2_BITS + SLAB_MAP_L3_BITS)) & (SLAB_MAP_L1_SIZE - 1)); |
| 142 | *i2 = (size_t)((pnum >> SLAB_MAP_L3_BITS) & (SLAB_MAP_L2_SIZE - 1)); |
| 143 | *i3 = (size_t)(pnum & (SLAB_MAP_L3_SIZE - 1)); |
| 144 | return true; |
| 145 | } |
| 146 | |
| 147 | /* Lock-free. Returns the slab page whose base == (ptr & mask), or NULL if the |
| 148 | * masked base is not a registered slab page (i.e. ptr is a plain heap block). */ |
no outgoing calls
no test coverage detected