Bug 1423107 - Replace uses of moz_posix_memalign with posix_memalign. r=njn

moz_posix_memalign is a wrapper for posix_memalign that only exists if
posix_memalign exists.

On OSX, it has a fallback for an under-specified bug where it
purportedly returns a pointer that doesn't have the requested alignment.
That fallback was added in bug 414946, over 6 years ago, before jemalloc
was even enabled on OSX.

Considering posix_memalign is used directly in many other places in
Gecko, that we almost always use mozjemalloc, which doesn't have these
problems, and that in all likeliness, the bug was in some old version of
OSX that is not supported anymore, the fallback does not seem all that
useful.

So, just use posix_memalign directly.

--HG--
extra : rebase_source : b2151b5fb598dc20cbd70308555059f7545b18b2
This commit is contained in:
Mike Hommey 2017-12-05 16:46:17 +09:00
Родитель bea48ffe01
Коммит d7c4757af3
3 изменённых файлов: 5 добавлений и 9 удалений

Просмотреть файл

@ -96,9 +96,9 @@ TryAllocAlignedBytes(size_t aSize)
void* ptr;
// Try to align for fast alpha recovery. This should only help
// cairo too, can't hurt.
return moz_posix_memalign(&ptr,
1 << gfxAlphaRecovery::GoodAlignmentLog2(),
aSize) ?
return posix_memalign(&ptr,
1 << gfxAlphaRecovery::GoodAlignmentLog2(),
aSize) ?
nullptr : ptr;
#else
// Oh well, hope that luck is with us in the allocator

Просмотреть файл

@ -27,14 +27,10 @@ bool VolatileBuffer::Init(size_t aSize, size_t aAlignment)
"Alignment must be multiple of pointer size");
mSize = aSize;
#if defined(MOZ_MEMORY)
#if defined(MOZ_MEMORY) || defined(HAVE_POSIX_MEMALIGN)
if (posix_memalign(&mBuf, aAlignment, aSize) != 0) {
return false;
}
#elif defined(HAVE_POSIX_MEMALIGN)
if (moz_posix_memalign(&mBuf, aAlignment, aSize) != 0) {
return false;
}
#else
#error "No memalign implementation found"
#endif

Просмотреть файл

@ -47,7 +47,7 @@ VolatileBuffer::Init(size_t aSize, size_t aAlignment)
}
heap_alloc:
(void)moz_posix_memalign(&mBuf, aAlignment, aSize);
(void)posix_memalign(&mBuf, aAlignment, aSize);
mHeap = true;
return !!mBuf;
}