From cd86393ad858d29c1204fd3f1561dca9c96fec16 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 3 Oct 2024 16:20:16 -0400 Subject: [PATCH] Assume VM locked in rb_mark_generic_ivar rb_gen_ivtbl_get locks the VM, but the VM must be locked during marking so we can directly read from the generic_ivtbl without locking the VM. --- variable.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/variable.c b/variable.c index 0dfc5cb7b8..4e55427ff5 100644 --- a/variable.c +++ b/variable.c @@ -1107,9 +1107,9 @@ gen_ivtbl_resize(struct gen_ivtbl *old, uint32_t n) void rb_mark_generic_ivar(VALUE obj) { - struct gen_ivtbl *ivtbl; - - if (rb_gen_ivtbl_get(obj, 0, &ivtbl)) { + st_data_t data; + if (st_lookup(generic_ivtbl_no_ractor_check(obj), (st_data_t)obj, &data)) { + struct gen_ivtbl *ivtbl = (struct gen_ivtbl *)data; if (rb_shape_obj_too_complex(obj)) { rb_mark_tbl_no_pin(ivtbl->as.complex.table); }