summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-06-02 14:45:02 +0200
committerJean Boussier <[email protected]>2025-06-02 17:49:53 +0200
commitdb2cfebff1ae78ec6cbe32d24dcaf236b178f6ca (patch)
treead39d8d96305ee6c38977d5174ef511a89c13b27
parente9fd44dd724b165a7ea1dd9822fdb65d80907c06 (diff)
Pin shape->edges
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13441
-rw-r--r--shape.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/shape.c b/shape.c
index fe576f2f7f..5e96766eb5 100644
--- a/shape.c
+++ b/shape.c
@@ -324,7 +324,14 @@ shape_tree_mark(void *data)
rb_shape_t *end = RSHAPE(GET_SHAPE_TREE()->next_shape_id);
while (cursor < end) {
if (cursor->edges && !SINGLE_CHILD_P(cursor->edges)) {
- rb_gc_mark_movable(cursor->edges);
+ // FIXME: GC compaction may call `rb_shape_traverse_from_new_root`
+ // to migrate objects from one object slot to another.
+ // Because of this if we don't pin `cursor->edges` it might be turned
+ // into a T_MOVED during GC.
+ // We'd need to eliminate `SHAPE_T_OBJECT` so that GC never need to lookup
+ // shapes this way.
+ // rb_gc_mark_movable(cursor->edges);
+ rb_gc_mark(cursor->edges);
}
cursor++;
}