Make RClass.cc_table a managed object

For now this doesn't change anything, but now that the table
is managed by GC, it opens the door to use RCU when in multi-ractor
mode, hence allow unsynchornized reads.
This commit is contained in:
Jean Boussier 2025-07-30 12:44:39 +02:00
parent fc5e1541e4
commit f2a7e48dea
10 changed files with 191 additions and 159 deletions

View file

@ -83,7 +83,7 @@ struct rb_classext_struct {
struct rb_id_table *m_tbl;
struct rb_id_table *const_tbl;
struct rb_id_table *callable_m_tbl;
struct rb_id_table *cc_tbl; /* ID -> [[ci1, cc1], [ci2, cc2] ...] */
VALUE cc_tbl; /* { ID => { cme, [cc1, cc2, ...] }, ... } */
struct rb_id_table *cvc_tbl;
VALUE *superclasses;
/**
@ -262,7 +262,7 @@ static inline void RCLASS_WRITE_SUPER(VALUE klass, VALUE super);
static inline void RCLASS_SET_CONST_TBL(VALUE klass, struct rb_id_table *table, bool shared);
static inline void RCLASS_WRITE_CONST_TBL(VALUE klass, struct rb_id_table *table, bool shared);
static inline void RCLASS_WRITE_CALLABLE_M_TBL(VALUE klass, struct rb_id_table *table);
static inline void RCLASS_WRITE_CC_TBL(VALUE klass, struct rb_id_table *table);
static inline void RCLASS_WRITE_CC_TBL(VALUE klass, VALUE table);
static inline void RCLASS_SET_CVC_TBL(VALUE klass, struct rb_id_table *table);
static inline void RCLASS_WRITE_CVC_TBL(VALUE klass, struct rb_id_table *table);
@ -628,9 +628,9 @@ RCLASS_WRITE_CALLABLE_M_TBL(VALUE klass, struct rb_id_table *table)
}
static inline void
RCLASS_WRITE_CC_TBL(VALUE klass, struct rb_id_table *table)
RCLASS_WRITE_CC_TBL(VALUE klass, VALUE table)
{
RCLASSEXT_CC_TBL(RCLASS_EXT_WRITABLE(klass)) = table;
RB_OBJ_WRITE(klass, &RCLASSEXT_CC_TBL(RCLASS_EXT_WRITABLE(klass)), table);
}
static inline void

View file

@ -148,7 +148,6 @@ static inline void MEMO_V2_SET(struct MEMO *m, VALUE v);
size_t rb_imemo_memsize(VALUE obj);
void rb_imemo_mark_and_move(VALUE obj, bool reference_updating);
void rb_cc_tbl_free(struct rb_id_table *cc_tbl, VALUE klass);
void rb_imemo_free(VALUE obj);
RUBY_SYMBOL_EXPORT_BEGIN