Module Name:    src
Committed By:   christos
Date:           Wed Apr 24 14:34:22 UTC 2019

Modified Files:
        src/external/bsd/jemalloc/dist/src: pages.c tsd.c

Log Message:
Allow os_page sizes greater than the built-in page size. This can happen
for example for COMPAT_NETBSD32 sparc binaries (4K page size because of
MIN_PAGE_SIZE), running on sparc64 (8K pages).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/jemalloc/dist/src/pages.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/tsd.c

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/dist/src/pages.c
diff -u src/external/bsd/jemalloc/dist/src/pages.c:1.2 src/external/bsd/jemalloc/dist/src/pages.c:1.3
--- src/external/bsd/jemalloc/dist/src/pages.c:1.2	Sat Mar 16 18:14:08 2019
+++ src/external/bsd/jemalloc/dist/src/pages.c	Wed Apr 24 10:34:21 2019
@@ -55,8 +55,8 @@ static void os_pages_unmap(void *addr, s
 
 static void *
 os_pages_map(void *addr, size_t size, size_t alignment, bool *commit) {
-	assert(ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
-	assert(ALIGNMENT_CEILING(size, os_page) == size);
+	assert(os_page != PAGE || ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
+	assert(os_page != PAGE || ALIGNMENT_CEILING(size, os_page) == size);
 	assert(size != 0);
 
 	if (os_overcommits) {
@@ -135,8 +135,8 @@ os_pages_trim(void *addr, size_t alloc_s
 
 static void
 os_pages_unmap(void *addr, size_t size) {
-	assert(ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
-	assert(ALIGNMENT_CEILING(size, os_page) == size);
+	assert(os_page != PAGE || ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
+	assert(os_page != PAGE || ALIGNMENT_CEILING(size, os_page) == size);
 
 #ifdef _WIN32
 	if (VirtualFree(addr, 0, MEM_RELEASE) == 0)
@@ -187,7 +187,7 @@ pages_map_slow(size_t size, size_t align
 void *
 pages_map(void *addr, size_t size, size_t alignment, bool *commit) {
 	assert(alignment >= PAGE);
-	assert(ALIGNMENT_ADDR2BASE(addr, alignment) == addr);
+	assert(os_page != PAGE || ALIGNMENT_ADDR2BASE(addr, alignment) == addr);
 
 	/*
 	 * Ideally, there would be a way to specify alignment to mmap() (like
@@ -570,7 +570,7 @@ label_error:
 bool
 pages_boot(void) {
 	os_page = os_page_detect();
-	if (os_page > PAGE) {
+	if (os_page < PAGE) {
 		malloc_write("<jemalloc>: Unsupported system page size\n");
 		if (opt_abort) {
 			abort();

Index: src/external/bsd/jemalloc/dist/src/tsd.c
diff -u src/external/bsd/jemalloc/dist/src/tsd.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/tsd.c:1.2
--- src/external/bsd/jemalloc/dist/src/tsd.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/tsd.c	Wed Apr 24 10:34:21 2019
@@ -39,7 +39,10 @@ struct tsd_init_head_s {
 pthread_key_t tsd_tsd;
 tsd_init_head_t	tsd_init_head = {
 	ql_head_initializer(blocks),
+#ifndef __lint__
+	// XXX: broken lint
 	MALLOC_MUTEX_INITIALIZER
+#endif
 };
 tsd_wrapper_t tsd_boot_wrapper = {
 	false,

Reply via email to