diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2020-11-06 10:11:20 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2020-11-09 09:44:16 -0800 |
commit | eb229994e5b53e201e776ea103970751d3b1725b (patch) | |
tree | 32a14cbd95117defe7aaed2a14b3fe8b8f669f17 /internal/variable.h | |
parent | d14397bcc48b73070953c9fbd410ba435e5f4b8c (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3740
Diffstat (limited to 'internal/variable.h')
-rw-r--r-- | internal/variable.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/variable.h b/internal/variable.h index d5d0cccbfb..34ad4e1199 100644 --- a/internal/variable.h +++ b/internal/variable.h @@ -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 |