mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
_mjit_compile_send.erb: refactor code to setup iseq
by sharing vm_call_iseq_setup_normal. This is a retry of r64280. vm_insnhelper.c: Remove unused argument `ci` and pass `me` instead of `cc` to share this with JIT. Declare this with ALWAYS_INLINE to make sure this function is inlined in JIT. tool/mk_call_iseq_optimized.rb: deal with the interface change of vm_call_iseq_setup_normal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b96ff9e069
commit
36265861b9
3 changed files with 7 additions and 11 deletions
|
@ -23,7 +23,7 @@ P.each{|param|
|
|||
static VALUE
|
||||
#{fname(param, local)}(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
|
||||
{
|
||||
return vm_call_iseq_setup_normal(ec, cfp, calling, ci, cc, 0, #{param}, #{local});
|
||||
return vm_call_iseq_setup_normal(ec, cfp, calling, cc->me, 0, #{param}, #{local});
|
||||
}
|
||||
|
||||
EOS
|
||||
|
|
|
@ -50,11 +50,8 @@
|
|||
% # JIT: Special CALL_METHOD. Inline vm_call_iseq_setup_normal for vm_call_iseq_setup_func FASTPATH. TODO: modify VM to share code with here
|
||||
fprintf(f, " {\n");
|
||||
fprintf(f, " VALUE v;\n");
|
||||
fprintf(f, " VALUE *argv = reg_cfp->sp - calling.argc;\n");
|
||||
fprintf(f, " reg_cfp->sp = argv - 1;\n"); /* recv */
|
||||
fprintf(f, " vm_push_frame(ec, (const rb_iseq_t *)0x%"PRIxVALUE", VM_FRAME_MAGIC_METHOD | VM_ENV_FLAG_LOCAL, calling.recv, "
|
||||
"calling.block_handler, 0x%"PRIxVALUE", (const VALUE *)0x%"PRIxVALUE", argv + %d, %d, %d);\n",
|
||||
(VALUE)iseq, (VALUE)cc->me, (VALUE)iseq->body->iseq_encoded, param_size, iseq->body->local_table_size - param_size, iseq->body->stack_max);
|
||||
fprintf(f, " vm_call_iseq_setup_normal(ec, reg_cfp, &calling, (const rb_callable_method_entry_t *)0x%"PRIxVALUE", 0, %d, %d);\n",
|
||||
(VALUE)cc->me, param_size, iseq->body->local_table_size); /* rb_simple_iseq_p checks rb_simple_iseq_p, which ensures has_opt == FALSE */
|
||||
if (iseq->body->catch_except_p) {
|
||||
fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n");
|
||||
fprintf(f, " v = vm_exec(ec, TRUE);\n");
|
||||
|
|
|
@ -1568,7 +1568,7 @@ vm_base_ptr(const rb_control_frame_t *cfp)
|
|||
#include "vm_args.c"
|
||||
|
||||
static inline VALUE vm_call_iseq_setup_2(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc, int opt_pc, int param_size, int local_size);
|
||||
static inline VALUE vm_call_iseq_setup_normal(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc, int opt_pc, int param_size, int local_size);
|
||||
ALWAYS_INLINE(static VALUE vm_call_iseq_setup_normal(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const rb_callable_method_entry_t *me, int opt_pc, int param_size, int local_size));
|
||||
static inline VALUE vm_call_iseq_setup_tailcall(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc, int opt_pc);
|
||||
static VALUE vm_call_super_method(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc);
|
||||
static VALUE vm_call_method_nome(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc);
|
||||
|
@ -1598,7 +1598,7 @@ vm_call_iseq_setup_normal_0start(rb_execution_context_t *ec, rb_control_frame_t
|
|||
const rb_iseq_t *iseq = def_iseq_ptr(cc->me->def);
|
||||
int param = iseq->body->param.size;
|
||||
int local = iseq->body->local_table_size;
|
||||
return vm_call_iseq_setup_normal(ec, cfp, calling, ci, cc, 0, param, local);
|
||||
return vm_call_iseq_setup_normal(ec, cfp, calling, cc->me, 0, param, local);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1650,7 +1650,7 @@ vm_call_iseq_setup_2(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct
|
|||
int opt_pc, int param_size, int local_size)
|
||||
{
|
||||
if (LIKELY(!(ci->flag & VM_CALL_TAILCALL))) {
|
||||
return vm_call_iseq_setup_normal(ec, cfp, calling, ci, cc, opt_pc, param_size, local_size);
|
||||
return vm_call_iseq_setup_normal(ec, cfp, calling, cc->me, opt_pc, param_size, local_size);
|
||||
}
|
||||
else {
|
||||
return vm_call_iseq_setup_tailcall(ec, cfp, calling, ci, cc, opt_pc);
|
||||
|
@ -1658,10 +1658,9 @@ vm_call_iseq_setup_2(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct
|
|||
}
|
||||
|
||||
static inline VALUE
|
||||
vm_call_iseq_setup_normal(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc,
|
||||
vm_call_iseq_setup_normal(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_calling_info *calling, const rb_callable_method_entry_t *me,
|
||||
int opt_pc, int param_size, int local_size)
|
||||
{
|
||||
const rb_callable_method_entry_t *me = cc->me;
|
||||
const rb_iseq_t *iseq = def_iseq_ptr(me->def);
|
||||
VALUE *argv = cfp->sp - calling->argc;
|
||||
VALUE *sp = argv + param_size;
|
||||
|
|
Loading…
Reference in a new issue