summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-08-24 14:40:52 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2023-08-24 17:37:07 -0400
commit05e827427f8eaf3958ba8d29c96ae1125e06fbe0 (patch)
treee205024f889ff6a6bfcb09f65813d7d8a7962062 /vm.c
parent5937a0da80e2b41435c1b26a83e4f065bed4bd02 (diff)
Make cfp constant and use it more in vm_exec_handle_exception()
For writing THROW_DATA_VAL, being able to see that it's writing to the same frame after modifying PC and SP is nice.
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/vm.c b/vm.c
index ad1520b55c..3f0cac109a 100644
--- a/vm.c
+++ b/vm.c
@@ -2449,7 +2449,6 @@ vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state, V
const struct iseq_catch_table *ct;
unsigned long epc, cont_pc, cont_sp;
const rb_iseq_t *catch_iseq;
- rb_control_frame_t *cfp;
VALUE type;
const rb_control_frame_t *escape_cfp;
@@ -2469,7 +2468,7 @@ vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state, V
rb_vm_pop_frame(ec);
}
- cfp = ec->cfp;
+ rb_control_frame_t *const cfp = ec->cfp;
epc = cfp->pc - ISEQ_BODY(cfp->iseq)->iseq_encoded;
escape_cfp = NULL;
@@ -2508,7 +2507,7 @@ vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state, V
}
else {
/* TAG_BREAK */
- *ec->cfp->sp++ = THROW_DATA_VAL(err);
+ *cfp->sp++ = THROW_DATA_VAL(err);
ec->errinfo = Qnil;
return Qundef;
}
@@ -2581,7 +2580,7 @@ vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state, V
cfp->sp = vm_base_ptr(cfp) + entry->sp;
if (state != TAG_REDO) {
- *ec->cfp->sp++ = THROW_DATA_VAL(err);
+ *cfp->sp++ = THROW_DATA_VAL(err);
}
ec->errinfo = Qnil;
VM_ASSERT(ec->tag->state == TAG_NONE);