From 2b0b119b6d8b2156daea108c3241efa2238ca475 Mon Sep 17 00:00:00 2001 From: Aliaksey Kandratsenka Date: Wed, 29 May 2024 17:21:45 -0400 Subject: [PATCH] always use full 64 bits of address on Solaris Solaris has somewhat nice behavior of mmaps where high bits of address are set. It still uses only 48 bits of address on x86 (and, presumably, 64-bit arm), just with somewhat non-standard way. But this behavior causes some inconveniences to us. In particular, we had to disable mmap sys allocator and had failing emergency malloc tests (due to assertion in TryGetSizeClass in CheckCachedSizeClass). We could consider more comprehensive fix, but lets just do "honest" 64-bit addresses at least for now. --- src/common.h | 2 +- src/system-alloc.cc | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/common.h b/src/common.h index a76799d..aa6bb15 100644 --- a/src/common.h +++ b/src/common.h @@ -116,7 +116,7 @@ static const int kMaxDynamicFreeListLength = 8192; static const Length kMaxValidPages = (~static_cast(0)) >> kPageShift; -#if __aarch64__ || __x86_64__ || _M_AMD64 || _M_ARM64 +#if (__aarch64__ || __x86_64__ || _M_AMD64 || _M_ARM64) && !__sun__ // All current x86_64 processors only look at the lower 48 bits in // virtual to physical address translation. The top 16 are all same as // bit 47. And bit 47 value 1 reserved for kernel-space addresses in diff --git a/src/system-alloc.cc b/src/system-alloc.cc index 14c8ae2..b80e9ec 100644 --- a/src/system-alloc.cc +++ b/src/system-alloc.cc @@ -382,12 +382,6 @@ void InitSystemAllocators(void) { // pointer). DefaultSysAllocator *sdef = default_space.Construct(); bool want_mmap = kDebugMode && (sizeof(void*) > 4); -#if __sun__ - // TODO: solaris has nice but annoying feature that makes it use - // full range of addresses and mmap tends to use it. Making mmap-ed - // addresses be 0xffff... For now lets avoid the trouble. - want_mmap = false; -#endif if (want_mmap) { sdef->SetChildAllocator(mmap, 0, mmap_name); sdef->SetChildAllocator(sbrk, 1, sbrk_name);