mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-25 08:33:38 +03:00
Header refactoring: tsd - cleanup and dependency breaking.
This removes the tsd macros (which are used only for tsd_t in real builds). We break up the circular dependencies involving tsd. We also move all tsd access through getters and setters. This allows us to assert that we only touch data when tsd is in a valid state. We simplify the usages of the x macro trick, removing all the customizability (get/set, init, cleanup), moving the lifetime logic to tsd_init and tsd_cleanup. This lets us make initialization order independent of order within tsd_t.
This commit is contained in:
parent
c86c8f4ffb
commit
209f2926b8
29 changed files with 870 additions and 913 deletions
10
src/prof.c
10
src/prof.c
|
|
@ -1642,7 +1642,7 @@ static bool
|
|||
prof_dump(tsd_t *tsd, bool propagate_err, const char *filename,
|
||||
bool leakcheck) {
|
||||
cassert(config_prof);
|
||||
assert(tsd->reentrancy_level == 0);
|
||||
assert(tsd_reentrancy_level_get(tsd) == 0);
|
||||
|
||||
prof_tdata_t * tdata = prof_tdata_get(tsd, true);
|
||||
if (tdata == NULL) {
|
||||
|
|
@ -1757,7 +1757,7 @@ prof_fdump(void) {
|
|||
return;
|
||||
}
|
||||
tsd = tsd_fetch();
|
||||
assert(tsd->reentrancy_level == 0);
|
||||
assert(tsd_reentrancy_level_get(tsd) == 0);
|
||||
|
||||
malloc_mutex_lock(tsd_tsdn(tsd), &prof_dump_seq_mtx);
|
||||
prof_dump_filename(filename, 'f', VSEQ_INVALID);
|
||||
|
|
@ -1792,7 +1792,7 @@ prof_idump(tsdn_t *tsdn) {
|
|||
return;
|
||||
}
|
||||
tsd = tsdn_tsd(tsdn);
|
||||
if (tsd->reentrancy_level > 0) {
|
||||
if (tsd_reentrancy_level_get(tsd) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1818,7 +1818,7 @@ prof_idump(tsdn_t *tsdn) {
|
|||
bool
|
||||
prof_mdump(tsd_t *tsd, const char *filename) {
|
||||
cassert(config_prof);
|
||||
assert(tsd->reentrancy_level == 0);
|
||||
assert(tsd_reentrancy_level_get(tsd) == 0);
|
||||
|
||||
if (!opt_prof || !prof_booted) {
|
||||
return true;
|
||||
|
|
@ -1849,7 +1849,7 @@ prof_gdump(tsdn_t *tsdn) {
|
|||
return;
|
||||
}
|
||||
tsd = tsdn_tsd(tsdn);
|
||||
if (tsd->reentrancy_level > 0) {
|
||||
if (tsd_reentrancy_level_get(tsd) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue