PA: Parameterize emap. Move emap_global to arena.

This lets us test the PA module without interfering with the global emap used by
the real allocator (the one not under test).
This commit is contained in:
David Goldblatt 2020-03-14 10:49:34 -07:00 committed by David Goldblatt
parent f730577277
commit 294b276fc7
19 changed files with 211 additions and 184 deletions

View file

@ -189,8 +189,8 @@ ehooks_default_split(extent_hooks_t *extent_hooks, void *addr, size_t size,
static inline bool
ehooks_same_sn(tsdn_t *tsdn, void *addr_a, void *addr_b) {
edata_t *a = emap_edata_lookup(tsdn, &emap_global, addr_a);
edata_t *b = emap_edata_lookup(tsdn, &emap_global, addr_b);
edata_t *a = emap_edata_lookup(tsdn, &arena_emap_global, addr_a);
edata_t *b = emap_edata_lookup(tsdn, &arena_emap_global, addr_b);
return edata_sn_comp(a, b) == 0;
}
@ -253,9 +253,9 @@ bool
ehooks_default_merge(extent_hooks_t *extent_hooks, void *addr_a, size_t size_a,
void *addr_b, size_t size_b, bool committed, unsigned arena_ind) {
tsdn_t *tsdn = tsdn_fetch();
edata_t *a = emap_edata_lookup(tsdn, &emap_global, addr_a);
edata_t *a = emap_edata_lookup(tsdn, &arena_emap_global, addr_a);
bool head_a = edata_is_head_get(a);
edata_t *b = emap_edata_lookup(tsdn, &emap_global, addr_b);
edata_t *b = emap_edata_lookup(tsdn, &arena_emap_global, addr_b);
bool head_b = edata_is_head_get(b);
return ehooks_default_merge_impl(tsdn, addr_a, head_a, addr_b, head_b);
}