@@ -45,7 +45,7 @@ struct rb_shape {
4545 struct rb_id_table * edges ; // id_table from ID (ivar) to next shape
4646 ID edge_name ; // ID (ivar) for transition from parent to rb_shape
4747 attr_index_t next_iv_index ;
48- uint32_t capacity ; // Total capacity of the object with this shape
48+ attr_index_t capacity ; // Total capacity of the object with this shape
4949 uint8_t type ;
5050 uint8_t heap_index ;
5151 shape_id_t parent_id ;
@@ -104,19 +104,45 @@ set_shape_id_in_flags(VALUE obj, shape_id_t shape_id)
104104}
105105
106106
107- #if SHAPE_IN_BASIC_FLAGS
108107static inline shape_id_t
109108RBASIC_SHAPE_ID (VALUE obj )
110109{
110+ #if SHAPE_IN_BASIC_FLAGS
111111 return get_shape_id_from_flags (obj );
112+ #else
113+ switch (BUILTIN_TYPE (obj )) {
114+ case T_OBJECT :
115+ ROBJECT_SET_SHAPE_ID (obj , shape_id );
116+ break ;
117+ case T_CLASS :
118+ case T_MODULE :
119+ RCLASS_SET_SHAPE_ID (obj , shape_id );
120+ break ;
121+ default :
122+ if (shape_id != SPECIAL_CONST_SHAPE_ID ) {
123+ struct gen_ivtbl * ivtbl = 0 ;
124+ RB_VM_LOCK_ENTER ();
125+ {
126+ st_table * global_iv_table = generic_ivtbl (obj , 0 , false);
127+
128+ if (st_lookup (global_iv_table , obj , (st_data_t * )& ivtbl )) {
129+ ivtbl -> shape_id = shape_id ;
130+ }
131+ else {
132+ rb_bug ("Expected shape_id entry in global iv table" );
133+ }
134+ }
135+ RB_VM_LOCK_LEAVE ();
136+ }
137+ }
138+ #endif
112139}
113140
114141static inline void
115142RBASIC_SET_SHAPE_ID (VALUE obj , shape_id_t shape_id )
116143{
117144 set_shape_id_in_flags (obj , shape_id );
118145}
119- #endif
120146
121147static inline shape_id_t
122148ROBJECT_SHAPE_ID (VALUE obj )
0 commit comments