mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 09:18:11 +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
1 changed files with 3 additions and 1 deletions
|
@ -276,11 +276,13 @@ private:
|
|||
#ifndef KERNEL
|
||||
// Empirically determined to fit most lambdas and functions.
|
||||
static constexpr size_t inline_capacity = 4 * sizeof(void*);
|
||||
alignas(__BIGGEST_ALIGNMENT__) u8 m_storage[inline_capacity];
|
||||
#else
|
||||
// FIXME: Try to decrease this.
|
||||
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
|
||||
alignas(max(alignof(CallableWrapperBase), alignof(CallableWrapperBase*))) u8 m_storage[inline_capacity];
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue