summaryrefslogtreecommitdiffstats
path: root/contrib/jemalloc
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2012-04-17 22:05:55 +0000
committerjasone <jasone@FreeBSD.org>2012-04-17 22:05:55 +0000
commit279f465fd32017b325a0d72bdbdefc7c53ae9ea2 (patch)
tree0c67009e2f8ac4eb47e6f8b2ad6da9888df2140a /contrib/jemalloc
parent841f20af50d952e3673fbec1bcd442c1310b31b5 (diff)
downloadFreeBSD-src-279f465fd32017b325a0d72bdbdefc7c53ae9ea2.zip
FreeBSD-src-279f465fd32017b325a0d72bdbdefc7c53ae9ea2.tar.gz
Import jemalloc b57d3ec571c6551231be62b7bf92c084a8c8291c (dev branch,
prior to 3.0.0 release), which supports atomic operations based on atomic(9). This should fix build failures for several platforms.
Diffstat (limited to 'contrib/jemalloc')
-rw-r--r--contrib/jemalloc/FREEBSD-diffs8
-rw-r--r--contrib/jemalloc/VERSION2
-rw-r--r--contrib/jemalloc/doc/jemalloc.38
-rw-r--r--contrib/jemalloc/include/jemalloc/internal/atomic.h46
-rw-r--r--contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h7
-rw-r--r--contrib/jemalloc/include/jemalloc/jemalloc.h6
-rw-r--r--contrib/jemalloc/include/jemalloc/jemalloc_defs.h7
7 files changed, 66 insertions, 18 deletions
diff --git a/contrib/jemalloc/FREEBSD-diffs b/contrib/jemalloc/FREEBSD-diffs
index 927268c..d87d0fc 100644
--- a/contrib/jemalloc/FREEBSD-diffs
+++ b/contrib/jemalloc/FREEBSD-diffs
@@ -45,17 +45,19 @@ index 98d0ba4..23d2152 100644
+ </refsect1>
</refentry>
diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in
-index aa21aa5..e0f5fed 100644
+index 905653a..b235a0d 100644
--- a/include/jemalloc/internal/jemalloc_internal.h.in
+++ b/include/jemalloc/internal/jemalloc_internal.h.in
-@@ -1,3 +1,6 @@
+@@ -1,5 +1,8 @@
+ #ifndef JEMALLOC_INTERNAL_H
+ #define JEMALLOC_INTERNAL_H
+#include "libc_private.h"
+#include "namespace.h"
+
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/syscall.h>
-@@ -33,6 +36,9 @@
+@@ -35,6 +38,9 @@
#include <pthread.h>
#include <math.h>
diff --git a/contrib/jemalloc/VERSION b/contrib/jemalloc/VERSION
index bc7e154..f751c8d 100644
--- a/contrib/jemalloc/VERSION
+++ b/contrib/jemalloc/VERSION
@@ -1 +1 @@
-1.0.0-258-g9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa
+1.0.0-266-gb57d3ec571c6551231be62b7bf92c084a8c8291c
diff --git a/contrib/jemalloc/doc/jemalloc.3 b/contrib/jemalloc/doc/jemalloc.3
index fec70fc..a8a8b77 100644
--- a/contrib/jemalloc/doc/jemalloc.3
+++ b/contrib/jemalloc/doc/jemalloc.3
@@ -2,12 +2,12 @@
.\" Title: JEMALLOC
.\" Author: Jason Evans
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
-.\" Date: 04/16/2012
+.\" Date: 04/17/2012
.\" Manual: User Manual
-.\" Source: jemalloc 1.0.0-258-g9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa
+.\" Source: jemalloc 1.0.0-266-gb57d3ec571c6551231be62b7bf92c084a8c8291c
.\" Language: English
.\"
-.TH "JEMALLOC" "3" "04/16/2012" "jemalloc 1.0.0-258-g9ef7f5dc34" "User Manual"
+.TH "JEMALLOC" "3" "04/17/2012" "jemalloc 1.0.0-266-gb57d3ec571" "User Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -31,7 +31,7 @@
jemalloc \- general purpose memory allocation functions
.SH "LIBRARY"
.PP
-This manual describes jemalloc 1\&.0\&.0\-258\-g9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa\&. More information can be found at the
+This manual describes jemalloc 1\&.0\&.0\-266\-gb57d3ec571c6551231be62b7bf92c084a8c8291c\&. More information can be found at the
\m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&.
.PP
The following configuration options are enabled in libc\*(Aqs built\-in jemalloc:
diff --git a/contrib/jemalloc/include/jemalloc/internal/atomic.h b/contrib/jemalloc/include/jemalloc/internal/atomic.h
index d8f6ca5..016c472 100644
--- a/contrib/jemalloc/include/jemalloc/internal/atomic.h
+++ b/contrib/jemalloc/include/jemalloc/internal/atomic.h
@@ -32,7 +32,8 @@ unsigned atomic_sub_u(unsigned *p, unsigned x);
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_ATOMIC_C_))
/******************************************************************************/
/* 64-bit operations. */
-#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
+#if (LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
+# ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
JEMALLOC_INLINE uint64_t
atomic_add_uint64(uint64_t *p, uint64_t x)
{
@@ -60,7 +61,7 @@ atomic_sub_uint64(uint64_t *p, uint64_t x)
return (OSAtomicAdd64(-((int64_t)x), (int64_t *)p));
}
-#elif (defined(__amd64__) || defined(__x86_64__))
+# elif (defined(__amd64__) || defined(__x86_64__))
JEMALLOC_INLINE uint64_t
atomic_add_uint64(uint64_t *p, uint64_t x)
{
@@ -87,7 +88,29 @@ atomic_sub_uint64(uint64_t *p, uint64_t x)
return (x);
}
-#elif (defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
+# elif (defined(JEMALLOC_ATOMIC9))
+JEMALLOC_INLINE uint64_t
+atomic_add_uint64(uint64_t *p, uint64_t x)
+{
+
+ /*
+ * atomic_fetchadd_64() doesn't exist, but we only ever use this
+ * function on LP64 systems, so atomic_fetchadd_long() will do.
+ */
+ assert(sizeof(uint64_t) == sizeof(unsigned long));
+
+ return (atomic_fetchadd_long(p, (unsigned long)x) + x);
+}
+
+JEMALLOC_INLINE uint64_t
+atomic_sub_uint64(uint64_t *p, uint64_t x)
+{
+
+ assert(sizeof(uint64_t) == sizeof(unsigned long));
+
+ return (atomic_fetchadd_long(p, (unsigned long)(-(long)x)) - x);
+}
+# elif (defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
JEMALLOC_INLINE uint64_t
atomic_add_uint64(uint64_t *p, uint64_t x)
{
@@ -101,8 +124,7 @@ atomic_sub_uint64(uint64_t *p, uint64_t x)
return (__sync_sub_and_fetch(p, x));
}
-#else
-# if (LG_SIZEOF_PTR == 3)
+# else
# error "Missing implementation for 64-bit atomic operations"
# endif
#endif
@@ -164,6 +186,20 @@ atomic_sub_uint32(uint32_t *p, uint32_t x)
return (x);
}
+#elif (defined(JEMALLOC_ATOMIC9))
+JEMALLOC_INLINE uint32_t
+atomic_add_uint32(uint32_t *p, uint32_t x)
+{
+
+ return (atomic_fetchadd_32(p, x) + x);
+}
+
+JEMALLOC_INLINE uint32_t
+atomic_sub_uint32(uint32_t *p, uint32_t x)
+{
+
+ return (atomic_fetchadd_32(p, (uint32_t)(-(int32_t)x)) - x);
+}
#elif (defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
JEMALLOC_INLINE uint32_t
atomic_add_uint32(uint32_t *p, uint32_t x)
diff --git a/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h b/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h
index 8a19bbd..5a3ba16 100644
--- a/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h
+++ b/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h
@@ -1,3 +1,5 @@
+#ifndef JEMALLOC_INTERNAL_H
+#define JEMALLOC_INTERNAL_H
#include "libc_private.h"
#include "namespace.h"
@@ -165,6 +167,10 @@ static const bool config_ivsalloc =
#endif
;
+#ifdef JEMALLOC_ATOMIC9
+#include <machine/atomic.h>
+#endif
+
#if (defined(JEMALLOC_OSATOMIC) || defined(JEMALLOC_OSSPIN))
#include <libkern/OSAtomic.h>
#endif
@@ -874,3 +880,4 @@ malloc_tsd_funcs(JEMALLOC_INLINE, thread_allocated, thread_allocated_t,
#undef JEMALLOC_H_INLINES
/******************************************************************************/
+#endif /* JEMALLOC_INTERNAL_H */
diff --git a/contrib/jemalloc/include/jemalloc/jemalloc.h b/contrib/jemalloc/include/jemalloc/jemalloc.h
index c2ba2c9..d310f46 100644
--- a/contrib/jemalloc/include/jemalloc/jemalloc.h
+++ b/contrib/jemalloc/include/jemalloc/jemalloc.h
@@ -7,12 +7,12 @@ extern "C" {
#include <limits.h>
#include <strings.h>
-#define JEMALLOC_VERSION "1.0.0-258-g9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa"
+#define JEMALLOC_VERSION "1.0.0-266-gb57d3ec571c6551231be62b7bf92c084a8c8291c"
#define JEMALLOC_VERSION_MAJOR 1
#define JEMALLOC_VERSION_MINOR 0
#define JEMALLOC_VERSION_BUGFIX 0
-#define JEMALLOC_VERSION_NREV 258
-#define JEMALLOC_VERSION_GID "9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa"
+#define JEMALLOC_VERSION_NREV 266
+#define JEMALLOC_VERSION_GID "b57d3ec571c6551231be62b7bf92c084a8c8291c"
#include "jemalloc_defs.h"
#include "jemalloc_FreeBSD.h"
diff --git a/contrib/jemalloc/include/jemalloc/jemalloc_defs.h b/contrib/jemalloc/include/jemalloc/jemalloc_defs.h
index 86c94db..31dc838 100644
--- a/contrib/jemalloc/include/jemalloc/jemalloc_defs.h
+++ b/contrib/jemalloc/include/jemalloc/jemalloc_defs.h
@@ -48,6 +48,9 @@
*/
#define CPU_SPINWAIT __asm__ volatile("pause")
+/* Defined if the equivalent of FreeBSD's atomic(9) functions are available. */
+#define JEMALLOC_ATOMIC9 1
+
/*
* Defined if OSAtomic*() functions are available, as provided by Darwin, and
* documented in the atomic(3) manual page.
@@ -60,7 +63,7 @@
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
* functions are defined in libgcc instead of being inlines)
*/
-#define JE_FORCE_SYNC_COMPARE_AND_SWAP_4
+/* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4 */
/*
* Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
@@ -68,7 +71,7 @@
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
* functions are defined in libgcc instead of being inlines)
*/
-#define JE_FORCE_SYNC_COMPARE_AND_SWAP_8
+/* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8 */
/*
* Defined if OSSpin*() functions are available, as provided by Darwin, and
OpenPOWER on IntegriCloud