From 6b7eff90860d4fb4db01ec4d1f522afa6d809632 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 14 Jan 2022 13:59:38 -0500 Subject: Separately allocate class_serial on 32-bit systems On 32-bit systems, VWA causes class_serial to not be aligned (it only guarantees 4 byte alignment but class_serial is 8 bytes and requires 8 byte alignment). This commit uses a hack to allocate class_serial through malloc. Once VWA allocates with 8 byte alignment in the future, we will revert this commit. --- gc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gc.c') diff --git a/gc.c b/gc.c index 02f3e0bbb4..aca15ad426 100644 --- a/gc.c +++ b/gc.c @@ -3132,6 +3132,10 @@ obj_free(rb_objspace_t *objspace, VALUE obj) rb_class_remove_subclass_head(obj); rb_class_remove_from_module_subclasses(obj); rb_class_remove_from_super_subclasses(obj); +#if SIZEOF_SERIAL_T != SIZEOF_VALUE && USE_RVARGC + xfree(RCLASS(obj)->class_serial_ptr); +#endif + #if !USE_RVARGC if (RCLASS_EXT(obj)) xfree(RCLASS_EXT(obj)); -- cgit v1.2.3