Home | History | Annotate | Download | only in internal

Lines Matching defs:tsd

32  * Loading TSD data is on the critical path of basically all malloc operations.
43 * Note: the entire tcache is embedded into TSD and spans multiple cachelines.
113 /* The actual tsd. */
116 * The contents should be treated as totally opaque outside the tsd
133 tsd_t tsd;
137 tsd_tsdn(tsd_t *tsd) {
138 return (tsdn_t *)tsd;
150 return &tsdn->tsd;
159 tsd_t *tsd_fetch_slow(tsd_t *tsd, bool internal);
160 void tsd_slow_update(tsd_t *tsd);
178 * tsd_foop_get_unsafe(tsd) returns a pointer to the thread-local instance of
179 * foo. This omits some safety checks, and so can be used during tsd
184 tsd_##n##p_get_unsafe(tsd_t *tsd) { \
185 return &tsd->use_a_getter_or_setter_instead_##n; \
190 /* tsd_foop_get(tsd) returns a pointer to the thread-local instance of foo. */
193 tsd_##n##p_get(tsd_t *tsd) { \
194 assert(tsd->state == tsd_state_nominal || \
195 tsd->state == tsd_state_nominal_slow || \
196 tsd->state == tsd_state_reincarnated || \
197 tsd->state == tsd_state_minimal_initialized); \
198 return tsd_##n##p_get_unsafe(tsd); \
213 tsd_t *tsd = tsdn_tsd(tsdn); \
214 return (nt *)tsd_##n##p_get(tsd); \
219 /* tsd_foo_get(tsd) returns the value of the thread-local instance of foo. */
222 tsd_##n##_get(tsd_t *tsd) { \
223 return *tsd_##n##p_get(tsd); \
228 /* tsd_foo_set(tsd, val) updates the thread-local instance of foo to be val. */
231 tsd_##n##_set(tsd_t *tsd, t val) { \
232 assert(tsd->state != tsd_state_reincarnated && \
233 tsd->state != tsd_state_minimal_initialized); \
234 *tsd_##n##p_get(tsd) = val; \
240 tsd_assert_fast(tsd_t *tsd) {
241 assert(!malloc_slow && tsd_tcache_enabled_get(tsd) &&
242 tsd_reentrancy_level_get(tsd) == 0);
246 tsd_fast(tsd_t *tsd) {
247 bool fast = (tsd->state == tsd_state_nominal);
249 tsd_assert_fast(tsd);
257 tsd_t *tsd = tsd_get(init);
259 if (!init && tsd_get_allocates() && tsd == NULL) {
262 assert(tsd != NULL);
264 if (unlikely(tsd->state != tsd_state_nominal)) {
265 return tsd_fetch_slow(tsd, minimal);
267 assert(tsd_fast(tsd));
268 tsd_assert_fast(tsd);
270 return tsd;
273 /* Get a minimal TSD that requires no cleanup. See comments in free(). */
282 tsd_t *tsd = tsd_fetch_min();
284 tsd->state = tsd_state_reincarnated;
286 return tsd;
295 tsd_nominal(tsd_t *tsd) {
296 return (tsd->state <= tsd_state_nominal_max);
309 tsd_rtree_ctx(tsd_t *tsd) {
310 return tsd_rtree_ctxp_get(tsd);
316 * If tsd cannot be accessed, initialize the fallback rtree_ctx and