Add ST table to gen_ivtbl for complex shapes

On 32-bit systems, we must store the shape ID in the gen_ivtbl to not
lose the shape. If we directly store the ST table into the generic
ivar table, then we lose the shape. This makes it impossible to
determine the shape of the object and whether it is too complex or not.
This commit is contained in:
Peter Zhu 2023-10-31 09:38:35 -04:00
parent 1c45124c49
commit e2d950733e
5 changed files with 118 additions and 88 deletions

View file

@ -16,8 +16,15 @@ struct gen_ivtbl {
#if !SHAPE_IN_BASIC_FLAGS
uint16_t shape_id;
#endif
uint32_t numiv;
VALUE ivptr[FLEX_ARY_LEN];
union {
struct {
uint32_t numiv;
VALUE ivptr[1];
} shape;
struct {
st_table *table;
} complex;
} as;
};
int rb_ivar_generic_ivtbl_lookup(VALUE obj, struct gen_ivtbl **);