Move RCLASS_CLONED to rb_classext_struct

This commit moves RCLASS_CLONED from the flags to the
rb_classext_struct. This frees the FL_USER1 bit.
This commit is contained in:
Peter Zhu 2023-04-14 16:25:06 -04:00
parent fac814c2dc
commit ad3d4e87d7
Notes: git 2023-04-16 15:07:04 +00:00
3 changed files with 5 additions and 5 deletions

View File

@ -508,8 +508,8 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
/* cloned flag is refer at constant inline cache /* cloned flag is refer at constant inline cache
* see vm_get_const_key_cref() in vm_insnhelper.c * see vm_get_const_key_cref() in vm_insnhelper.c
*/ */
FL_SET(clone, RCLASS_CLONED); RCLASS_EXT(clone)->cloned = true;
FL_SET(orig , RCLASS_CLONED); RCLASS_EXT(orig)->cloned = true;
if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) { if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
RBASIC_SET_CLASS(clone, rb_singleton_class_clone(orig)); RBASIC_SET_CLASS(clone, rb_singleton_class_clone(orig));

View File

@ -67,7 +67,8 @@ struct rb_classext_struct {
#endif #endif
attr_index_t max_iv_count; attr_index_t max_iv_count;
unsigned char variation_count; unsigned char variation_count;
bool permanent_classpath; bool permanent_classpath : 1;
bool cloned : 1;
VALUE classpath; VALUE classpath;
}; };
typedef struct rb_classext_struct rb_classext_t; typedef struct rb_classext_struct rb_classext_t;
@ -110,7 +111,6 @@ STATIC_ASSERT(sizeof_rb_classext_t, sizeof(struct RClass) + sizeof(rb_classext_t
#define RCLASS_ATTACHED_OBJECT(c) (RCLASS_EXT(c)->as.singleton_class.attached_object) #define RCLASS_ATTACHED_OBJECT(c) (RCLASS_EXT(c)->as.singleton_class.attached_object)
#define RICLASS_IS_ORIGIN FL_USER0 #define RICLASS_IS_ORIGIN FL_USER0
#define RCLASS_CLONED FL_USER1
#define RCLASS_SUPERCLASSES_INCLUDE_SELF FL_USER2 #define RCLASS_SUPERCLASSES_INCLUDE_SELF FL_USER2
#define RICLASS_ORIGIN_SHARED_MTBL FL_USER3 #define RICLASS_ORIGIN_SHARED_MTBL FL_USER3

View File

@ -895,7 +895,7 @@ vm_get_const_key_cref(const VALUE *ep)
while (cref) { while (cref) {
if (FL_TEST(CREF_CLASS(cref), FL_SINGLETON) || if (FL_TEST(CREF_CLASS(cref), FL_SINGLETON) ||
FL_TEST(CREF_CLASS(cref), RCLASS_CLONED)) { RCLASS_EXT(CREF_CLASS(cref))->cloned) {
return key_cref; return key_cref;
} }
cref = CREF_NEXT(cref); cref = CREF_NEXT(cref);