From e2d950733ee274e577813b5a4e930f617c60634f Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 31 Oct 2023 09:38:35 -0400 Subject: Add ST table to gen_ivtbl for complex shapes On 32-bit systems, we must store the shape ID in the gen_ivtbl to not lose the shape. If we directly store the ST table into the generic ivar table, then we lose the shape. This makes it impossible to determine the shape of the object and whether it is too complex or not. --- ractor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ractor.c') diff --git a/ractor.c b/ractor.c index b4787e7a01..db2d43e91e 100644 --- a/ractor.c +++ b/ractor.c @@ -2758,8 +2758,8 @@ obj_traverse_i(VALUE obj, struct obj_traverse_data *data) if (UNLIKELY(FL_TEST_RAW(obj, FL_EXIVAR))) { struct gen_ivtbl *ivtbl; rb_ivar_generic_ivtbl_lookup(obj, &ivtbl); - for (uint32_t i = 0; i < ivtbl->numiv; i++) { - VALUE val = ivtbl->ivptr[i]; + for (uint32_t i = 0; i < ivtbl->as.shape.numiv; i++) { + VALUE val = ivtbl->as.shape.ivptr[i]; if (!UNDEF_P(val) && obj_traverse_i(val, data)) return 1; } } @@ -3229,9 +3229,9 @@ obj_traverse_replace_i(VALUE obj, struct obj_traverse_replace_data *data) if (UNLIKELY(FL_TEST_RAW(obj, FL_EXIVAR))) { struct gen_ivtbl *ivtbl; rb_ivar_generic_ivtbl_lookup(obj, &ivtbl); - for (uint32_t i = 0; i < ivtbl->numiv; i++) { - if (!UNDEF_P(ivtbl->ivptr[i])) { - CHECK_AND_REPLACE(ivtbl->ivptr[i]); + for (uint32_t i = 0; i < ivtbl->as.shape.numiv; i++) { + if (!UNDEF_P(ivtbl->as.shape.ivptr[i])) { + CHECK_AND_REPLACE(ivtbl->as.shape.ivptr[i]); } } } -- cgit v1.2.3