Add debug check outside of the loop in hpa_alloc_batch.
This optimizes the whole loop away for non-debug builds.
This commit is contained in:
parent
cf9724531a
commit
912324a1ac
10
src/hpa.c
10
src/hpa.c
@ -733,18 +733,26 @@ hpa_alloc_batch(tsdn_t *tsdn, pai_t *self, size_t size, size_t nallocs,
|
|||||||
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
||||||
WITNESS_RANK_CORE, 0);
|
WITNESS_RANK_CORE, 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Guard the sanity checks with config_debug because the loop cannot be
|
||||||
|
* proven non-circular by the compiler, even if everything within the
|
||||||
|
* loop is optimized away.
|
||||||
|
*/
|
||||||
|
if (config_debug) {
|
||||||
edata_t *edata;
|
edata_t *edata;
|
||||||
ql_foreach(edata, &results->head, ql_link_active) {
|
ql_foreach(edata, &results->head, ql_link_active) {
|
||||||
emap_assert_mapped(tsdn, shard->emap, edata);
|
emap_assert_mapped(tsdn, shard->emap, edata);
|
||||||
assert(edata_pai_get(edata) == EXTENT_PAI_HPA);
|
assert(edata_pai_get(edata) == EXTENT_PAI_HPA);
|
||||||
assert(edata_state_get(edata) == extent_state_active);
|
assert(edata_state_get(edata) == extent_state_active);
|
||||||
assert(edata_arena_ind_get(edata) == shard->ind);
|
assert(edata_arena_ind_get(edata) == shard->ind);
|
||||||
assert(edata_szind_get_maybe_invalid(edata) == SC_NSIZES);
|
assert(edata_szind_get_maybe_invalid(edata) ==
|
||||||
|
SC_NSIZES);
|
||||||
assert(!edata_slab_get(edata));
|
assert(!edata_slab_get(edata));
|
||||||
assert(edata_committed_get(edata));
|
assert(edata_committed_get(edata));
|
||||||
assert(edata_base_get(edata) == edata_addr_get(edata));
|
assert(edata_base_get(edata) == edata_addr_get(edata));
|
||||||
assert(edata_base_get(edata) != NULL);
|
assert(edata_base_get(edata) != NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nsuccess;
|
return nsuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user