diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-01-04 15:21:23 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-01-04 15:21:23 -0500 |
commit | 1435a8b9e6203911d2ebe9e3ba217f8eb20e3140 (patch) | |
tree | 158c5dcd824aca1d01f0f119849458739d3f451e /indra/llcommon | |
parent | d285f78e91dd18b0dfa2608faf45738af1e637bd (diff) |
SH-2789 WIP - stricter calling of memcpyNonAliased16
Diffstat (limited to 'indra/llcommon')
-rwxr-xr-x[-rw-r--r--] | indra/llcommon/llmemory.cpp | 3 | ||||
-rwxr-xr-x | indra/llcommon/llmemory.h | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 22204e756a..afaf366668 100644..100755 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -63,11 +63,14 @@ LLPrivateMemoryPoolManager::mem_allocation_info_t LLPrivateMemoryPoolManager::sM void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) { +#ifdef SHOW_ASSERT + // Redundant, place to set breakpoints. if (ptr%alignment!=0) { llwarns << "alignment check failed" << llendl; } llassert(ptr%alignment==0); +#endif } //static diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 3eaf700bf1..1b54b56107 100755 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -83,7 +83,7 @@ inline void ll_aligned_free_16(void *p) inline void* ll_aligned_malloc_32(size_t size) // returned hunk MUST be freed with ll_aligned_free_32(). { #if defined(LL_WINDOWS) - return _mm_malloc(size, 32); + return _aligned_malloc(size, 32); #elif defined(LL_DARWIN) return ll_aligned_malloc( size, 32 ); #else @@ -98,7 +98,7 @@ inline void* ll_aligned_malloc_32(size_t size) // returned hunk MUST be freed wi inline void ll_aligned_free_32(void *p) { #if defined(LL_WINDOWS) - _mm_free(p); + _aligned_free(p); #elif defined(LL_DARWIN) ll_aligned_free( p ); #else @@ -107,10 +107,12 @@ inline void ll_aligned_free_32(void *p) } #else // USE_TCMALLOC -// ll_aligned_foo are noops now that we use tcmalloc everywhere (tcmalloc aligns automatically at appropriate intervals) +// ll_aligned_foo are noops now that we use tcmalloc everywhere +// (tcmalloc aligns automatically at appropriate intervals) #define ll_aligned_malloc( size, align ) malloc(size) #define ll_aligned_free( ptr ) free(ptr) #define ll_aligned_malloc_16 malloc +#define ll_aligned_realloc_16 realloc #define ll_aligned_free_16 free #define ll_aligned_malloc_32 malloc #define ll_aligned_free_32 free @@ -524,11 +526,9 @@ void LLPrivateMemoryPoolTester::operator delete[](void* addr) // LLSingleton moved to llsingleton.h -#define CHECK_ALIGNMENT - LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment); -#ifdef CHECK_ALIGNMENT +#ifdef SHOW_ASSERT #define ll_assert_aligned(ptr,alignment) ll_assert_aligned_func(reinterpret_cast<uintptr_t>(ptr),((U32)alignment)) #else #define ll_assert_aligned(ptr,alignment) |