mrbconf.h: prohibit MRB_INT64 on 32-bit with word/NaN boxing

Heap-allocated RInteger with int64_t requires 8-byte alignment,
but GC heap slots on 32-bit may not guarantee it, causing SIGBUS
on architectures like MIPS. MRB_NO_BOXING is still allowed since
integers are stored inline in mrb_value (no heap RInteger).

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-02-27 09:55:21 +09:00
parent 4ed338bdb9
commit eaaa66b39b
+7
View File
@@ -86,6 +86,13 @@
# endif
#endif
/* MRB_INT64 on 32-bit with word/NaN boxing causes alignment issues
for heap-allocated RInteger (int64_t needs 8-byte alignment but
GC heap slots may not guarantee it); use MRB_NO_BOXING instead */
#if defined(MRB_INT64) && defined(MRB_32BIT) && !defined(MRB_NO_BOXING)
#error "MRB_INT64 on 32-bit requires MRB_NO_BOXING"
#endif
/* call malloc_trim(0) from mrb_full_gc() */
//#define MRB_USE_MALLOC_TRIM