Refactor generic fields to use T_IMEMO/fields objects.

Followup: https://github.com/ruby/ruby/pull/13589

This simplify a lot of things, as we no longer need to manually
manage the memory, we can use the Read-Copy-Update pattern and
avoid numerous race conditions.

Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>
This commit is contained in:
Jean Boussier 2025-06-16 11:19:12 +02:00
parent 164486a954
commit cd9f447be2
Notes: git 2025-06-17 13:28:17 +00:00
10 changed files with 382 additions and 418 deletions

View file

@ -12,18 +12,7 @@
#include "shape.h"
struct gen_fields_tbl {
union {
struct {
VALUE fields[1];
} shape;
struct {
st_table *table;
} complex;
} as;
};
int rb_ivar_generic_fields_tbl_lookup(VALUE obj, struct gen_fields_tbl **);
int rb_ivar_generic_fields_tbl_lookup(VALUE obj, VALUE *);
void rb_copy_complex_ivars(VALUE dest, VALUE obj, shape_id_t src_shape_id, st_table *fields_table);
void rb_free_rb_global_tbl(void);