CVS commit: src/external/bsd/jemalloc/dist/src

2020-09-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep  6 16:30:41 UTC 2020

Modified Files:
src/external/bsd/jemalloc/dist/src: malloc_io.c

Log Message:
Appease gcc-9


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/jemalloc/dist/src/malloc_io.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/malloc_io.c
diff -u src/external/bsd/jemalloc/dist/src/malloc_io.c:1.2 src/external/bsd/jemalloc/dist/src/malloc_io.c:1.3
--- src/external/bsd/jemalloc/dist/src/malloc_io.c:1.2	Mon Mar  4 12:16:27 2019
+++ src/external/bsd/jemalloc/dist/src/malloc_io.c	Sun Sep  6 12:30:41 2020
@@ -362,29 +362,29 @@ malloc_vsnprintf(char *str, size_t size,
 	}\
 } while (0)
 #define GET_ARG_NUMERIC(val, len) do {	\
-	switch (len) {			\
+	switch ((unsigned int)len) {	\
 	case '?':			\
 		val = va_arg(ap, int);	\
 		break;			\
-	case '?' | 0x80:		\
+	case '?' | 0x80U:		\
 		val = va_arg(ap, unsigned int);\
 		break;			\
 	case 'l':			\
 		val = va_arg(ap, long);	\
 		break;			\
-	case 'l' | 0x80:		\
+	case 'l' | 0x80U:		\
 		val = va_arg(ap, unsigned long);			\
 		break;			\
 	case 'q':			\
 		val = va_arg(ap, long long);\
 		break;			\
-	case 'q' | 0x80:		\
+	case 'q' | 0x80U:		\
 		val = va_arg(ap, unsigned long long);			\
 		break;			\
 	case 'j':			\
 		val = va_arg(ap, intmax_t);\
 		break;			\
-	case 'j' | 0x80:		\
+	case 'j' | 0x80U:		\
 		val = va_arg(ap, uintmax_t);\
 		break;			\
 	case 't':			\
@@ -393,7 +393,7 @@ malloc_vsnprintf(char *str, size_t size,
 	case 'z':			\
 		val = va_arg(ap, ssize_t);\
 		break;			\
-	case 'z' | 0x80:		\
+	case 'z' | 0x80U:		\
 		val = va_arg(ap, size_t);\
 		break;			\
 	case 'p': /* Synthetic; used for %p. */\



CVS commit: src/external/bsd/jemalloc/dist/src

2020-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 14:34:42 UTC 2020

Modified Files:
src/external/bsd/jemalloc/dist/src: mutex.c

Log Message:
When using default mutex types, don't setup attributes for init.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/jemalloc/dist/src/mutex.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/mutex.c
diff -u src/external/bsd/jemalloc/dist/src/mutex.c:1.2 src/external/bsd/jemalloc/dist/src/mutex.c:1.3
--- src/external/bsd/jemalloc/dist/src/mutex.c:1.2	Mon Mar  4 17:16:46 2019
+++ src/external/bsd/jemalloc/dist/src/mutex.c	Fri May 15 14:34:41 2020
@@ -157,6 +157,9 @@ malloc_mutex_init(malloc_mutex_t *mutex,
 			return true;
 		}
 	}
+#elif MALLOC_MUTEX_TYPE == PTHREAD_MUTEX_DEFAULT
+	if (pthread_mutex_init(>lock, NULL) == -1)
+		return true;
 #else
 	pthread_mutexattr_t attr;
 



CVS commit: src/external/bsd/jemalloc/dist/src

2020-02-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 15 09:57:30 UTC 2020

Modified Files:
src/external/bsd/jemalloc/dist/src: tcache.c

Log Message:
jemalloc: Avoid variable length array with length 0

Cherry-pick upstrem patch.

https://github.com/jemalloc/jemalloc/pull/1768


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/tcache.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/tcache.c
diff -u src/external/bsd/jemalloc/dist/src/tcache.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/tcache.c:1.2
--- src/external/bsd/jemalloc/dist/src/tcache.c:1.1.1.1	Mon Mar  4 17:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/tcache.c	Sat Feb 15 09:57:30 2020
@@ -111,7 +111,8 @@ tcache_bin_flush_small(tsd_t *tsd, tcach
 	arena_t *arena = tcache->arena;
 	assert(arena != NULL);
 	unsigned nflush = tbin->ncached - rem;
-	VARIABLE_ARRAY(extent_t *, item_extent, nflush);
+	/* Variable length array must have > 0 length. */
+	VARIABLE_ARRAY(extent_t *, item_extent, nflush + + 1);
 	/* Look up extent once per item. */
 	for (unsigned i = 0 ; i < nflush; i++) {
 		item_extent[i] = iealloc(tsd_tsdn(tsd), *(tbin->avail - 1 - i));
@@ -196,7 +197,8 @@ tcache_bin_flush_large(tsd_t *tsd, cache
 	arena_t *arena = tcache->arena;
 	assert(arena != NULL);
 	unsigned nflush = tbin->ncached - rem;
-	VARIABLE_ARRAY(extent_t *, item_extent, nflush);
+	/* Variable length array must have > 0 length. */
+	VARIABLE_ARRAY(extent_t *, item_extent, nflush + 1);
 	/* Look up extent once per item. */
 	for (unsigned i = 0 ; i < nflush; i++) {
 		item_extent[i] = iealloc(tsd_tsdn(tsd), *(tbin->avail - 1 - i));



CVS commit: src/external/bsd/jemalloc/dist/src

2020-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan  6 20:35:11 UTC 2020

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

Log Message:
set that NetBSD overcommits (from maya)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/jemalloc/dist/src/pages.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.5 src/external/bsd/jemalloc/dist/src/pages.c:1.6
--- src/external/bsd/jemalloc/dist/src/pages.c:1.5	Fri Apr 26 19:57:59 2019
+++ src/external/bsd/jemalloc/dist/src/pages.c	Mon Jan  6 15:35:11 2020
@@ -592,6 +592,8 @@ pages_boot(void) {
 		mmap_flags |= MAP_NORESERVE;
 	}
 #  endif
+#elif defined(__NetBSD__)
+	os_overcommits = true;
 #else
 	os_overcommits = false;
 #endif



CVS commit: src/external/bsd/jemalloc/dist/src

2019-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 26 23:57:59 UTC 2019

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

Log Message:
Enforce alignment also if the compiled in PAGE_SIZE is bigger than
getpagesize()


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/jemalloc/dist/src/pages.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.4 src/external/bsd/jemalloc/dist/src/pages.c:1.5
--- src/external/bsd/jemalloc/dist/src/pages.c:1.4	Fri Apr 26 10:58:56 2019
+++ src/external/bsd/jemalloc/dist/src/pages.c	Fri Apr 26 19:57:59 2019
@@ -79,9 +79,10 @@ os_pages_map(void *addr, size_t size, si
 	{
 		int flags = mmap_flags;
 #ifdef MAP_ALIGNED
-		int a = ilog2(alignment);
-		if (a > LG_PAGE && a < ilog2(sizeof(void *)))
+		if (alignment > os_page || PAGE > os_page) {
+			int a = ilog2(MAX(alignment, PAGE));
 			flags |= MAP_ALIGNED(a);
+		}
 #endif
 		int prot = *commit ? PAGES_PROT_COMMIT : PAGES_PROT_DECOMMIT;
 



CVS commit: src/external/bsd/jemalloc/dist/src

2019-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 26 14:58:56 UTC 2019

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

Log Message:
Undo previous, it is moving us in the wrong direction.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/jemalloc/dist/src/pages.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.3 src/external/bsd/jemalloc/dist/src/pages.c:1.4
--- src/external/bsd/jemalloc/dist/src/pages.c:1.3	Wed Apr 24 10:34:21 2019
+++ src/external/bsd/jemalloc/dist/src/pages.c	Fri Apr 26 10:58:56 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(os_page != PAGE || ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
-	assert(os_page != PAGE || ALIGNMENT_CEILING(size, os_page) == size);
+	assert(ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
+	assert(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(os_page != PAGE || ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
-	assert(os_page != PAGE || ALIGNMENT_CEILING(size, os_page) == size);
+	assert(ALIGNMENT_ADDR2BASE(addr, os_page) == addr);
+	assert(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(os_page != PAGE || ALIGNMENT_ADDR2BASE(addr, alignment) == addr);
+	assert(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(": Unsupported system page size\n");
 		if (opt_abort) {
 			abort();



CVS commit: src/external/bsd/jemalloc/dist/src

2019-04-24 Thread Christos Zoulas
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(": 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,



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 16 22:14:09 UTC 2019

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

Log Message:
we have MAP_ALIGNED, so use it (although it does not do anything by default)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/pages.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.1.1.1 src/external/bsd/jemalloc/dist/src/pages.c:1.2
--- src/external/bsd/jemalloc/dist/src/pages.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/pages.c	Sat Mar 16 18:14:08 2019
@@ -14,6 +14,9 @@
 #include 
 #endif
 #endif
+#ifdef MAP_ALIGNED
+#include 	/* NetBSD */
+#endif
 
 /**/
 /* Data. */
@@ -74,9 +77,15 @@ os_pages_map(void *addr, size_t size, si
 	 * of existing mappings, and we only want to create new mappings.
 	 */
 	{
+		int flags = mmap_flags;
+#ifdef MAP_ALIGNED
+		int a = ilog2(alignment);
+		if (a > LG_PAGE && a < ilog2(sizeof(void *)))
+			flags |= MAP_ALIGNED(a);
+#endif
 		int prot = *commit ? PAGES_PROT_COMMIT : PAGES_PROT_DECOMMIT;
 
-		ret = mmap(addr, size, prot, mmap_flags, -1, 0);
+		ret = mmap(addr, size, prot, flags, -1, 0);
 	}
 	assert(ret != NULL);
 



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 16 21:32:04 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: extent.c

Log Message:
PR/54062: Fix the "snprintf_float" test failing after the jemalloc import
issue: jemalloc uses a lot more memory (if it can find it) by default and
this test limited the amount of memory it could get, causing it to get to
an error path with a missing mutex_unlock...


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/jemalloc/dist/src/extent.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/extent.c
diff -u src/external/bsd/jemalloc/dist/src/extent.c:1.3 src/external/bsd/jemalloc/dist/src/extent.c:1.4
--- src/external/bsd/jemalloc/dist/src/extent.c:1.3	Sun Mar 10 15:34:30 2019
+++ src/external/bsd/jemalloc/dist/src/extent.c	Sat Mar 16 17:32:04 2019
@@ -748,6 +748,7 @@ extent_register_impl(tsdn_t *tsdn, exten
 
 	if (extent_rtree_leaf_elms_lookup(tsdn, rtree_ctx, extent, false, true,
 	_a, _b)) {
+		extent_unlock(tsdn, extent);
 		return true;
 	}
 



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 14 21:49:32 UTC 2019

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

Log Message:
revert previous sshd hack (from Rin Okuyama)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/jemalloc/dist/src/jemalloc.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/jemalloc.c
diff -u src/external/bsd/jemalloc/dist/src/jemalloc.c:1.6 src/external/bsd/jemalloc/dist/src/jemalloc.c:1.7
--- src/external/bsd/jemalloc/dist/src/jemalloc.c:1.6	Tue Mar 12 11:13:25 2019
+++ src/external/bsd/jemalloc/dist/src/jemalloc.c	Thu Mar 14 17:49:32 2019
@@ -2339,14 +2339,9 @@ je_realloc(void *ptr, size_t size) {
 tcache = NULL;
 			}
 			ifree(tsd, ptr, tcache, true);
-#ifdef notyet
-			/*
-			 * sshd depends on realloc(p, 0) returning non-NULL
-			 * disable for compatibility for now
-			 */
+
 			LOG("core.realloc.exit", "result: %p", NULL);
 			return NULL;
-#endif
 		}
 		size = 1;
 	}



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 14 21:10:33 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: arena.c

Log Message:
Grr, disable the "time goes backwards" test here since this breaks too
frequently. We need a real fix.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/jemalloc/dist/src/arena.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/arena.c
diff -u src/external/bsd/jemalloc/dist/src/arena.c:1.2 src/external/bsd/jemalloc/dist/src/arena.c:1.3
--- src/external/bsd/jemalloc/dist/src/arena.c:1.2	Mon Mar 11 14:06:28 2019
+++ src/external/bsd/jemalloc/dist/src/arena.c	Thu Mar 14 17:10:33 2019
@@ -642,9 +642,11 @@ arena_maybe_decay(tsdn_t *tsdn, arena_t 
 		 */
 		nstime_copy(>epoch, );
 		arena_decay_deadline_init(decay);
+#ifndef __NetBSD__
 	} else {
 		/* Verify that time does not go backwards. */
 		assert(nstime_compare(>epoch, ) <= 0);
+#endif
 	}
 
 	/*



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 18:06:28 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: arena.c

Log Message:
Add an initializatin that is not needed when the optimizer works...


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/arena.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/arena.c
diff -u src/external/bsd/jemalloc/dist/src/arena.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/arena.c:1.2
--- src/external/bsd/jemalloc/dist/src/arena.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/arena.c	Mon Mar 11 14:06:28 2019
@@ -867,7 +867,8 @@ arena_decay_impl(tsdn_t *tsdn, arena_t *
 	if (epoch_advanced) {
 		/* Backlog is updated on epoch advance. */
 		npages_new = decay->backlog[SMOOTHSTEP_NSTEPS-1];
-	}
+	} else
+		npages_new = 0;	// XXX: gcc without -O
 	malloc_mutex_unlock(tsdn, >mtx);
 
 	if (have_background_thread && background_thread_enabled() &&



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 19:34:30 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: extent.c jemalloc.c prof.c rtree.c
witness.c

Log Message:
Add noreturn where needed. In the prof case because of cassert() and return
in some functions we disable the cassert() for clang. We should really have
a JEMALLOC_PROF_NORETURN and a way to mark the remaining of the function
unreachable.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/jemalloc/dist/src/extent.c \
src/external/bsd/jemalloc/dist/src/prof.c
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/jemalloc/dist/src/jemalloc.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/rtree.c \
src/external/bsd/jemalloc/dist/src/witness.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/extent.c
diff -u src/external/bsd/jemalloc/dist/src/extent.c:1.2 src/external/bsd/jemalloc/dist/src/extent.c:1.3
--- src/external/bsd/jemalloc/dist/src/extent.c:1.2	Mon Mar  4 12:20:07 2019
+++ src/external/bsd/jemalloc/dist/src/extent.c	Sun Mar 10 15:34:30 2019
@@ -697,7 +697,7 @@ extent_interior_register(tsdn_t *tsdn, r
 	}
 }
 
-static void
+static JEMALLOC_NORETURN void
 extent_gdump_add(tsdn_t *tsdn, const extent_t *extent) {
 	cassert(config_prof);
 	/* prof_gdump() requirement. */
@@ -723,7 +723,7 @@ extent_gdump_add(tsdn_t *tsdn, const ext
 	}
 }
 
-static void
+static JEMALLOC_NORETURN void
 extent_gdump_sub(tsdn_t *tsdn, const extent_t *extent) {
 	cassert(config_prof);
 
Index: src/external/bsd/jemalloc/dist/src/prof.c
diff -u src/external/bsd/jemalloc/dist/src/prof.c:1.2 src/external/bsd/jemalloc/dist/src/prof.c:1.3
--- src/external/bsd/jemalloc/dist/src/prof.c:1.2	Mon Mar  4 12:18:53 2019
+++ src/external/bsd/jemalloc/dist/src/prof.c	Sun Mar 10 15:34:30 2019
@@ -207,7 +207,7 @@ rb_gen(static UNUSED, tdata_tree_, prof_
 
 /**/
 
-void
+JEMALLOC_NORETURN void
 prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated) {
 	prof_tdata_t *tdata;
 
@@ -237,7 +237,7 @@ prof_alloc_rollback(tsd_t *tsd, prof_tct
 	}
 }
 
-void
+JEMALLOC_NORETURN void
 prof_malloc_sample_object(tsdn_t *tsdn, const void *ptr, size_t usize,
 prof_tctx_t *tctx) {
 	prof_tctx_set(tsdn, ptr, usize, NULL, tctx);
@@ -268,7 +268,7 @@ prof_free_sampled_object(tsd_t *tsd, siz
 	}
 }
 
-void
+JEMALLOC_NORETURN void
 bt_init(prof_bt_t *bt, void **vec) {
 	cassert(config_prof);
 
@@ -276,7 +276,7 @@ bt_init(prof_bt_t *bt, void **vec) {
 	bt->len = 0;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_enter(tsd_t *tsd, prof_tdata_t *tdata) {
 	cassert(config_prof);
 	assert(tdata == prof_tdata_get(tsd, false));
@@ -289,7 +289,7 @@ prof_enter(tsd_t *tsd, prof_tdata_t *tda
 	malloc_mutex_lock(tsd_tsdn(tsd), _mtx);
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_leave(tsd_t *tsd, prof_tdata_t *tdata) {
 	cassert(config_prof);
 	assert(tdata == prof_tdata_get(tsd, false));
@@ -530,7 +530,7 @@ prof_backtrace(prof_bt_t *bt) {
 #undef BT_FRAME
 }
 #else
-void
+JEMALLOC_NORETURN void
 prof_backtrace(prof_bt_t *bt) {
 	cassert(config_prof);
 	not_reached();
@@ -575,7 +575,7 @@ prof_gctx_create(tsdn_t *tsdn, prof_bt_t
 	return gctx;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_gctx_try_destroy(tsd_t *tsd, prof_tdata_t *tdata_self, prof_gctx_t *gctx,
 prof_tdata_t *tdata) {
 	cassert(config_prof);
@@ -1175,7 +1175,7 @@ label_return:
 	return ret;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_dump_gctx_prep(tsdn_t *tsdn, prof_gctx_t *gctx, prof_gctx_tree_t *gctxs) {
 	cassert(config_prof);
 
@@ -1548,7 +1548,7 @@ label_return:
 	return ret;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_dump_prep(tsd_t *tsd, prof_tdata_t *tdata,
 struct prof_tdata_merge_iter_arg_s *prof_tdata_merge_iter_arg,
 struct prof_gctx_merge_iter_arg_s *prof_gctx_merge_iter_arg,
@@ -1719,7 +1719,7 @@ prof_cnt_all(uint64_t *curobjs, uint64_t
 
 #define DUMP_FILENAME_BUFSIZE	(PATH_MAX + 1)
 #define VSEQ_INVALID		UINT64_C(0x)
-static void
+static JEMALLOC_NORETURN void
 prof_dump_filename(char *filename, char v, uint64_t vseq) {
 	cassert(config_prof);
 
@@ -1741,8 +1741,9 @@ static void
 prof_fdump(void) {
 	tsd_t *tsd;
 	char filename[DUMP_FILENAME_BUFSIZE];
-
+#ifndef __clang__
 	cassert(config_prof);
+#endif
 	assert(opt_prof_final);
 	assert(opt_prof_prefix[0] != '\0');
 
@@ -1778,8 +1779,9 @@ void
 prof_idump(tsdn_t *tsdn) {
 	tsd_t *tsd;
 	prof_tdata_t *tdata;
-
+#ifndef __clang__
 	cassert(config_prof);
+#endif
 
 	if (!prof_booted || tsdn_null(tsdn) || !prof_active_get_unlocked()) {
 		return;
@@ -1835,8 +1837,9 @@ void
 prof_gdump(tsdn_t *tsdn) {
 	tsd_t *tsd;
 	prof_tdata_t *tdata;
-
+#ifndef __clang__
 	cassert(config_prof);
+#endif
 
 	if (!prof_booted 

CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 19:15:39 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: base.c

Log Message:
put back __UNCONST for now.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/jemalloc/dist/src/base.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/base.c
diff -u src/external/bsd/jemalloc/dist/src/base.c:1.2 src/external/bsd/jemalloc/dist/src/base.c:1.3
--- src/external/bsd/jemalloc/dist/src/base.c:1.2	Mon Mar  4 12:19:45 2019
+++ src/external/bsd/jemalloc/dist/src/base.c	Mon Mar  4 14:15:39 2019
@@ -509,6 +509,7 @@ base_postfork_child(tsdn_t *tsdn, base_t
 
 bool
 base_boot(tsdn_t *tsdn) {
-	b0 = base_new(tsdn, 0, (extent_hooks_t *)__UNCONST(_hooks_default));
+	b0 = base_new(tsdn, 0, (extent_hooks_t *)
+	__UNCONST(_hooks_default));
 	return (b0 == NULL);
 }



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 17:21:31 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: ckh.c ctl.c

Log Message:
- add unconst
- fixes for shadowing


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/ckh.c \
src/external/bsd/jemalloc/dist/src/ctl.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/ckh.c
diff -u src/external/bsd/jemalloc/dist/src/ckh.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/ckh.c:1.2
--- src/external/bsd/jemalloc/dist/src/ckh.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/ckh.c	Mon Mar  4 12:21:31 2019
@@ -356,14 +356,14 @@ ckh_shrink(tsd_t *tsd, ckh_t *ckh) {
 }
 
 bool
-ckh_new(tsd_t *tsd, ckh_t *ckh, size_t minitems, ckh_hash_t *hash,
+ckh_new(tsd_t *tsd, ckh_t *ckh, size_t minitems, ckh_hash_t *hashp,
 ckh_keycomp_t *keycomp) {
 	bool ret;
 	size_t mincells, usize;
 	unsigned lg_mincells;
 
 	assert(minitems > 0);
-	assert(hash != NULL);
+	assert(hashp != NULL);
 	assert(keycomp != NULL);
 
 #ifdef CKH_COUNT
@@ -392,7 +392,7 @@ ckh_new(tsd_t *tsd, ckh_t *ckh, size_t m
 	}
 	ckh->lg_minbuckets = lg_mincells - LG_CKH_BUCKET_CELLS;
 	ckh->lg_curbuckets = lg_mincells - LG_CKH_BUCKET_CELLS;
-	ckh->hash = hash;
+	ckh->hash = hashp;
 	ckh->keycomp = keycomp;
 
 	usize = sz_sa2u(sizeof(ckhc_t) << lg_mincells, CACHELINE);
@@ -449,10 +449,10 @@ ckh_iter(ckh_t *ckh, size_t *tabind, voi
 	LG_CKH_BUCKET_CELLS)); i < ncells; i++) {
 		if (ckh->tab[i].key != NULL) {
 			if (key != NULL) {
-*key = (void *)ckh->tab[i].key;
+*key = (void *)__UNCONST(ckh->tab[i].key);
 			}
 			if (data != NULL) {
-*data = (void *)ckh->tab[i].data;
+*data = (void *)__UNCONST(ckh->tab[i].data);
 			}
 			*tabind = i + 1;
 			return false;
@@ -495,10 +495,10 @@ ckh_remove(tsd_t *tsd, ckh_t *ckh, const
 	cell = ckh_isearch(ckh, searchkey);
 	if (cell != SIZE_T_MAX) {
 		if (key != NULL) {
-			*key = (void *)ckh->tab[cell].key;
+			*key = (void *)__UNCONST(ckh->tab[cell].key);
 		}
 		if (data != NULL) {
-			*data = (void *)ckh->tab[cell].data;
+			*data = (void *)__UNCONST(ckh->tab[cell].data);
 		}
 		ckh->tab[cell].key = NULL;
 		ckh->tab[cell].data = NULL; /* Not necessary. */
@@ -527,10 +527,10 @@ ckh_search(ckh_t *ckh, const void *searc
 	cell = ckh_isearch(ckh, searchkey);
 	if (cell != SIZE_T_MAX) {
 		if (key != NULL) {
-			*key = (void *)ckh->tab[cell].key;
+			*key = (void *)__UNCONST(ckh->tab[cell].key);
 		}
 		if (data != NULL) {
-			*data = (void *)ckh->tab[cell].data;
+			*data = (void *)__UNCONST(ckh->tab[cell].data);
 		}
 		return false;
 	}
@@ -548,7 +548,7 @@ ckh_string_keycomp(const void *k1, const
 	assert(k1 != NULL);
 	assert(k2 != NULL);
 
-	return !strcmp((char *)k1, (char *)k2);
+	return !strcmp((const char *)k1, (const char *)k2);
 }
 
 void
Index: src/external/bsd/jemalloc/dist/src/ctl.c
diff -u src/external/bsd/jemalloc/dist/src/ctl.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/ctl.c:1.2
--- src/external/bsd/jemalloc/dist/src/ctl.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/ctl.c	Mon Mar  4 12:21:31 2019
@@ -234,7 +234,7 @@ CTL_PROTO(stats_mutexes_reset)
 #define NAME(n)	{true},	n
 #define CHILD(t, c)			\
 	sizeof(c##_node) / sizeof(ctl_##t##_node_t),			\
-	(ctl_node_t *)c##_node,		\
+	(const ctl_node_t *)c##_node,	\
 	NULL
 #define CTL(c)	0, NULL, c##_ctl
 
@@ -1299,14 +1299,14 @@ ctl_postfork_child(tsdn_t *tsdn) {
 		ret = EPERM;		\
 		goto label_return;	\
 	}\
-} while (0)
+} while (/*CONSTCOND*/0)
 
 #define WRITEONLY()	do {		\
 	if (oldp != NULL || oldlenp != NULL) {\
 		ret = EPERM;		\
 		goto label_return;	\
 	}\
-} while (0)
+} while (/*CONSTCOND*/0)
 
 #define READ_XOR_WRITE()	do {	\
 	if ((oldp != NULL && oldlenp != NULL) && (newp != NULL ||	\
@@ -1314,7 +1314,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
 		ret = EPERM;		\
 		goto label_return;	\
 	}\
-} while (0)
+} while (/*CONSTCOND*/0)
 
 #define READ(v, t)	do {		\
 	if (oldp != NULL && oldlenp != NULL) {\
@@ -1327,7 +1327,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
 		}			\
 		*(t *)oldp = (v);	\
 	}\
-} while (0)
+} while (/*CONSTCOND*/0)
 
 #define WRITE(v, t)	do {		\
 	if (newp != NULL) {		\
@@ -1337,7 +1337,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
 		}			\
 		(v) = *(t *)newp;	\
 	}\
-} while (0)
+} while (/*CONSTCOND*/0)
 
 #define MIB_UNSIGNED(v, i) do {		\
 	if (mib[i] > UINT_MAX) {	\
@@ -1345,7 +1345,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
 		goto label_return;	\
 	}\
 	v = (unsigned)mib[i];		\
-} while (0)
+} while (/*CONSTCOND*/0)
 
 /*
  * There's a lot of code duplication in the following macros due to limitations
@@ -2262,7 +2262,7 @@ arena_i_extent_hooks_ctl(tsd_t 

CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 17:20:07 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: extent.c

Log Message:
fix for shadowing.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/extent.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/extent.c
diff -u src/external/bsd/jemalloc/dist/src/extent.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/extent.c:1.2
--- src/external/bsd/jemalloc/dist/src/extent.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/extent.c	Mon Mar  4 12:20:07 2019
@@ -1113,14 +1113,14 @@ extent_recycle(tsdn_t *tsdn, arena_t *ar
 
 	if (*zero) {
 		void *addr = extent_base_get(extent);
-		size_t size = extent_size_get(extent);
+		size_t sz = extent_size_get(extent);
 		if (!extent_zeroed_get(extent)) {
-			if (pages_purge_forced(addr, size)) {
-memset(addr, 0, size);
+			if (pages_purge_forced(addr, sz)) {
+memset(addr, 0, sz);
 			}
 		} else if (config_debug) {
 			size_t *p = (size_t *)(uintptr_t)addr;
-			for (size_t i = 0; i < size / sizeof(size_t); i++) {
+			for (size_t i = 0; i < sz / sizeof(size_t); i++) {
 assert(p[i] == 0);
 			}
 		}
@@ -1365,18 +1365,18 @@ extent_grow_retained(tsdn_t *tsdn, arena
 		extent_addr_randomize(tsdn, extent, alignment);
 	}
 	if (slab) {
-		rtree_ctx_t rtree_ctx_fallback;
-		rtree_ctx_t *rtree_ctx = tsdn_rtree_ctx(tsdn,
-		_ctx_fallback);
+		rtree_ctx_t rtree_ctx_fallback1;
+		rtree_ctx_t *rtree_ctx1 = tsdn_rtree_ctx(tsdn,
+		_ctx_fallback1);
 
 		extent_slab_set(extent, true);
-		extent_interior_register(tsdn, rtree_ctx, extent, szind);
+		extent_interior_register(tsdn, rtree_ctx1, extent, szind);
 	}
 	if (*zero && !extent_zeroed_get(extent)) {
 		void *addr = extent_base_get(extent);
-		size_t size = extent_size_get(extent);
-		if (pages_purge_forced(addr, size)) {
-			memset(addr, 0, size);
+		size_t sz = extent_size_get(extent);
+		if (pages_purge_forced(addr, sz)) {
+			memset(addr, 0, sz);
 		}
 	}
 



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 17:19:45 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: base.c

Log Message:
add __UNCONST


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/base.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/base.c
diff -u src/external/bsd/jemalloc/dist/src/base.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/base.c:1.2
--- src/external/bsd/jemalloc/dist/src/base.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/base.c	Mon Mar  4 12:19:45 2019
@@ -509,6 +509,6 @@ base_postfork_child(tsdn_t *tsdn, base_t
 
 bool
 base_boot(tsdn_t *tsdn) {
-	b0 = base_new(tsdn, 0, (extent_hooks_t *)_hooks_default);
+	b0 = base_new(tsdn, 0, (extent_hooks_t *)__UNCONST(_hooks_default));
 	return (b0 == NULL);
 }



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 17:18:53 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: prof.c

Log Message:
- add UNCONST
- fix for shadowing


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/prof.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/prof.c
diff -u src/external/bsd/jemalloc/dist/src/prof.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/prof.c:1.2
--- src/external/bsd/jemalloc/dist/src/prof.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/prof.c	Mon Mar  4 12:18:53 2019
@@ -1267,7 +1267,7 @@ struct prof_tdata_merge_iter_arg_s {
 };
 
 static prof_tdata_t *
-prof_tdata_merge_iter(prof_tdata_tree_t *tdatas, prof_tdata_t *tdata,
+prof_tdata_merge_iter(prof_tdata_tree_t *tdatasunused, prof_tdata_t *tdata,
 void *opaque) {
 	struct prof_tdata_merge_iter_arg_s *arg =
 	(struct prof_tdata_merge_iter_arg_s *)opaque;
@@ -1302,7 +1302,7 @@ prof_tdata_merge_iter(prof_tdata_tree_t 
 }
 
 static prof_tdata_t *
-prof_tdata_dump_iter(prof_tdata_tree_t *tdatas, prof_tdata_t *tdata,
+prof_tdata_dump_iter(prof_tdata_tree_t *tdatasunused, prof_tdata_t *tdata,
 void *arg) {
 	bool propagate_err = *(bool *)arg;
 
@@ -1867,7 +1867,7 @@ prof_gdump(tsdn_t *tsdn) {
 
 static void
 prof_bt_hash(const void *key, size_t r_hash[2]) {
-	prof_bt_t *bt = (prof_bt_t *)key;
+	const prof_bt_t *bt = (const prof_bt_t *)key;
 
 	cassert(config_prof);
 
@@ -1876,8 +1876,8 @@ prof_bt_hash(const void *key, size_t r_h
 
 static bool
 prof_bt_keycomp(const void *k1, const void *k2) {
-	const prof_bt_t *bt1 = (prof_bt_t *)k1;
-	const prof_bt_t *bt2 = (prof_bt_t *)k2;
+	const prof_bt_t *bt1 = (const prof_bt_t *)k1;
+	const prof_bt_t *bt2 = (const prof_bt_t *)k2;
 
 	cassert(config_prof);
 
@@ -2050,7 +2050,7 @@ prof_tdata_expire(tsdn_t *tsdn, prof_tda
 }
 
 static prof_tdata_t *
-prof_tdata_reset_iter(prof_tdata_tree_t *tdatas, prof_tdata_t *tdata,
+prof_tdata_reset_iter(prof_tdata_tree_t *tdatasunused, prof_tdata_t *tdata,
 void *arg) {
 	tsdn_t *tsdn = (tsdn_t *)arg;
 
@@ -2141,7 +2141,7 @@ prof_thread_name_alloc(tsdn_t *tsdn, con
 
 	size = strlen(thread_name) + 1;
 	if (size == 1) {
-		return "";
+		return __UNCONST(""); // XXX
 	}
 
 	ret = iallocztm(tsdn, size, sz_size2index(size), false, NULL, true,
@@ -2170,7 +2170,7 @@ prof_thread_name_set(tsd_t *tsd, const c
 	}
 	for (i = 0; thread_name[i] != '\0'; i++) {
 		char c = thread_name[i];
-		if (!isgraph(c) && !isblank(c)) {
+		if (!isgraph((unsigned char)c) && !isblank((unsigned char)c)) {
 			return EFAULT;
 		}
 	}



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 17:19:14 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: hooks.c

Log Message:
fix prototypes


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/hooks.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/hooks.c
diff -u src/external/bsd/jemalloc/dist/src/hooks.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/hooks.c:1.2
--- src/external/bsd/jemalloc/dist/src/hooks.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/hooks.c	Mon Mar  4 12:19:14 2019
@@ -6,7 +6,7 @@
  * from outside the generated library, so that we can use them in test code.
  */
 JEMALLOC_EXPORT
-void (*hooks_arena_new_hook)() = NULL;
+void (*hooks_arena_new_hook)(void) = NULL;
 
 JEMALLOC_EXPORT
-void (*hooks_libc_hook)() = NULL;
+void (*hooks_libc_hook)(void) = NULL;



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 17:18:27 UTC 2019

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

Log Message:
- fix for shadowing
- add unconst
- add hack for broken lint
- add cast for ctype macros
- disable realloc(ptr, 0) returning NULL for non-NULL ptr (compatibility)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/jemalloc.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/jemalloc.c
diff -u src/external/bsd/jemalloc/dist/src/jemalloc.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/jemalloc.c:1.2
--- src/external/bsd/jemalloc/dist/src/jemalloc.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/jemalloc.c	Mon Mar  4 12:18:27 2019
@@ -157,7 +157,12 @@ static const void (WINAPI *init_init_loc
 #endif
 #endif
 #else
+#ifndef __lint__
+// Broken lint
 static malloc_mutex_t	init_lock = MALLOC_MUTEX_INITIALIZER;
+#else
+static malloc_mutex_t	init_lock;
+#endif
 #endif
 
 typedef struct {
@@ -562,8 +567,8 @@ arena_choose_hard(tsd_t *tsd, bool inter
 /* Initialize a new arena. */
 choose[j] = first_null;
 arena = arena_init_locked(tsd_tsdn(tsd),
-choose[j],
-(extent_hooks_t *)_hooks_default);
+choose[j], (extent_hooks_t *)
+__UNCONST(_hooks_default));
 if (arena == NULL) {
 	malloc_mutex_unlock(tsd_tsdn(tsd),
 	_lock);
@@ -974,7 +979,7 @@ malloc_conf_init(void) {
 #define CONF_HANDLE_T_U(t, o, n, min, max, check_min, check_max, clip)	\
 			if (CONF_MATCH(n)) {\
 uintmax_t um;\
-char *end;\
+const char *end;			\
 	\
 set_errno(0);\
 um = malloc_strtoumax(v, , 0);	\
@@ -1051,12 +1056,12 @@ malloc_conf_init(void) {
 			CONF_HANDLE_BOOL(opt_abort, "abort")
 			CONF_HANDLE_BOOL(opt_abort_conf, "abort_conf")
 			if (strncmp("metadata_thp", k, klen) == 0) {
-int i;
+int ii;
 bool match = false;
-for (i = 0; i < metadata_thp_mode_limit; i++) {
-	if (strncmp(metadata_thp_mode_names[i],
+for (ii = 0; ii < metadata_thp_mode_limit; ii++) {
+	if (strncmp(metadata_thp_mode_names[ii],
 	v, vlen) == 0) {
-		opt_metadata_thp = i;
+		opt_metadata_thp = ii;
 		match = true;
 		break;
 	}
@@ -1069,18 +1074,18 @@ malloc_conf_init(void) {
 			}
 			CONF_HANDLE_BOOL(opt_retain, "retain")
 			if (strncmp("dss", k, klen) == 0) {
-int i;
+int ii;
 bool match = false;
-for (i = 0; i < dss_prec_limit; i++) {
-	if (strncmp(dss_prec_names[i], v, vlen)
+for (ii = 0; ii < dss_prec_limit; ii++) {
+	if (strncmp(dss_prec_names[ii], v, vlen)
 	== 0) {
-		if (extent_dss_prec_set(i)) {
+		if (extent_dss_prec_set(ii)) {
 			malloc_conf_error(
 			"Error setting dss",
 			k, klen, v, vlen);
 		} else {
 			opt_dss =
-			dss_prec_names[i];
+			dss_prec_names[ii];
 			match = true;
 			break;
 		}
@@ -1143,21 +1148,21 @@ malloc_conf_init(void) {
 			CONF_HANDLE_BOOL(opt_tcache, "tcache")
 			CONF_HANDLE_SIZE_T(opt_lg_extent_max_active_fit,
 			"lg_extent_max_active_fit", 0,
-			(sizeof(size_t) << 3), yes, yes, false)
+			(sizeof(size_t) << 3), no, yes, false)
 			CONF_HANDLE_SSIZE_T(opt_lg_tcache_max, "lg_tcache_max",
 			-1, (sizeof(size_t) << 3) - 1)
 			if (strncmp("percpu_arena", k, klen) == 0) {
 bool match = false;
-for (int i = percpu_arena_mode_names_base; i <
-percpu_arena_mode_names_limit; i++) {
-	if (strncmp(percpu_arena_mode_names[i],
+for (int ii = percpu_arena_mode_names_base; ii <
+percpu_arena_mode_names_limit; ii++) {
+	if (strncmp(percpu_arena_mode_names[ii],
 	v, vlen) == 0) {
 		if (!have_percpu_arena) {
 			malloc_conf_error(
 			"No getcpu support",
 			k, klen, v, vlen);
 		}
-		opt_percpu_arena = i;
+		opt_percpu_arena = ii;
 		match = true;
 		break;
 	}
@@ -1204,15 +1209,15 @@ malloc_conf_init(void) {
 			}
 			if (CONF_MATCH("thp")) {
 bool match = false;
-for (int i = 0; i < thp_mode_names_limit; i++) {
-	if (strncmp(thp_mode_names[i],v, vlen)
+for (int ii = 0; ii < thp_mode_names_limit; ii++) {
+	if (strncmp(thp_mode_names[ii],v, vlen)
 	== 0) {
 		if (!have_madvise_huge) {
 			malloc_conf_error(
 			"No THP support",
 			k, klen, v, vlen);
 		}
-		opt_thp = i;
+		opt_thp = ii;
 		match = true;
 		break;
 	}
@@ -1272,7 +1277,7 @@ malloc_init_hard_needed(void) {
 }
 
 static bool
-malloc_init_hard_a0_locked() {
+malloc_init_hard_a0_locked(void) {
 	malloc_initializer = INITIALIZER;
 
 	if (config_prof) {
@@ -1321,7 +1326,7 @@ malloc_init_hard_a0_locked() {
 	 * Initialize one arena here.  The rest are lazily created in
 	 * 

CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 17:16:47 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: mutex.c

Log Message:
rename initializer for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/mutex.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/mutex.c
diff -u src/external/bsd/jemalloc/dist/src/mutex.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/mutex.c:1.2
--- src/external/bsd/jemalloc/dist/src/mutex.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/mutex.c	Mon Mar  4 12:16:46 2019
@@ -46,7 +46,7 @@ JEMALLOC_EXPORT int	_pthread_mutex_init_
 void
 malloc_mutex_lock_slow(malloc_mutex_t *mutex) {
 	mutex_prof_data_t *data = >prof_data;
-	UNUSED nstime_t before = NSTIME_ZERO_INITIALIZER;
+	UNUSED nstime_t before = NSTIME_INITIALIZER;
 
 	if (ncpus == 1) {
 		goto label_spin_done;



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 17:16:27 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: malloc_io.c

Log Message:
remove needless casts after fixing prototype.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/malloc_io.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/malloc_io.c
diff -u src/external/bsd/jemalloc/dist/src/malloc_io.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/malloc_io.c:1.2
--- src/external/bsd/jemalloc/dist/src/malloc_io.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/malloc_io.c	Mon Mar  4 12:16:27 2019
@@ -111,7 +111,7 @@ buferror(int err, char *buf, size_t bufl
 }
 
 uintmax_t
-malloc_strtoumax(const char *restrict nptr, char **restrict endptr, int base) {
+malloc_strtoumax(const char *restrict nptr, const char **restrict endptr, int base) {
 	uintmax_t ret, digit;
 	unsigned b;
 	bool neg;
@@ -223,9 +223,9 @@ label_return:
 	if (endptr != NULL) {
 		if (p == ns) {
 			/* No characters were converted. */
-			*endptr = (char *)nptr;
+			*endptr = nptr;
 		} else {
-			*endptr = (char *)p;
+			*endptr = p;
 		}
 	}
 	return ret;
@@ -460,7 +460,7 @@ malloc_vsnprintf(char *str, size_t size,
 			case '5': case '6': case '7': case '8': case '9': {
 uintmax_t uwidth;
 set_errno(0);
-uwidth = malloc_strtoumax(f, (char **), 10);
+uwidth = malloc_strtoumax(f, , 10);
 assert(uwidth != UINTMAX_MAX || get_errno() !=
 ERANGE);
 width = (int)uwidth;
@@ -484,7 +484,7 @@ malloc_vsnprintf(char *str, size_t size,
 			case '5': case '6': case '7': case '8': case '9': {
 uintmax_t uprec;
 set_errno(0);
-uprec = malloc_strtoumax(f, (char **), 10);
+uprec = malloc_strtoumax(f, , 10);
 assert(uprec != UINTMAX_MAX || get_errno() !=
 ERANGE);
 prec = (int)uprec;



CVS commit: src/external/bsd/jemalloc/dist/src

2019-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 17:15:37 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src: stats.c

Log Message:
rename for shadowing


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/stats.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/stats.c
diff -u src/external/bsd/jemalloc/dist/src/stats.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/stats.c:1.2
--- src/external/bsd/jemalloc/dist/src/stats.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/stats.c	Mon Mar  4 12:15:37 2019
@@ -1008,10 +1008,10 @@ stats_general_print(emitter_t *emitter) 
 	emitter_kv(emitter, "nbins", "Number of bin size classes",
 	emitter_type_unsigned, );
 
-	unsigned nhbins;
-	CTL_GET("arenas.nhbins", , unsigned);
+	unsigned nh_bins;
+	CTL_GET("arenas.nhbins", _bins, unsigned);
 	emitter_kv(emitter, "nhbins", "Number of thread-cache bin size classes",
-	emitter_type_unsigned, );
+	emitter_type_unsigned, _bins);
 
 	/*
 	 * We do enough mallctls in a loop that we actually want to omit them