diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2025-08-28 19:29:46 +0200 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2025-08-29 00:02:29 +0200 |
| commit | b6d4882c05d64aa6cb5ff8761584ae910de67f21 (patch) | |
| tree | adf5ec7b381d85182c1a2a5a8d2d2d800d1e8ab7 /internal | |
| parent | b1dbcd3ce3cb61f7b136f4b1e1bb97a6f3635c3e (diff) | |
YJIT: getinstancevariable cache indexes for types other than T_OBJECT
While accessing the ivars of other types is too complicated to
realistically generate the ASM for it, we can at least provide
the ivar index as to not have to lookup the shape tree every
time.
```
compare-ruby: ruby 3.5.0dev (2025-08-27T14:58:58Z merge-vm-setivar-d.. 5b749d8e53) +YJIT +PRISM [arm64-darwin24]
built-ruby: ruby 3.5.0dev (2025-08-28T17:58:32Z yjit-get-exivar efaa8c9b09) +YJIT +PRISM [arm64-darwin24]
| |compare-ruby|built-ruby|
|:--------------------------|-----------:|---------:|
|vm_ivar_get_on_obj | 930.458| 936.865|
| | -| 1.01x|
|vm_ivar_get_on_class | 134.471| 431.622|
| | -| 3.21x|
|vm_ivar_get_on_generic | 146.679| 284.408|
| | -| 1.94x|
```
Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Diffstat (limited to 'internal')
| -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 2cb50f66ae..d256330168 100644 --- a/internal/variable.h +++ b/internal/variable.h @@ -53,6 +53,7 @@ VALUE rb_obj_field_get(VALUE obj, shape_id_t target_shape_id); void rb_ivar_set_internal(VALUE obj, ID id, VALUE val); attr_index_t rb_ivar_set_index(VALUE obj, ID id, VALUE val); attr_index_t rb_obj_field_set(VALUE obj, shape_id_t target_shape_id, ID field_name, VALUE val); +VALUE rb_ivar_get_at(VALUE obj, attr_index_t index, ID id); RUBY_SYMBOL_EXPORT_BEGIN /* variable.c (export) */ |
