From bfc66e07b7e0134dfa2041c311dc56941fe1caf0 Mon Sep 17 00:00:00 2001 From: Matt Valentine-House Date: Tue, 13 Dec 2022 15:11:57 +0000 Subject: Fix Object Movement allocation in GC When moving Objects between size pools we have to assign a new shape. This happened during updating references - we tried to create a new shape tree that mirrored the existing tree, but based on the root shape of the new size pool. This causes allocations to happen if the new tree doesn't already exist, potentially triggering a GC, during GC. This commit changes object movement to look for a pre-existing new tree during object movement, and if that tree does not exist, we don't move the object to the new pool. This allows us to remove the shape allocation from update references. Co-Authored-By: Peter Zhu --- shape.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'shape.h') diff --git a/shape.h b/shape.h index 9a42a770bb..40eb658707 100644 --- a/shape.h +++ b/shape.h @@ -216,6 +216,8 @@ rb_shape_t * rb_shape_alloc(ID edge_name, rb_shape_t * parent); rb_shape_t * rb_shape_alloc_with_size_pool_index(ID edge_name, rb_shape_t * parent, uint8_t size_pool_index); rb_shape_t * rb_shape_alloc_with_parent_id(ID edge_name, shape_id_t parent_id); +rb_shape_t *rb_shape_traverse_from_new_root(rb_shape_t *initial_shape, rb_shape_t *orig_shape); + bool rb_shape_set_shape_id(VALUE obj, shape_id_t shape_id); VALUE rb_obj_debug_shape(VALUE self, VALUE obj); -- cgit v1.2.1