diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-18 17:01:40 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:43 -0400 |
commit | b74d6563a665f225f182c4921db68852bbb7e1f1 (patch) | |
tree | 14a7131d423549cf1ffc661048e7501d5ce5ae24 /yjit.c | |
parent | 2e2430564aa32b68f9e2d99e1f1e273bee3defda (diff) |
Extract yjit_force_iv_index and make it work when object is frozen
In an effort to simplify the logic YJIT generates for accessing instance
variable, YJIT ensures that a given name-to-index mapping exists at
compile time. In the case that the mapping doesn't exist, it was created
by using rb_ivar_set() with Qundef on the sample object we see at
compile time. This hack isn't fine if the sample object happens to be
frozen, in which case YJIT would raise a FrozenError unexpectedly.
To deal with this, make a new function that only reserves the mapping
but doesn't touch the object. This is rb_obj_ensure_iv_index_mapping().
This new function superceeds the functionality of rb_iv_index_tbl_lookup()
so it was removed.
Reported by and includes a test case from John Hawthorn <john@hawthorn.email>
Fixes: GH-282
Diffstat (limited to 'yjit.c')
0 files changed, 0 insertions, 0 deletions