summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2022-10-15 09:37:44 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2022-10-15 10:44:10 -0700
commitf0654b1027d2f24cbb6e3cfb0c5946b70f06739b (patch)
treee49476db3318c77362e7ad21433df7832f0ede95 /gc.c
parent8d20632df849833d8a98f3d6f5e61f32eefa0fa6 (diff)
More precisely iterate over Object instance variables
Shapes provides us with an (almost) exact count of instance variables. We only need to check for Qundef when an IV has been "undefined" Prefer to use ROBJECT_IV_COUNT when iterating IVs
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6555
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index 52d5609c3e..7373bcfd67 100644
--- a/gc.c
+++ b/gc.c
@@ -7270,7 +7270,7 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj)
{
const VALUE * const ptr = ROBJECT_IVPTR(obj);
- uint32_t i, len = ROBJECT_NUMIV(obj);
+ uint32_t i, len = ROBJECT_IV_COUNT(obj);
for (i = 0; i < len; i++) {
gc_mark(objspace, ptr[i]);
}
@@ -10019,7 +10019,7 @@ gc_ref_update_object(rb_objspace_t *objspace, VALUE v)
}
#endif
- for (uint32_t i = 0; i < numiv; i++) {
+ for (uint32_t i = 0; i < ROBJECT_IV_COUNT(v); i++) {
UPDATE_IF_MOVED(objspace, ptr[i]);
}
}