1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

eagerly initialize ivar table when index is small enough

When the inline cache is written, the iv table will contain an entry for
the instance variable.  If we get an inline cache hit, then we know the
iv table must contain a value for the index written to the inline cache.

If the index in the inline cache is larger than the list on the object,
but *smaller* than the iv index table on the class, then we can just
eagerly allocate the iv list to be the same size as the iv index table.

This avoids duplicate work of checking frozen as well as looking up the
index for the particular instance variable name.
This commit is contained in:
Aaron Patterson 2020-11-06 10:11:20 -08:00 committed by Aaron Patterson
parent d14397bcc4
commit eb229994e5
Notes: git 2020-11-10 02:44:53 +09:00
4 changed files with 50 additions and 20 deletions

View file

@ -52,6 +52,7 @@ VALUE rb_gvar_get(ID);
VALUE rb_gvar_set(ID, VALUE);
VALUE rb_gvar_defined(ID);
void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
void rb_init_iv_list(VALUE obj, uint32_t len, uint32_t newsize, st_table * index_tbl);
MJIT_SYMBOL_EXPORT_END
static inline bool