diff options
author | Peter Zhu <[email protected]> | 2024-03-12 13:50:50 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2024-03-13 09:55:52 -0400 |
commit | 6ad347a1055902abfd5a7f5233dd8d18e1f1360b (patch) | |
tree | 9d906ec788ca0e4a1bb731b4b72300f236d27271 /shape.c | |
parent | d1eaa97ec3cdbe38605379fc87a55987d6802dc7 (diff) |
Don't directly read the SIZE_POOL_COUNT in shapes
This removes the assumption about SIZE_POOL_COUNT for shapes.
Diffstat (limited to 'shape.c')
-rw-r--r-- | shape.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1266,12 +1266,13 @@ Init_default_shapes(void) } // Make shapes for T_OBJECT - for (int i = 0; i < SIZE_POOL_COUNT; i++) { + size_t *sizes = rb_gc_size_pool_sizes(); + for (int i = 0; sizes[i] > 0; i++) { rb_shape_t * shape = rb_shape_get_shape_by_id(i); bool dont_care; - rb_shape_t * t_object_shape = + rb_shape_t *t_object_shape = get_next_shape_internal(shape, id_t_object, SHAPE_T_OBJECT, &dont_care, true); - t_object_shape->capacity = (uint32_t)((rb_size_pool_slot_size(i) - offsetof(struct RObject, as.ary)) / sizeof(VALUE)); + t_object_shape->capacity = (uint32_t)((sizes[i] - offsetof(struct RObject, as.ary)) / sizeof(VALUE)); t_object_shape->edges = rb_id_table_create(0); t_object_shape->ancestor_index = LEAF; RUBY_ASSERT(rb_shape_id(t_object_shape) == (shape_id_t)(i + SIZE_POOL_COUNT)); |