src/os.c: skip aligned hinting when MI_SV39_MMU=1 is defined

This constant will be defined when the host has an SV39 MMU. The usual
2TiB+ hinting strategy will not work on those systems, so we skip it,
just as we would if the system was not "64-bit."
This commit is contained in:
Michael Orlitzky 2024-09-20 22:10:22 -04:00
parent a407780915
commit 53440ad69a

View file

@ -77,8 +77,10 @@ bool _mi_os_commit(void* addr, size_t size, bool* is_zero, mi_stats_t* tld_stats
-------------------------------------------------------------- */ -------------------------------------------------------------- */
// On 64-bit systems, we can do efficient aligned allocation by using // On 64-bit systems, we can do efficient aligned allocation by using
// the 2TiB to 30TiB area to allocate those. // the 2TiB to 30TiB area to allocate those. The one exception is on
#if (MI_INTPTR_SIZE >= 8) // 64-bit RISC-V systems that have an SV39 MMU; there the 256GiB+
// range (and specifically the 2TiB+ range) will not be usable.
#if (MI_INTPTR_SIZE >= 8) && (!defined(MI_SV39_MMU) || MI_SV39_MMU == 0)
static mi_decl_cache_align _Atomic(uintptr_t)aligned_base; static mi_decl_cache_align _Atomic(uintptr_t)aligned_base;
// Return a MI_SEGMENT_SIZE aligned address that is probably available. // Return a MI_SEGMENT_SIZE aligned address that is probably available.