Optimize away the tsd_fast() check on free fastpath.

To ensure that the free fastpath can tolerate uninitialized tsd, improved the
static initializer for rtree_ctx in tsd.
This commit is contained in:
Qi Wang
2021-10-19 17:14:08 -07:00
committed by Qi Wang
parent 26f5257b88
commit 4d56aaeca5
7 changed files with 48 additions and 38 deletions

View File

@@ -48,6 +48,13 @@ thd_start(void *arg) {
int d = (int)(uintptr_t)arg;
void *p;
/*
* Test free before tsd init -- the free fast path (which does not
* explicitly check for NULL) has to tolerate this case, and fall back
* to free_default.
*/
free(NULL);
tsd_t *tsd = tsd_fetch();
expect_x_eq(tsd_test_data_get(tsd), MALLOC_TSD_TEST_DATA_INIT,
"Initial tsd get should return initialization value");