Add missing lock around redblack_cache_ancestors

This used to be protected because all shape code was
under a lock, but now that the shape tree is lock-free
we still need to lock around the red-black cache.

Co-Authored-By: Luke Gruber <luke.gruber@shopify.com>
This commit is contained in:
Jean Boussier 2025-06-06 21:01:24 +02:00
parent 347e581a4c
commit 90ba2f4e1c
Notes: git 2025-06-06 21:07:36 +00:00

View File

@ -530,7 +530,9 @@ rb_shape_alloc_new_child(ID id, rb_shape_t *shape, enum shape_type shape_type)
RUBY_ASSERT(new_shape->capacity > shape->next_field_index);
new_shape->next_field_index = shape->next_field_index + 1;
if (new_shape->next_field_index > ANCESTOR_CACHE_THRESHOLD) {
redblack_cache_ancestors(new_shape);
RB_VM_LOCKING() {
redblack_cache_ancestors(new_shape);
}
}
break;
case SHAPE_ROOT: