Emap: Move in iealloc.
This is logically scoped to the emap.
This commit is contained in:
committed by
David Goldblatt
parent
1d449bd9a6
commit
9b5d105fc3
@@ -1637,7 +1637,7 @@ arena_dalloc_promoted(tsdn_t *tsdn, void *ptr, tcache_t *tcache,
|
||||
cassert(config_prof);
|
||||
assert(opt_prof);
|
||||
|
||||
edata_t *edata = iealloc(tsdn, ptr);
|
||||
edata_t *edata = emap_lookup(tsdn, &emap_global, ptr);
|
||||
size_t usize = edata_usize_get(edata);
|
||||
size_t bumped_usize = arena_prof_demote(tsdn, edata, ptr);
|
||||
if (config_opt_safety_checks && usize < SC_LARGE_MINCLASS) {
|
||||
@@ -1769,7 +1769,7 @@ arena_dalloc_bin(tsdn_t *tsdn, arena_t *arena, edata_t *edata, void *ptr) {
|
||||
|
||||
void
|
||||
arena_dalloc_small(tsdn_t *tsdn, void *ptr) {
|
||||
edata_t *edata = iealloc(tsdn, ptr);
|
||||
edata_t *edata = emap_lookup(tsdn, &emap_global, ptr);
|
||||
arena_t *arena = arena_get_from_edata(edata);
|
||||
|
||||
arena_dalloc_bin(tsdn, arena, edata, ptr);
|
||||
@@ -1783,7 +1783,7 @@ arena_ralloc_no_move(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t size,
|
||||
/* Calls with non-zero extra had to clamp extra. */
|
||||
assert(extra == 0 || size + extra <= SC_LARGE_MAXCLASS);
|
||||
|
||||
edata_t *edata = iealloc(tsdn, ptr);
|
||||
edata_t *edata = emap_lookup(tsdn, &emap_global, ptr);
|
||||
if (unlikely(size > SC_LARGE_MAXCLASS)) {
|
||||
ret = true;
|
||||
goto done;
|
||||
@@ -1817,7 +1817,7 @@ arena_ralloc_no_move(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t size,
|
||||
ret = true;
|
||||
}
|
||||
done:
|
||||
assert(edata == iealloc(tsdn, ptr));
|
||||
assert(edata == emap_lookup(tsdn, &emap_global, ptr));
|
||||
*newsize = edata_usize_get(edata);
|
||||
|
||||
return ret;
|
||||
|
@@ -2667,7 +2667,7 @@ arenas_lookup_ctl(tsd_t *tsd, const size_t *mib,
|
||||
ret = EINVAL;
|
||||
malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
|
||||
WRITE(ptr, void *);
|
||||
edata = iealloc(tsd_tsdn(tsd), ptr);
|
||||
edata = emap_lookup(tsd_tsdn(tsd), &emap_global, ptr);
|
||||
if (edata == NULL)
|
||||
goto label_return;
|
||||
|
||||
|
@@ -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 = iealloc(tsdn, addr_a);
|
||||
edata_t *b = iealloc(tsdn, addr_b);
|
||||
edata_t *a = emap_lookup(tsdn, &emap_global, addr_a);
|
||||
edata_t *b = emap_lookup(tsdn, &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 = iealloc(tsdn, addr_a);
|
||||
edata_t *a = emap_lookup(tsdn, &emap_global, addr_a);
|
||||
bool head_a = edata_is_head_get(a);
|
||||
edata_t *b = iealloc(tsdn, addr_b);
|
||||
edata_t *b = emap_lookup(tsdn, &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);
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ inspect_extent_util_stats_get(tsdn_t *tsdn, const void *ptr, size_t *nfree,
|
||||
size_t *nregs, size_t *size) {
|
||||
assert(ptr != NULL && nfree != NULL && nregs != NULL && size != NULL);
|
||||
|
||||
const edata_t *edata = iealloc(tsdn, ptr);
|
||||
const edata_t *edata = emap_lookup(tsdn, &emap_global, ptr);
|
||||
if (unlikely(edata == NULL)) {
|
||||
*nfree = *nregs = *size = 0;
|
||||
return;
|
||||
@@ -31,7 +31,7 @@ inspect_extent_util_stats_verbose_get(tsdn_t *tsdn, const void *ptr,
|
||||
assert(ptr != NULL && nfree != NULL && nregs != NULL && size != NULL
|
||||
&& bin_nfree != NULL && bin_nregs != NULL && slabcur_addr != NULL);
|
||||
|
||||
const edata_t *edata = iealloc(tsdn, ptr);
|
||||
const edata_t *edata = emap_lookup(tsdn, &emap_global, ptr);
|
||||
if (unlikely(edata == NULL)) {
|
||||
*nfree = *nregs = *size = *bin_nfree = *bin_nregs = 0;
|
||||
*slabcur_addr = NULL;
|
||||
|
@@ -3423,7 +3423,7 @@ je_xallocx(void *ptr, size_t size, size_t extra, int flags) {
|
||||
* object associated with the ptr (though the content of the edata_t
|
||||
* object can be changed).
|
||||
*/
|
||||
edata_t *old_edata = iealloc(tsd_tsdn(tsd), ptr);
|
||||
edata_t *old_edata = emap_lookup(tsd_tsdn(tsd), &emap_global, ptr);
|
||||
|
||||
alloc_ctx_t alloc_ctx;
|
||||
rtree_ctx_t *rtree_ctx = tsd_rtree_ctx(tsd);
|
||||
@@ -3462,7 +3462,7 @@ je_xallocx(void *ptr, size_t size, size_t extra, int flags) {
|
||||
* xallocx() should keep using the same edata_t object (though its
|
||||
* content can be changed).
|
||||
*/
|
||||
assert(iealloc(tsd_tsdn(tsd), ptr) == old_edata);
|
||||
assert(emap_lookup(tsd_tsdn(tsd), &emap_global, ptr) == old_edata);
|
||||
|
||||
if (unlikely(usize == old_usize)) {
|
||||
te_alloc_rollback(tsd, usize);
|
||||
|
@@ -272,7 +272,7 @@ void *
|
||||
large_ralloc(tsdn_t *tsdn, arena_t *arena, void *ptr, size_t usize,
|
||||
size_t alignment, bool zero, tcache_t *tcache,
|
||||
hook_ralloc_args_t *hook_args) {
|
||||
edata_t *edata = iealloc(tsdn, ptr);
|
||||
edata_t *edata = emap_lookup(tsdn, &emap_global, ptr);
|
||||
|
||||
size_t oldusize = edata_usize_get(edata);
|
||||
/* The following should have been caught by callers. */
|
||||
|
@@ -148,7 +148,7 @@ prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated) {
|
||||
void
|
||||
prof_malloc_sample_object(tsd_t *tsd, const void *ptr, size_t size,
|
||||
size_t usize, prof_tctx_t *tctx) {
|
||||
edata_t *edata = iealloc(tsd_tsdn(tsd), ptr);
|
||||
edata_t *edata = emap_lookup(tsd_tsdn(tsd), &emap_global, ptr);
|
||||
prof_info_set(tsd, edata, tctx);
|
||||
|
||||
malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock);
|
||||
|
@@ -160,7 +160,8 @@ tcache_bin_flush_small(tsd_t *tsd, tcache_t *tcache, cache_bin_t *tbin,
|
||||
item_edata);
|
||||
} else {
|
||||
for (unsigned i = 0 ; i < nflush; i++) {
|
||||
item_edata[i] = iealloc(tsdn, *(bottom_item - i));
|
||||
item_edata[i] = emap_lookup(tsd_tsdn(tsd), &emap_global,
|
||||
*(bottom_item - i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +259,8 @@ tcache_bin_flush_large(tsd_t *tsd, tcache_t *tcache, cache_bin_t *tbin, szind_t
|
||||
#ifndef JEMALLOC_EXTRA_SIZE_CHECK
|
||||
/* Look up edata once per item. */
|
||||
for (unsigned i = 0 ; i < nflush; i++) {
|
||||
item_edata[i] = iealloc(tsd_tsdn(tsd), *(bottom_item - i));
|
||||
item_edata[i] = emap_lookup(tsd_tsdn(tsd), &emap_global,
|
||||
*(bottom_item - i));
|
||||
}
|
||||
#else
|
||||
tbin_extents_lookup_size_check(tsd_tsdn(tsd), tbin, binind, nflush,
|
||||
|
Reference in New Issue
Block a user