File tree Expand file tree Collapse file tree 1 file changed +20
-11
lines changed
Expand file tree Collapse file tree 1 file changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -1278,15 +1278,6 @@ rb_gc_obj_needs_cleanup_p(VALUE obj)
12781278 }
12791279
12801280 case T_DATA :
1281- if (flags & RUBY_TYPED_FL_IS_TYPED_DATA ) {
1282- uintptr_t type = (uintptr_t )RTYPEDDATA (obj )-> type ;
1283- if (type & TYPED_DATA_EMBEDDED ) {
1284- RUBY_DATA_FUNC dfree = ((const rb_data_type_t * )(type & TYPED_DATA_PTR_MASK ))-> function .dfree ;
1285- return (dfree == RUBY_NEVER_FREE || dfree == RUBY_TYPED_DEFAULT_FREE );
1286- }
1287- }
1288- return true;
1289-
12901281 case T_OBJECT :
12911282 case T_STRING :
12921283 case T_ARRAY :
@@ -1298,7 +1289,13 @@ rb_gc_obj_needs_cleanup_p(VALUE obj)
12981289 case T_COMPLEX :
12991290 break ;
13001291
1301- default :
1292+ case T_FILE :
1293+ case T_SYMBOL :
1294+ case T_CLASS :
1295+ case T_ICLASS :
1296+ case T_MODULE :
1297+ case T_REGEXP :
1298+ case T_MATCH :
13021299 return true;
13031300 }
13041301
@@ -1310,6 +1307,18 @@ rb_gc_obj_needs_cleanup_p(VALUE obj)
13101307 if (flags & ROBJECT_HEAP ) return true;
13111308 return false;
13121309
1310+ case T_DATA :
1311+ if (flags & RUBY_TYPED_FL_IS_TYPED_DATA ) {
1312+ uintptr_t type = (uintptr_t )RTYPEDDATA (obj )-> type ;
1313+ if (type & TYPED_DATA_EMBEDDED ) {
1314+ RUBY_DATA_FUNC dfree = ((const rb_data_type_t * )(type & TYPED_DATA_PTR_MASK ))-> function .dfree ;
1315+ if (dfree == RUBY_NEVER_FREE || dfree == RUBY_TYPED_DEFAULT_FREE ) {
1316+ return false;
1317+ }
1318+ }
1319+ }
1320+ return true;
1321+
13131322 case T_STRING :
13141323 if (flags & (RSTRING_NOEMBED | RSTRING_FSTR )) return true;
13151324 return rb_shape_has_fields (shape_id );
@@ -1324,7 +1333,7 @@ rb_gc_obj_needs_cleanup_p(VALUE obj)
13241333
13251334 case T_BIGNUM :
13261335 if (!(flags & BIGNUM_EMBED_FLAG )) return true;
1327- return false ;
1336+ return rb_shape_has_fields ( shape_id ) ;
13281337
13291338 case T_STRUCT :
13301339 if (!(flags & RSTRUCT_EMBED_LEN_MASK )) return true;
You can’t perform that action at this time.
0 commit comments