mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-07 00:19:27 +00:00
AK: Align Function storage to __BIGGEST_ALIGNMENT__ outside kernel
The previous alignment would always resolve to 8-bytes, which is below the required alignments of types that could exist in userspace (long double, 128-bit integers, SSE, etc).
This commit is contained in:
parent
a433cbefbe
commit
d4d92184b3
|
@ -276,11 +276,13 @@ private:
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
// Empirically determined to fit most lambdas and functions.
|
// Empirically determined to fit most lambdas and functions.
|
||||||
static constexpr size_t inline_capacity = 4 * sizeof(void*);
|
static constexpr size_t inline_capacity = 4 * sizeof(void*);
|
||||||
|
alignas(__BIGGEST_ALIGNMENT__) u8 m_storage[inline_capacity];
|
||||||
#else
|
#else
|
||||||
// FIXME: Try to decrease this.
|
// FIXME: Try to decrease this.
|
||||||
static constexpr size_t inline_capacity = 6 * sizeof(void*);
|
static constexpr size_t inline_capacity = 6 * sizeof(void*);
|
||||||
|
// In the Kernel nothing has an alignment > alignof(void*).
|
||||||
|
alignas(alignof(void*)) u8 m_storage[inline_capacity];
|
||||||
#endif
|
#endif
|
||||||
alignas(max(alignof(CallableWrapperBase), alignof(CallableWrapperBase*))) u8 m_storage[inline_capacity];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue