mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-30 00:27:30 +03:00
SC: Remove global data.
The global data is mostly only used at initialization, or for easy access to values we could compute statically. Instead of consuming that space (and risking TLB misses), we can just pass around a pointer to stack data during bootstrapping.
This commit is contained in:
parent
4bc48718b2
commit
3aba072cef
16 changed files with 73 additions and 73 deletions
|
|
@ -108,8 +108,13 @@ TEST_BEGIN(test_psize_classes) {
|
|||
size_class, sz_psz2ind(size_class),
|
||||
sz_pind2sz(sz_psz2ind(size_class)));
|
||||
|
||||
assert_u_eq(pind+1, sz_psz2ind(size_class+1),
|
||||
"Next size_class does not round up properly");
|
||||
if (size_class == SC_LARGE_MAXCLASS) {
|
||||
assert_u_eq(SC_NPSIZES, sz_psz2ind(size_class + 1),
|
||||
"Next size_class does not round up properly");
|
||||
} else {
|
||||
assert_u_eq(pind + 1, sz_psz2ind(size_class + 1),
|
||||
"Next size_class does not round up properly");
|
||||
}
|
||||
|
||||
assert_zu_eq(size_class, (pind > 0) ?
|
||||
sz_psz2u(sz_pind2sz(pind-1)+1) : sz_psz2u(1),
|
||||
|
|
@ -156,16 +161,13 @@ TEST_BEGIN(test_overflow) {
|
|||
assert_zu_eq(sz_s2u(SIZE_T_MAX), 0,
|
||||
"sz_s2u() should return 0 on overflow");
|
||||
|
||||
assert_u_eq(sz_psz2ind(max_size_class+1), sc_data_global.npsizes,
|
||||
assert_u_eq(sz_psz2ind(max_size_class+1), SC_NPSIZES,
|
||||
"sz_psz2ind() should return NPSIZES on overflow");
|
||||
assert_u_eq(sz_psz2ind(ZU(PTRDIFF_MAX)+1), sc_data_global.npsizes,
|
||||
assert_u_eq(sz_psz2ind(ZU(PTRDIFF_MAX)+1), SC_NPSIZES,
|
||||
"sz_psz2ind() should return NPSIZES on overflow");
|
||||
assert_u_eq(sz_psz2ind(SIZE_T_MAX), sc_data_global.npsizes,
|
||||
assert_u_eq(sz_psz2ind(SIZE_T_MAX), SC_NPSIZES,
|
||||
"sz_psz2ind() should return NPSIZES on overflow");
|
||||
|
||||
assert_u_le(sc_data_global.npsizes, SC_NPSIZES_MAX,
|
||||
"Dynamic value of npsizes is higher than static bound.");
|
||||
|
||||
assert_zu_eq(sz_psz2u(max_size_class+1), max_psz,
|
||||
"sz_psz2u() should return (LARGE_MAXCLASS + PAGE) for unsupported"
|
||||
" size");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue