aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-10-13 08:52:23 -0700
committerGitHub <noreply@github.com>2023-10-13 08:52:23 -0700
commit5808999d30fc7c4fd74048a50129fd87b590b41c (patch)
treeda36a9aea7b43bb5d7afe899d884aff8ec76e54a /vm_insnhelper.c
parent0bf1749e9fcef24bf7bebbce2a62ee6c766d4c7c (diff)
downloadruby-5808999d30fc7c4fd74048a50129fd87b590b41c.tar.gz
YJIT: Fallback opt_getconstant_path for const_missing (#8623)
* YJIT: Fallback opt_getconstant_path for const_missing * Fix a comment [ci skip] * Remove a wrapper function
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 9d3842ac75..3955a523d0 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -5846,6 +5846,27 @@ vm_ic_update(const rb_iseq_t *iseq, IC ic, VALUE val, const VALUE *reg_ep, const
rb_rjit_constant_ic_update(iseq, ic, pos);
}
+VALUE
+rb_vm_opt_getconstant_path(rb_execution_context_t *ec, rb_control_frame_t *const reg_cfp, IC ic)
+{
+ VALUE val;
+ const ID *segments = ic->segments;
+ struct iseq_inline_constant_cache_entry *ice = ic->entry;
+ if (ice && vm_ic_hit_p(ice, GET_EP())) {
+ val = ice->value;
+
+ VM_ASSERT(val == vm_get_ev_const_chain(ec, segments));
+ } else {
+ ruby_vm_constant_cache_misses++;
+ val = vm_get_ev_const_chain(ec, segments);
+ vm_ic_track_const_chain(GET_CFP(), ic, segments);
+ // Undo the PC increment to get the address to this instruction
+ // INSN_ATTR(width) == 2
+ vm_ic_update(GET_ISEQ(), ic, val, GET_EP(), GET_PC() - 2);
+ }
+ return val;
+}
+
static VALUE
vm_once_dispatch(rb_execution_context_t *ec, ISEQ iseq, ISE is)
{