Skip to content

Commit 0be71a2

Browse files
committed
fix prefix
1 parent 9183b1e commit 0be71a2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/os.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -578,29 +578,29 @@ static mi_decl_cache_align _Atomic(uintptr_t) aligned_base;
578578
// (otherwise an initial large allocation of say 2TiB has a 50% chance to include (known) addresses
579579
// in the middle of the 2TiB - 6TiB address range (see issue #372))
580580

581-
#define KK_HINT_BASE ((uintptr_t)2 << 40) // 2TiB start
582-
#define KK_HINT_AREA ((uintptr_t)4 << 40) // upto 6TiB (since before win8 there is "only" 8TiB available to processes)
583-
#define KK_HINT_MAX ((uintptr_t)30 << 40) // wrap after 30TiB (area after 32TiB is used for huge OS pages)
581+
#define MI_HINT_BASE ((uintptr_t)2 << 40) // 2TiB start
582+
#define MI_HINT_AREA ((uintptr_t)4 << 40) // upto 6TiB (since before win8 there is "only" 8TiB available to processes)
583+
#define MI_HINT_MAX ((uintptr_t)30 << 40) // wrap after 30TiB (area after 32TiB is used for huge OS pages)
584584

585585
static void* mi_os_get_aligned_hint(size_t try_alignment, size_t size)
586586
{
587587
if (try_alignment == 0 || try_alignment > MI_SEGMENT_SIZE) return NULL;
588588
size = _mi_align_up(size, MI_SEGMENT_SIZE);
589-
if (size > 1*MI_GiB) return NULL; // guarantee the chance of fixed valid address is at most 1/(KK_HINT_AREA / 1<<30) = 1/4096.
589+
if (size > 1*MI_GiB) return NULL; // guarantee the chance of fixed valid address is at most 1/(MI_HINT_AREA / 1<<30) = 1/4096.
590590
#if (MI_SECURE>0)
591591
size += MI_SEGMENT_SIZE; // put in `MI_SEGMENT_SIZE` virtual gaps between hinted blocks; this splits VLA's but increases guarded areas.
592592
#endif
593593

594594
uintptr_t hint = mi_atomic_add_acq_rel(&aligned_base, size);
595-
if (hint == 0 || hint > KK_HINT_MAX) { // wrap or initialize
596-
uintptr_t init = KK_HINT_BASE;
595+
if (hint == 0 || hint > MI_HINT_MAX) { // wrap or initialize
596+
uintptr_t init = MI_HINT_BASE;
597597
#if (MI_SECURE>0 || MI_DEBUG==0) // security: randomize start of aligned allocations unless in debug mode
598598
uintptr_t r = _mi_heap_random_next(mi_get_default_heap());
599-
init = init + ((MI_SEGMENT_SIZE * ((r>>17) & 0xFFFFF)) % KK_HINT_AREA); // (randomly 20 bits)*4MiB == 0 to 4TiB
599+
init = init + ((MI_SEGMENT_SIZE * ((r>>17) & 0xFFFFF)) % MI_HINT_AREA); // (randomly 20 bits)*4MiB == 0 to 4TiB
600600
#endif
601601
uintptr_t expected = hint + size;
602602
mi_atomic_cas_strong_acq_rel(&aligned_base, &expected, init);
603-
hint = mi_atomic_add_acq_rel(&aligned_base, size); // this may still give 0 or > KK_HINT_MAX but that is ok, it is a hint after all
603+
hint = mi_atomic_add_acq_rel(&aligned_base, size); // this may still give 0 or > MI_HINT_MAX but that is ok, it is a hint after all
604604
}
605605
if (hint%try_alignment != 0) return NULL;
606606
return (void*)hint;
@@ -638,11 +638,11 @@ static void* mi_os_mem_alloc(size_t size, size_t try_alignment, bool commit, boo
638638
if (commit) flags |= MEM_COMMIT;
639639
p = mi_win_virtual_alloc(NULL, size, try_alignment, flags, false, allow_large, is_large);
640640
#elif defined(MI_USE_SBRK)
641-
KK_UNUSED(allow_large);
641+
MI_UNUSED(allow_large);
642642
*is_large = false;
643643
p = mi_sbrk_heap_grow(size, try_alignment);
644644
#elif defined(__wasi__)
645-
KK_UNUSED(allow_large);
645+
MI_UNUSED(allow_large);
646646
*is_large = false;
647647
p = mi_wasm_heap_grow(size, try_alignment);
648648
#else

0 commit comments

Comments
 (0)