@@ -451,7 +451,6 @@ rb_shape_alloc(ID edge_name, rb_shape_t *parent, enum shape_type type)
451451{
452452 rb_shape_t * shape = rb_shape_alloc_with_parent_id (edge_name , raw_shape_id (parent ));
453453 shape -> type = (uint8_t )type ;
454- shape -> heap_index = parent -> heap_index ;
455454 shape -> capacity = parent -> capacity ;
456455 shape -> edges = 0 ;
457456 return shape ;
@@ -716,6 +715,7 @@ remove_shape_recursive(rb_shape_t *shape, ID id, rb_shape_t **removed_shape)
716715 }
717716}
718717
718+ static inline shape_id_t transition_complex (shape_id_t shape_id );
719719
720720static shape_id_t
721721shape_transition_object_id (shape_id_t original_shape_id )
@@ -724,9 +724,11 @@ shape_transition_object_id(shape_id_t original_shape_id)
724724
725725 bool dont_care ;
726726 rb_shape_t * shape = get_next_shape_internal (RSHAPE (original_shape_id ), ruby_internal_object_id , SHAPE_OBJ_ID , & dont_care , true);
727+ if (!shape ) {
728+ shape = RSHAPE (ROOT_SHAPE_WITH_OBJ_ID );
729+ }
727730
728731 RUBY_ASSERT (shape );
729-
730732 return shape_id (shape , original_shape_id ) | SHAPE_ID_FL_HAS_OBJECT_ID ;
731733}
732734
@@ -755,7 +757,7 @@ rb_shape_object_id(shape_id_t original_shape_id)
755757static inline shape_id_t
756758transition_complex (shape_id_t shape_id )
757759{
758- uint8_t heap_index = RSHAPE (shape_id )-> heap_index ;
760+ uint8_t heap_index = rb_shape_heap_index (shape_id );
759761 shape_id_t next_shape_id ;
760762
761763 if (heap_index ) {
@@ -1341,7 +1343,7 @@ shape_id_t_to_rb_cShape(shape_id_t shape_id)
13411343 INT2NUM (shape -> parent_id ),
13421344 rb_shape_edge_name (shape ),
13431345 INT2NUM (shape -> next_field_index ),
1344- INT2NUM (shape -> heap_index ),
1346+ INT2NUM (rb_shape_heap_index ( shape_id ) ),
13451347 INT2NUM (shape -> type ),
13461348 INT2NUM (RSHAPE_CAPACITY (shape_id )));
13471349 rb_obj_freeze (obj );
@@ -1562,15 +1564,13 @@ Init_default_shapes(void)
15621564 rb_shape_t * root = rb_shape_alloc_with_parent_id (0 , INVALID_SHAPE_ID );
15631565 root -> capacity = 0 ;
15641566 root -> type = SHAPE_ROOT ;
1565- root -> heap_index = 0 ;
15661567 GET_SHAPE_TREE ()-> root_shape = root ;
15671568 RUBY_ASSERT (raw_shape_id (GET_SHAPE_TREE ()-> root_shape ) == ROOT_SHAPE_ID );
15681569
15691570 rb_shape_t * root_with_obj_id = rb_shape_alloc_with_parent_id (0 , ROOT_SHAPE_ID );
15701571 root_with_obj_id -> type = SHAPE_OBJ_ID ;
15711572 root_with_obj_id -> edge_name = ruby_internal_object_id ;
15721573 root_with_obj_id -> next_field_index ++ ;
1573- root_with_obj_id -> heap_index = 0 ;
15741574 RUBY_ASSERT (raw_shape_id (root_with_obj_id ) == ROOT_SHAPE_WITH_OBJ_ID );
15751575}
15761576
0 commit comments