Skip to content

Commit 90ba2f4

Browse files
byrootluke-gruber
andcommitted
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 <[email protected]>
1 parent 347e581 commit 90ba2f4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

shape.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,9 @@ rb_shape_alloc_new_child(ID id, rb_shape_t *shape, enum shape_type shape_type)
530530
RUBY_ASSERT(new_shape->capacity > shape->next_field_index);
531531
new_shape->next_field_index = shape->next_field_index + 1;
532532
if (new_shape->next_field_index > ANCESTOR_CACHE_THRESHOLD) {
533-
redblack_cache_ancestors(new_shape);
533+
RB_VM_LOCKING() {
534+
redblack_cache_ancestors(new_shape);
535+
}
534536
}
535537
break;
536538
case SHAPE_ROOT:

0 commit comments

Comments
 (0)