summaryrefslogtreecommitdiff
path: root/shape.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-06-06 21:01:24 +0200
committerJean Boussier <jean.boussier@gmail.com>2025-06-06 23:07:22 +0200
commit90ba2f4e1c60324f4d4a958a8a28bc2bbd1968b7 (patch)
treeb4f81530303d39d6f1bb9bb3eceac1de6c4950f6 /shape.c
parent347e581a4cbe2bbf7c13532038f2a68b0b37099a (diff)
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>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13552
Diffstat (limited to 'shape.c')
-rw-r--r--shape.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/shape.c b/shape.c
index 4a6d00368e..becd1aa8c5 100644
--- a/shape.c
+++ b/shape.c
@@ -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: