Bug #1532
open
Sam, have you looked into this? jemalloc seems to use _SPINLOCK in some cases,
depending on how the defines are set up, short grep:
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#else
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c:static
malloc_mutex_t init_lock = {_SPINLOCK_INITIALIZER};
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#endif
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-
--
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-
return (true);
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#elif
defined(MOZ_MEMORY_DARWIN)
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c: mutex->lock =
OS_SPINLOCK_INIT;
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#elif
defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID)
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-
pthread_mutexattr_t attr;
--
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c- return
(true);
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#else
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c: static const
spinlock_t lock = SPINLOCK_INITIALIZER;
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c- mutex->lock = lock;
--
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#else
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c- if (_isthreaded)
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c:
SPINLOCK;
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#endif
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-}
--
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-
return (true);
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#elif
defined(MOZ_MEMORY_DARWIN)
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c: lock->lock =
OS_SPINLOCK_INIT;
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#elif
defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID)
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-
pthread_mutexattr_t attr;
--
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c- return
(true);
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#else
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c: lock->lock =
_SPINLOCK_INITIALIZER;
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#endif
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c- return (false);
--
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#else
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c- if (_isthreaded)
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c:
_SPINLOCK(&lock->lock);
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-#endif
./www/firefox/work/mozilla-release/memory/jemalloc/jemalloc.c-}
So in principle it shouldn't be too hard to get it to work. I'll have a look
myself tonight and see what can be done, but maybe you've already made some
progress on this?
Cheers,
Alex
In my homedirectory on leaf, there is a jemalloc subdir; that is a version
ported to run on DragonFly. Diff against the version in FreeBSD 8 for exactly
what is changed.
Looking into it, my port just uses _SPINLOCK for malloc_mutexes; to be able to
do so, we'd need to include /usr/src/lib/libc/include/libc_private.h ; it'd be a
bit of a shame if Firefox's code had to do the same.
Under what conditions are _SPINLOCKs used?
Also available in: Atom
PDF