@@ -1201,7 +1201,6 @@ rb_data_free(void *objspace, VALUE obj)
12011201
12021202struct classext_foreach_args {
12031203 VALUE klass ;
1204- bool obj_too_complex ;
12051204 rb_objspace_t * objspace ; // used for update_*
12061205};
12071206
@@ -1213,12 +1212,6 @@ classext_free(rb_classext_t *ext, bool is_prime, VALUE namespace, void *arg)
12131212
12141213 rb_id_table_free (RCLASSEXT_M_TBL (ext ));
12151214 rb_cc_tbl_free (RCLASSEXT_CC_TBL (ext ), args -> klass );
1216- if (args -> obj_too_complex ) {
1217- st_free_table ((st_table * )RCLASSEXT_FIELDS (ext ));
1218- }
1219- else {
1220- xfree (RCLASSEXT_FIELDS (ext ));
1221- }
12221215 if (!RCLASSEXT_SHARED_CONST_TBL (ext ) && (tbl = RCLASSEXT_CONST_TBL (ext )) != NULL ) {
12231216 rb_free_const_table (tbl );
12241217 }
@@ -1292,8 +1285,6 @@ rb_gc_obj_free(void *objspace, VALUE obj)
12921285 case T_MODULE :
12931286 case T_CLASS :
12941287 args .klass = obj ;
1295- args .obj_too_complex = rb_shape_obj_too_complex_p (obj ) ? true : false;
1296-
12971288 rb_class_classext_foreach (obj , classext_free , (void * )& args );
12981289 if (RCLASS (obj )-> ns_classext_tbl ) {
12991290 st_free_table (RCLASS (obj )-> ns_classext_tbl );
@@ -2305,18 +2296,6 @@ classext_memsize(rb_classext_t *ext, bool prime, VALUE namespace, void *arg)
23052296 * size += s ;
23062297}
23072298
2308- static void
2309- classext_fields_hash_memsize (rb_classext_t * ext , bool prime , VALUE namespace , void * arg )
2310- {
2311- size_t * size = (size_t * )arg ;
2312- size_t count ;
2313- RB_VM_LOCKING () {
2314- count = rb_st_table_size ((st_table * )RCLASSEXT_FIELDS (ext ));
2315- }
2316- // class IV sizes are allocated as powers of two
2317- * size += SIZEOF_VALUE << bit_length (count );
2318- }
2319-
23202299static void
23212300classext_superclasses_memsize (rb_classext_t * ext , bool prime , VALUE namespace , void * arg )
23222301{
@@ -2354,15 +2333,6 @@ rb_obj_memsize_of(VALUE obj)
23542333 case T_MODULE :
23552334 case T_CLASS :
23562335 rb_class_classext_foreach (obj , classext_memsize , (void * )& size );
2357-
2358- if (rb_shape_obj_too_complex_p (obj )) {
2359- rb_class_classext_foreach (obj , classext_fields_hash_memsize , (void * )& size );
2360- }
2361- else {
2362- // class IV sizes are allocated as powers of two
2363- size += SIZEOF_VALUE << bit_length (RCLASS_FIELDS_COUNT (obj ));
2364- }
2365-
23662336 rb_class_classext_foreach (obj , classext_superclasses_memsize , (void * )& size );
23672337 break ;
23682338 case T_ICLASS :
@@ -3135,10 +3105,7 @@ gc_mark_classext_module(rb_classext_t *ext, bool prime, VALUE namespace, void *a
31353105 gc_mark_internal (RCLASSEXT_SUPER (ext ));
31363106 }
31373107 mark_m_tbl (objspace , RCLASSEXT_M_TBL (ext ));
3138- if (rb_shape_obj_too_complex_p (obj )) {
3139- gc_mark_tbl_no_pin ((st_table * )RCLASSEXT_FIELDS (ext ));
3140- // for the case ELSE is written in rb_gc_mark_children() because it's per RClass, not classext
3141- }
3108+ gc_mark_internal (RCLASSEXT_FIELDS_OBJ (ext ));
31423109 if (!RCLASSEXT_SHARED_CONST_TBL (ext ) && RCLASSEXT_CONST_TBL (ext )) {
31433110 mark_const_tbl (objspace , RCLASSEXT_CONST_TBL (ext ));
31443111 }
@@ -3218,12 +3185,6 @@ rb_gc_mark_children(void *objspace, VALUE obj)
32183185 foreach_args .objspace = objspace ;
32193186 foreach_args .obj = obj ;
32203187 rb_class_classext_foreach (obj , gc_mark_classext_module , (void * )& foreach_args );
3221-
3222- if (!rb_shape_obj_too_complex_p (obj )) {
3223- for (attr_index_t i = 0 ; i < RCLASS_FIELDS_COUNT (obj ); i ++ ) {
3224- gc_mark_internal (RCLASS_PRIME_FIELDS (obj )[i ]);
3225- }
3226- }
32273188 break ;
32283189
32293190 case T_ICLASS :
@@ -3849,7 +3810,6 @@ static void
38493810update_classext (rb_classext_t * ext , bool is_prime , VALUE namespace , void * arg )
38503811{
38513812 struct classext_foreach_args * args = (struct classext_foreach_args * )arg ;
3852- VALUE klass = args -> klass ;
38533813 rb_objspace_t * objspace = args -> objspace ;
38543814
38553815 if (RCLASSEXT_SUPER (ext )) {
@@ -3858,16 +3818,7 @@ update_classext(rb_classext_t *ext, bool is_prime, VALUE namespace, void *arg)
38583818
38593819 update_m_tbl (objspace , RCLASSEXT_M_TBL (ext ));
38603820
3861- if (args -> obj_too_complex ) {
3862- gc_ref_update_table_values_only ((st_table * )RCLASSEXT_FIELDS (ext ));
3863- }
3864- else {
3865- // Classext is not copied in this case
3866- for (attr_index_t i = 0 ; i < RCLASS_FIELDS_COUNT (klass ); i ++ ) {
3867- UPDATE_IF_MOVED (objspace , RCLASSEXT_FIELDS (RCLASS_EXT_PRIME (klass ))[i ]);
3868- }
3869- }
3870-
3821+ UPDATE_IF_MOVED (objspace , ext -> fields_obj );
38713822 if (!RCLASSEXT_SHARED_CONST_TBL (ext )) {
38723823 update_const_tbl (objspace , RCLASSEXT_CONST_TBL (ext ));
38733824 }
@@ -4255,7 +4206,6 @@ rb_gc_update_object_references(void *objspace, VALUE obj)
42554206 // Continue to the shared T_CLASS/T_MODULE
42564207 case T_MODULE :
42574208 args .klass = obj ;
4258- args .obj_too_complex = rb_shape_obj_too_complex_p (obj );
42594209 args .objspace = objspace ;
42604210 rb_class_classext_foreach (obj , update_classext , (void * )& args );
42614211 break ;
0 commit comments