From cc2c1893c5fd34f8289484df22a9c324ac6ace6a Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Wed, 5 Jun 2024 04:05:08 -0700 Subject: [PATCH] Fix some nits --- libc/mem/BUILD.mk | 4 ++-- third_party/dlmalloc/threaded.inc | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/libc/mem/BUILD.mk b/libc/mem/BUILD.mk index 3f496846d..84f5c37e1 100644 --- a/libc/mem/BUILD.mk +++ b/libc/mem/BUILD.mk @@ -44,7 +44,7 @@ $(LIBC_MEM_A_OBJS): private \ -Wframe-larger-than=4096 \ -Walloca-larger-than=4096 -o/$(MODE)/libc/intrin/asan.o: private \ +o/$(MODE)/libc/mem/asan.o: private \ CFLAGS += \ -O2 \ -finline \ @@ -58,7 +58,7 @@ o/$(MODE)/libc/intrin/asan.o: private \ -fpatchable-function-entry=0,0 # make asan stack traces shorter -o/$(MODE)/libc/intrin/asanthunk.o: private \ +o/$(MODE)/libc/mem/asanthunk.o: private \ CFLAGS += \ -Os \ $(NO_MAGIC) \ diff --git a/third_party/dlmalloc/threaded.inc b/third_party/dlmalloc/threaded.inc index d13e7ca0a..904201603 100644 --- a/third_party/dlmalloc/threaded.inc +++ b/third_party/dlmalloc/threaded.inc @@ -54,8 +54,7 @@ int dlmallopt(int param_number, int value) { int dlmalloc_trim(size_t pad) { int got_some = 0; for (unsigned i = 0; i < g_heapslen; ++i) - if (g_heaps[i]) - got_some |= mspace_trim(g_heaps[i], pad); + got_some |= mspace_trim(g_heaps[i], pad); return got_some; } @@ -69,8 +68,7 @@ void dlmalloc_inspect_all(void handler(void *start, void *end, size_t used_bytes, void *callback_arg), void *arg) { for (unsigned i = 0; i < g_heapslen; ++i) - if (g_heaps[i]) - mspace_inspect_all(g_heaps[i], handler, arg); + mspace_inspect_all(g_heaps[i], handler, arg); } forceinline mstate get_arena(void) { @@ -166,8 +164,6 @@ static void threaded_dlmalloc(void) { cpus = __get_cpu_count(); if (cpus == -1) heaps = 1; - else if (!IsAarch64() && !X86_HAVE(RDTSCP)) - heaps = 1; else if ((var = getenv("COSMOPOLITAN_HEAP_COUNT"))) heaps = dlmalloc_atoi(var); else