summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-03-29 17:57:52 -0400
committerGitHub <noreply@github.com>2023-03-29 17:57:52 -0400
commit1b064227671fe780044406f163b117ef85f2f8b9 (patch)
treee943381fd0bff79556c6541af9e456b7ca551842 /vm.c
parenta1a4d77472475fc9ee4c16cce7b79f6f492c91c3 (diff)
downloadruby-1b064227671fe780044406f163b117ef85f2f8b9.tar.gz
YJIT: Leave cfp->pc uninitialized for VM_FRAME_MAGIC_CFUNC
C function frames don't need to use the VM-specific pc field to run properly. When pushing a control frame from output code, save one instruction by leaving the field uninitialized. Fix-up rb_vm_svar_lep(), which is used while setting local variables via Regexp#=~. Use cfp->iseq as a secondary signal so it can stop assuming that all CFUNC frames always have zero pc's.
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index 31725ae2d0..69d57913a4 100644
--- a/vm.c
+++ b/vm.c
@@ -1609,7 +1609,7 @@ rb_vm_invoke_proc_with_self(rb_execution_context_t *ec, rb_proc_t *proc, VALUE s
VALUE *
rb_vm_svar_lep(const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
{
- while (cfp->pc == 0) {
+ while (cfp->pc == 0 || cfp->iseq == 0) {
if (VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_IFUNC) {
struct vm_ifunc *ifunc = (struct vm_ifunc *)cfp->iseq;
return ifunc->svar_lep;