Module Name:    src
Committed By:   martin
Date:           Thu Mar  6 13:41:16 UTC 2025

Modified Files:
        src/external/bsd/jemalloc/include/jemalloc/internal: size_classes.h

Log Message:
PR 59062: make jemalloc guaranteed alignment match previous NetBSD
guarantees.

Current theory is that 1 << LG_TINY_MIN in jemalloc has to match
gcc config's MALLOC_ABI_ALIGNMENT/8 to guarantee full alignment
even for small allocations per the C standard's requirements
linked from the PR.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
    src/external/bsd/jemalloc/include/jemalloc/internal/size_classes.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/jemalloc/include/jemalloc/internal/size_classes.h
diff -u src/external/bsd/jemalloc/include/jemalloc/internal/size_classes.h:1.4 src/external/bsd/jemalloc/include/jemalloc/internal/size_classes.h:1.5
--- src/external/bsd/jemalloc/include/jemalloc/internal/size_classes.h:1.4	Thu Mar 28 11:56:56 2019
+++ src/external/bsd/jemalloc/include/jemalloc/internal/size_classes.h	Thu Mar  6 13:41:16 2025
@@ -35,7 +35,24 @@
  */
 
 #define LG_SIZE_CLASS_GROUP	2
+
+#ifdef __NetBSD__
+#if defined(__hppa__)
+/*
+ * This case would also be needed for aarch64 but NetBSD's gcc config overrides it:
+ * gcc/config/aarch64/aarch64-netbsd.h:#define MALLOC_ABI_ALIGNMENT  64
+ * The NetBSD hppa config is non-standard too and always uses 128 bit (not only
+ * for 64bit code and 64bit alignment for 32bit code).
+ */
+#define LG_TINY_MIN		5
+#elif defined(_LP64) || defined(__arm__)
+#define LG_TINY_MIN		4
+#else
 #define LG_TINY_MIN		3
+#endif
+#else
+#define LG_TINY_MIN		3
+#endif
 
 #if (LG_SIZEOF_PTR == 2 && LG_TINY_MIN == 3 && LG_QUANTUM == 3 && LG_PAGE == 12)
 #define SIZE_CLASSES \

Reply via email to