mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:27:43 +00:00
AK+LibJS: Handle NaN-boxing pointers on AArch64
JS::Value stores 48 bit pointers to separately allocated objects in its payload. On x86-64, canonical addresses have their top 16 bits set to the same value as bit 47, effectively meaning that the value has to be sign-extended to get the pointer. AArch64, however, expects the topmost bits to be all zeros. This commit gates sign extension behind `#if ARCH(X86_64)`, and adds an `#error` for unsupported architectures, so that we do not forget to think about pointer handling when porting to a new architecture. Fixes #15290 Fixes SerenityOS/ladybird#56
This commit is contained in:
parent
62fed2a31d
commit
2b69af2dfe
4 changed files with 42 additions and 24 deletions
|
@ -18,6 +18,12 @@
|
|||
# define AK_ARCH_AARCH64 1
|
||||
#endif
|
||||
|
||||
#if (defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 8) || defined(_WIN64)
|
||||
# define AK_ARCH_64_BIT
|
||||
#else
|
||||
# define AK_ARCH_32_BIT
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
# define AK_OS_MACOS
|
||||
# define AK_OS_BSD_GENERIC
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue