x86_64: align malloc() allocations on 16 bytes.
* added a check in memalign_test.
This commit is contained in:
parent
56501446f0
commit
7c1acc8968
@ -74,8 +74,12 @@ class hoardHeap {
|
||||
# error "Undefined size class base."
|
||||
#endif
|
||||
|
||||
// Every object is aligned so that it can always hold a double.
|
||||
// Every object is aligned so that it can always hold any type.
|
||||
#ifdef __x86_64__
|
||||
enum { ALIGNMENT = 16 };
|
||||
#else
|
||||
enum { ALIGNMENT = sizeof(double) };
|
||||
#endif
|
||||
|
||||
// ANDing with this rounds to ALIGNMENT.
|
||||
enum { ALIGNMENT_MASK = ALIGNMENT - 1 };
|
||||
|
@ -16,7 +16,7 @@ SimpleTest flock_test : flock_test.cpp ;
|
||||
SimpleTest fseek_test : fseek_test.cpp ;
|
||||
SimpleTest getsubopt_test : getsubopt_test.cpp ;
|
||||
SimpleTest locale_test : locale_test.cpp ;
|
||||
SimpleTest memalign_test : memalign_test.cpp ;
|
||||
SimpleTest memalign_test : memalign_test.cpp : $(TARGET_LIBSUPC++) ;
|
||||
SimpleTest mprotect_test : mprotect_test.cpp ;
|
||||
SimpleTest pthread_signal_test : pthread_signal_test.cpp ;
|
||||
SimpleTest realtime_sem_test1 : realtime_sem_test1.cpp ;
|
||||
|
@ -53,7 +53,13 @@ allocate_random_no_alignment(int32 count, size_t maxSize)
|
||||
printf("allocation of %lu bytes failed\n", sizes[i]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
if (((addr_t)allocations[i] & 0xf) != 0) {
|
||||
printf("allocation %p not aligned failed\n",
|
||||
allocations[i]);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
write_test_pattern(allocations[i], sizes[i]);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user