summaryrefslogtreecommitdiffstats
path: root/memory/mozjemalloc/jemalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'memory/mozjemalloc/jemalloc.c')
-rw-r--r--memory/mozjemalloc/jemalloc.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c
index 9a97bbb09..c54a85959 100644
--- a/memory/mozjemalloc/jemalloc.c
+++ b/memory/mozjemalloc/jemalloc.c
@@ -280,7 +280,9 @@ typedef long ssize_t;
#define JEMALLOC_RECYCLE
#ifndef MOZ_MEMORY_WINDOWS
+#ifndef MOZ_MEMORY_SOLARIS
#include <sys/cdefs.h>
+#endif
#ifndef __DECONST
# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
#endif
@@ -306,7 +308,7 @@ __FBSDID("$FreeBSD: head/lib/libc/stdlib/malloc.c 180599 2008-07-18 19:35:44Z ja
#endif
#include <sys/time.h>
#include <sys/types.h>
-#if !defined(MOZ_MEMORY_ANDROID)
+#if !defined(MOZ_MEMORY_SOLARIS) && !defined(MOZ_MEMORY_ANDROID)
#include <sys/sysctl.h>
#endif
#include <sys/uio.h>
@@ -408,6 +410,10 @@ void *_mmap(void *addr, size_t length, int prot, int flags,
#endif
#endif
+#if defined(MOZ_MEMORY_SOLARIS && defined(MAP_ALIGN) && !defined(JEMALLOC_NEVER_USES_MAP_ALIGN)
+#define JEMALLOC_USES_MAP_ALIGN /* Required on Solaris 10. Might improve performance elsewhere. */
+#endif
+
#ifndef __DECONST
#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
#endif
@@ -5120,6 +5126,13 @@ malloc_ncpus(void)
else
return (n);
}
+#elif (defined(MOZ_MEMORY_SOLARIS))
+
+static inline unsigned
+malloc_ncpus(void)
+{
+ return sysconf(_SC_NPROCESSORS_ONLN);
+}
#elif (defined(MOZ_MEMORY_WINDOWS))
static inline unsigned
malloc_ncpus(void)
@@ -5916,9 +5929,15 @@ RETURN:
#define MOZ_MEMORY_ELF
#endif
+#ifdef MOZ_MEMORY_SOLARIS
+# if (defined(__GNUC__))
+__attribute__((noinline))
+# endif
+#else
#if (defined(MOZ_MEMORY_ELF))
__attribute__((visibility ("hidden")))
#endif
+#endif
#endif /* MOZ_REPLACE_MALLOC */
#ifdef MOZ_MEMORY_ELF