diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2025-08-21 13:24:45 +0200 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2025-08-21 14:17:29 +0200 |
| commit | b6bf44ae0f0196c58a07e13ac1bd7adafd13f8b2 (patch) | |
| tree | d0fa52f182518cfa0fb6d8a573f80d0b3060e884 /imemo.c | |
| parent | a837ec0962674284de322bfe9b336a410146589d (diff) | |
variable.c: handle cleared fields_obj in genfields cache
[Bug #21547]
Followup: https://github.com/ruby/ruby/pull/14201
When adding an instance variable and the IMEMO/fields need to be
larger, we allocate a new one and clear the old one.
Since the old one may still be in other ec's cache, on a hit we must
check the IMEMO/fields isn't a stale one.
Diffstat (limited to 'imemo.c')
| -rw-r--r-- | imemo.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -3,6 +3,7 @@ #include "id_table.h" #include "internal.h" #include "internal/imemo.h" +#include "internal/object.h" #include "internal/st.h" #include "vm_callinfo.h" @@ -208,6 +209,8 @@ rb_imemo_fields_clear(VALUE fields_obj) else { RBASIC_SET_SHAPE_ID(fields_obj, ROOT_SHAPE_ID); } + // Invalidate the ec->gen_fields_cache. + RBASIC_CLEAR_CLASS(fields_obj); } /* ========================================================================= |
