diff options
-rw-r--r-- | core/variant/callable.h | 7 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/callable.h | 1 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/signal.h | 1 |
3 files changed, 6 insertions, 3 deletions
diff --git a/core/variant/callable.h b/core/variant/callable.h index d91bebfa5f..20d0804292 100644 --- a/core/variant/callable.h +++ b/core/variant/callable.h @@ -44,9 +44,9 @@ class CallableCustom; // is required. It is designed for the standard case (object and method) // but can be optimized or customized. +// Enforce 16 bytes with `alignas` to avoid arch-specific alignment issues on x86 vs armv7. class Callable { - //needs to be max 16 bytes in 64 bits - StringName method; + alignas(8) StringName method; union { uint64_t object = 0; CallableCustom *custom; @@ -138,8 +138,9 @@ public: // be put inside a Variant, but it is not // used by the engine itself. +// Enforce 16 bytes with `alignas` to avoid arch-specific alignment issues on x86 vs armv7. class Signal { - StringName name; + alignas(8) StringName name; ObjectID object; public: diff --git a/modules/gdnative/include/gdnative/callable.h b/modules/gdnative/include/gdnative/callable.h index b84b0c1f1f..1d52ca7a68 100644 --- a/modules/gdnative/include/gdnative/callable.h +++ b/modules/gdnative/include/gdnative/callable.h @@ -37,6 +37,7 @@ extern "C" { #include <stdint.h> +// Alignment hardcoded in `core/variant/callable.h`. #define GODOT_CALLABLE_SIZE (16) #ifndef GODOT_CORE_API_GODOT_CALLABLE_TYPE_DEFINED diff --git a/modules/gdnative/include/gdnative/signal.h b/modules/gdnative/include/gdnative/signal.h index f4dc17e089..41a76d0510 100644 --- a/modules/gdnative/include/gdnative/signal.h +++ b/modules/gdnative/include/gdnative/signal.h @@ -37,6 +37,7 @@ extern "C" { #include <stdint.h> +// Alignment hardcoded in `core/variant/callable.h`. #define GODOT_SIGNAL_SIZE (16) #ifndef GODOT_CORE_API_GODOT_SIGNAL_TYPE_DEFINED |