Skip to content

Commit

Permalink
refactor reuse existing on-stack structs
Browse files Browse the repository at this point in the history
rb_vm_call0 allocates its own struct call_info etc.  But they are
already there in case of rb_funcallv_with_cc.  Let's just pass the
existing ones, instead of re-creation.
  • Loading branch information
shyouhei committed Sep 19, 2019
1 parent 69e209a commit 66c644d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion vm_eval.c
Expand Up @@ -991,7 +991,18 @@ rb_funcallv_with_cc(struct rb_call_cache_and_mid *cc, VALUE recv, ID mid, int ar
vm_search_method(&ci, &cc->cc, recv);

if (LIKELY(! UNDEFINED_METHOD_ENTRY_P(cc->cc.me))) {
return rb_vm_call0(GET_EC(), recv, mid, argc, argv, cc->cc.me, VM_NO_KEYWORDS);
return vm_call0_body(
GET_EC(),
&(struct rb_calling_info) {
Qundef,
recv,
argc,
VM_NO_KEYWORDS,
},
&ci,
&cc->cc,
argv
);
}
}

Expand Down

0 comments on commit 66c644d

Please sign in to comment.