File tree Expand file tree Collapse file tree 4 files changed +9
-3
lines changed Expand file tree Collapse file tree 4 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -384,7 +384,7 @@ rb_gc_rebuild_shape(VALUE obj, size_t heap_id)
384
384
return (uint32_t )orig_shape_id ;
385
385
}
386
386
387
- shape_id_t initial_shape_id = ( shape_id_t )( heap_id + FIRST_T_OBJECT_SHAPE_ID );
387
+ shape_id_t initial_shape_id = rb_shape_root ( heap_id );
388
388
shape_id_t new_shape_id = rb_shape_traverse_from_new_root (initial_shape_id , orig_shape_id );
389
389
390
390
if (new_shape_id == INVALID_SHAPE_ID ) {
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ rb_class_allocate_instance(VALUE klass)
135
135
RUBY_ASSERT (rb_obj_shape (obj )-> type == SHAPE_ROOT );
136
136
137
137
// Set the shape to the specific T_OBJECT shape.
138
- ROBJECT_SET_SHAPE_ID (obj , ( shape_id_t )( rb_gc_heap_id_for_size (size ) + FIRST_T_OBJECT_SHAPE_ID ));
138
+ ROBJECT_SET_SHAPE_ID (obj , rb_shape_root ( rb_gc_heap_id_for_size (size )));
139
139
140
140
#if RUBY_DEBUG
141
141
RUBY_ASSERT (!rb_shape_obj_too_complex_p (obj ));
Original file line number Diff line number Diff line change @@ -1419,7 +1419,7 @@ Init_default_shapes(void)
1419
1419
t_object_shape -> capacity = (uint32_t )((sizes [i ] - offsetof(struct RObject , as .ary )) / sizeof (VALUE ));
1420
1420
t_object_shape -> edges = rb_id_table_create (0 );
1421
1421
t_object_shape -> ancestor_index = LEAF ;
1422
- RUBY_ASSERT (rb_shape_id (t_object_shape ) == ( shape_id_t )( i + FIRST_T_OBJECT_SHAPE_ID ));
1422
+ RUBY_ASSERT (rb_shape_id (t_object_shape ) == rb_shape_root ( i ));
1423
1423
}
1424
1424
1425
1425
// Prebuild TOO_COMPLEX variations so that they already exist if we ever need them after we
Original file line number Diff line number Diff line change @@ -187,6 +187,12 @@ rb_shape_canonical_p(rb_shape_t *shape)
187
187
return !shape -> flags ;
188
188
}
189
189
190
+ static inline shape_id_t
191
+ rb_shape_root (size_t heap_id )
192
+ {
193
+ return (shape_id_t )(heap_id + FIRST_T_OBJECT_SHAPE_ID );
194
+ }
195
+
190
196
static inline uint32_t
191
197
ROBJECT_FIELDS_CAPACITY (VALUE obj )
192
198
{
You can’t perform that action at this time.
0 commit comments