diff --git a/class.c b/class.c index 8677a26d2f..1ae235d6ab 100644 --- a/class.c +++ b/class.c @@ -193,22 +193,14 @@ rb_class_detach_module_subclasses(VALUE klass) static VALUE class_alloc(VALUE flags, VALUE klass) { - size_t alloc_size = sizeof(struct RClass); - -#if RCLASS_EXT_EMBEDDED - alloc_size += sizeof(rb_classext_t); -#endif + size_t alloc_size = sizeof(struct RClass) + sizeof(rb_classext_t); flags &= T_MASK; flags |= FL_PROMOTED1 /* start from age == 2 */; if (RGENGC_WB_PROTECTED_CLASS) flags |= FL_WB_PROTECTED; NEWOBJ_OF(obj, struct RClass, klass, flags, alloc_size, 0); -#if RCLASS_EXT_EMBEDDED memset(RCLASS_EXT(obj), 0, sizeof(rb_classext_t)); -#else - obj->ptr = ZALLOC(rb_classext_t); -#endif /* ZALLOC RCLASS_CONST_TBL(obj) = 0; diff --git a/gc.c b/gc.c index f6c214ea9d..3fcd4ef67b 100644 --- a/gc.c +++ b/gc.c @@ -3513,11 +3513,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj) xfree(RCLASS_SUPERCLASSES(obj)); } -#if !RCLASS_EXT_EMBEDDED - if (RCLASS_EXT(obj)) - xfree(RCLASS_EXT(obj)); -#endif - (void)RB_DEBUG_COUNTER_INC_IF(obj_module_ptr, BUILTIN_TYPE(obj) == T_MODULE); (void)RB_DEBUG_COUNTER_INC_IF(obj_class_ptr, BUILTIN_TYPE(obj) == T_CLASS); break; @@ -3644,9 +3639,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj) cc_table_free(objspace, obj, FALSE); rb_class_remove_from_module_subclasses(obj); rb_class_remove_from_super_subclasses(obj); -#if !RCLASS_EXT_EMBEDDED - xfree(RCLASS_EXT(obj)); -#endif RB_DEBUG_COUNTER_INC(obj_iclass_ptr); break; @@ -4905,9 +4897,6 @@ obj_memsize_of(VALUE obj, int use_all_types) if (FL_TEST_RAW(obj, RCLASS_SUPERCLASSES_INCLUDE_SELF)) { size += (RCLASS_SUPERCLASS_DEPTH(obj) + 1) * sizeof(VALUE); } -#if !RCLASS_EXT_EMBEDDED - size += sizeof(rb_classext_t); -#endif } break; case T_ICLASS: diff --git a/internal/class.h b/internal/class.h index 3e5108a3bd..b33c807e97 100644 --- a/internal/class.h +++ b/internal/class.h @@ -76,21 +76,12 @@ struct RClass { struct RBasic basic; VALUE super; struct rb_id_table *m_tbl; -#if !RCLASS_EXT_EMBEDDED - struct rb_classext_struct *ptr; -#endif }; -#if RCLASS_EXT_EMBEDDED // Assert that classes can be embedded in size_pools[2] (which has 160B slot size) STATIC_ASSERT(sizeof_rb_classext_t, sizeof(struct RClass) + sizeof(rb_classext_t) <= 4 * RVALUE_SIZE); -#endif -#if RCLASS_EXT_EMBEDDED -# define RCLASS_EXT(c) ((rb_classext_t *)((char *)(c) + sizeof(struct RClass))) -#else -# define RCLASS_EXT(c) (RCLASS(c)->ptr) -#endif +#define RCLASS_EXT(c) ((rb_classext_t *)((char *)(c) + sizeof(struct RClass))) #define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl) #define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl) #define RCLASS_IVPTR(c) (RCLASS_EXT(c)->iv_ptr) diff --git a/internal/gc.h b/internal/gc.h index bb0f8016fb..d19b09f6fc 100644 --- a/internal/gc.h +++ b/internal/gc.h @@ -189,9 +189,6 @@ struct rb_objspace; /* in vm_core.h */ # define SIZE_POOL_COUNT 5 #endif -// TODO: Make rb_classext_t small enough to fit in 80 bytes on 32 bit -#define RCLASS_EXT_EMBEDDED (SIZEOF_UINT64_T == SIZEOF_VALUE) - typedef struct ractor_newobj_size_pool_cache { struct RVALUE *freelist; struct heap_page *using_page;