| 85 | } |
| 86 | |
| 87 | JEMALLOC_ALWAYS_INLINE void * |
| 88 | cache_bin_alloc_easy(cache_bin_t *bin, bool *success) { |
| 89 | void *ret; |
| 90 | |
| 91 | bin->ncached--; |
| 92 | |
| 93 | /* |
| 94 | * Check for both bin->ncached == 0 and ncached < low_water |
| 95 | * in a single branch. |
| 96 | */ |
| 97 | if (unlikely(bin->ncached <= bin->low_water)) { |
| 98 | bin->low_water = bin->ncached; |
| 99 | if (bin->ncached == -1) { |
| 100 | bin->ncached = 0; |
| 101 | *success = false; |
| 102 | return NULL; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | /* |
| 107 | * success (instead of ret) should be checked upon the return of this |
| 108 | * function. We avoid checking (ret == NULL) because there is never a |
| 109 | * null stored on the avail stack (which is unknown to the compiler), |
| 110 | * and eagerly checking ret would cause pipeline stall (waiting for the |
| 111 | * cacheline). |
| 112 | */ |
| 113 | *success = true; |
| 114 | ret = *(bin->avail - (bin->ncached + 1)); |
| 115 | |
| 116 | return ret; |
| 117 | } |
| 118 | |
| 119 | JEMALLOC_ALWAYS_INLINE bool |
| 120 | cache_bin_dalloc_easy(cache_bin_t *bin, cache_bin_info_t *bin_info, void *ptr) { |
no outgoing calls
no test coverage detected