@@ -1586,20 +1586,9 @@ rb_evict_fields_to_hash(VALUE obj)
15861586
15871587 RUBY_ASSERT (!rb_shape_obj_too_complex (obj ));
15881588
1589- st_table * table = st_init_numtable_with_size (rb_ivar_count (obj ));
1590-
1591- // Evacuate all previous values from shape into id_table
1592- rb_obj_copy_fields_to_hash_table (obj , table );
15931589 rb_shape_t * shape = rb_shape_get_shape (obj );
1594- if (rb_shape_has_object_id (shape )) {
1595- rb_shape_t * object_id_shape = rb_shape_object_id_shape (obj );
1596- VALUE id = rb_field_get (obj , object_id_shape );
1597- st_insert (table , internal_object_id , id );
1598-
1599- // We need to ensure the object ID is registered in id_to_obj_table
1600- // before transitioning to too complex
1601- rb_gc_update_id_to_obj_table (obj , id );
1602- }
1590+ st_table * table = st_init_numtable_with_size (shape -> next_field_index );
1591+ rb_obj_copy_fields_to_hash_table (obj , table );
16031592 obj_transition_too_complex (obj , table );
16041593
16051594 RUBY_ASSERT (rb_shape_obj_too_complex (obj ));
@@ -1614,16 +1603,6 @@ rb_evict_ivars_to_hash(VALUE obj)
16141603
16151604 // Evacuate all previous values from shape into id_table
16161605 rb_obj_copy_ivs_to_hash_table (obj , table );
1617- rb_shape_t * shape = rb_shape_get_shape (obj );
1618- if (rb_shape_has_object_id (shape )) {
1619- rb_shape_t * object_id_shape = rb_shape_object_id_shape (obj );
1620- VALUE id = rb_field_get (obj , object_id_shape );
1621- st_insert (table , internal_object_id , id );
1622-
1623- // We need to ensure the object ID is registered in id_to_obj_table
1624- // before transitioning to too complex
1625- rb_gc_update_id_to_obj_table (obj , id );
1626- }
16271606 obj_transition_too_complex (obj , table );
16281607
16291608 RUBY_ASSERT (rb_shape_obj_too_complex (obj ));
0 commit comments