summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-07-13 14:29:17 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-13 17:31:22 +0200
commit5f3773b7150cbf113b5a0aabfe2b2670dc758d38 (patch)
tree85b96a4b470b2fe37316e67eab821b29dbf06ccd /Userland/Libraries
parent3b81ba7c4f2436ff3324f3e305736a8368e9b939 (diff)
downloadserenity-5f3773b7150cbf113b5a0aabfe2b2670dc758d38.zip
LibC: Increase minimum alignment for malloc() to 16 bytes
This is required to make SSE instructions work when building with Clang. Apparently Clang uses SSE instructions where GCC didn't so we didn't previously run into this problem.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibC/mallocdefs.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibC/mallocdefs.h b/Userland/Libraries/LibC/mallocdefs.h
index 26a40855df..a4aad0e132 100644
--- a/Userland/Libraries/LibC/mallocdefs.h
+++ b/Userland/Libraries/LibC/mallocdefs.h
@@ -16,13 +16,13 @@
#define PAGE_ROUND_UP(x) ((((size_t)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1)))
-static constexpr unsigned short size_classes[] = { 8, 16, 32, 64, 128, 256, 504, 1016, 2032, 4088, 8184, 16376, 32752, 0 };
+static constexpr unsigned short size_classes[] = { 16, 32, 64, 128, 256, 496, 1008, 2032, 4080, 8176, 16368, 32752, 0 };
static constexpr size_t num_size_classes = (sizeof(size_classes) / sizeof(unsigned short)) - 1;
consteval bool check_size_classes_alignment()
{
for (size_t i = 0; i < num_size_classes; i++) {
- if ((size_classes[i] % 8) != 0)
+ if ((size_classes[i] % 16) != 0)
return false;
}
return true;
@@ -63,7 +63,7 @@ struct ChunkedBlock : public CommonHeader {
size_t m_next_lazy_freelist_index { 0 };
FreelistEntry* m_freelist { nullptr };
size_t m_free_chunks { 0 };
- [[gnu::aligned(8)]] unsigned char m_slot[0];
+ [[gnu::aligned(16)]] unsigned char m_slot[0];
void* chunk(size_t index)
{