mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
calling->cd
instead of calling->ci
`struct rb_calling_info::cd` is introduced and `rb_calling_info::ci` is replaced with it to manipulate the inline cache of iseq while method invocation process. So that `ci` can be acessed with `calling->cd->ci`. It adds one indirection but it can be justified by the following points: 1) `vm_search_method_fastpath()` doesn't need `ci` and also `vm_call_iseq_setup_normal()` doesn't need `ci`. It means reducing `cd->ci` access in `vm_sendish()` can make it faster. 2) most of method types need to access `ci` once in theory so that 1 additional indirection doesn't matter.
This commit is contained in:
parent
e40f8bbd20
commit
280419d0e0
Notes:
git
2023-07-31 08:14:03 +00:00
4 changed files with 46 additions and 35 deletions
11
vm_eval.c
11
vm_eval.c
|
@ -96,7 +96,10 @@ vm_call0_cc(rb_execution_context_t *ec, VALUE recv, ID id, int argc, const VALUE
|
|||
}
|
||||
|
||||
struct rb_calling_info calling = {
|
||||
.ci = &VM_CI_ON_STACK(id, flags, argc, NULL),
|
||||
.cd = &(struct rb_call_data) {
|
||||
.ci = &VM_CI_ON_STACK(id, flags, argc, NULL),
|
||||
.cc = NULL,
|
||||
},
|
||||
.cc = cc,
|
||||
.block_handler = vm_passed_block_handler(ec),
|
||||
.recv = recv,
|
||||
|
@ -117,7 +120,7 @@ vm_call0_cme(rb_execution_context_t *ec, struct rb_calling_info *calling, const
|
|||
static VALUE
|
||||
vm_call0_super(rb_execution_context_t *ec, struct rb_calling_info *calling, const VALUE *argv, VALUE klass, enum method_missing_reason ex)
|
||||
{
|
||||
ID mid = vm_ci_mid(calling->ci);
|
||||
ID mid = vm_ci_mid(calling->cd->ci);
|
||||
klass = RCLASS_SUPER(klass);
|
||||
|
||||
if (klass) {
|
||||
|
@ -136,7 +139,7 @@ vm_call0_super(rb_execution_context_t *ec, struct rb_calling_info *calling, cons
|
|||
static VALUE
|
||||
vm_call0_cfunc_with_frame(rb_execution_context_t* ec, struct rb_calling_info *calling, const VALUE *argv)
|
||||
{
|
||||
const struct rb_callinfo *ci = calling->ci;
|
||||
const struct rb_callinfo *ci = calling->cd->ci;
|
||||
VALUE val;
|
||||
const rb_callable_method_entry_t *me = vm_cc_cme(calling->cc);
|
||||
const rb_method_cfunc_t *cfunc = UNALIGNED_MEMBER_PTR(me->def, body.cfunc);
|
||||
|
@ -201,7 +204,7 @@ vm_call_check_arity(struct rb_calling_info *calling, int argc, const VALUE *argv
|
|||
static VALUE
|
||||
vm_call0_body(rb_execution_context_t *ec, struct rb_calling_info *calling, const VALUE *argv)
|
||||
{
|
||||
const struct rb_callinfo *ci = calling->ci;
|
||||
const struct rb_callinfo *ci = calling->cd->ci;
|
||||
const struct rb_callcache *cc = calling->cc;
|
||||
VALUE ret;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue