aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-11 03:38:38 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-11 03:38:38 +0000
commit49386fa7735721b6fe305206edfbd3125ed45857 (patch)
treedd7312cd9af9748bbab240bf8e6fdecacd183172 /vm_insnhelper.c
parentfd90eb143469dcca763b0cecad0837dd3541bd81 (diff)
downloadruby-49386fa7735721b6fe305206edfbd3125ed45857.tar.gz
_mjit_compile_send.erb: refactor to share vm_call_iseq_setup_normal
implementation. This had no major performance impact by effort to keep them inlined. vm_insnhelper.c: ditto mjit_compile.c: just update the comment about opt_pc=0 assumption git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index fd892678a6..a5d1859ec8 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1657,25 +1657,35 @@ vm_call_iseq_setup_2(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct
}
}
+/* Used in JIT to ensure intended me is used and to reduce memory access by inlining values. */
+ALWAYS_INLINE(static inline VALUE vm_call_iseq_setup_normal_internal(rb_execution_context_t *ec, rb_control_frame_t *cfp, int argc, VALUE recv, VALUE block_handler, const rb_callable_method_entry_t *me, const rb_iseq_t *iseq, const VALUE *pc, int param_size, int local_size, int stack_max));
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)
+vm_call_iseq_setup_normal_internal(rb_execution_context_t *ec, rb_control_frame_t *cfp, int argc, VALUE recv, VALUE block_handler, const rb_callable_method_entry_t *me,
+ const rb_iseq_t *iseq, const VALUE *pc, int param_size, int local_size, int stack_max)
{
- 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 *argv = cfp->sp - argc;
VALUE *sp = argv + param_size;
cfp->sp = argv - 1 /* recv */;
- vm_push_frame(ec, iseq, VM_FRAME_MAGIC_METHOD | VM_ENV_FLAG_LOCAL, calling->recv,
- calling->block_handler, (VALUE)me,
- iseq->body->iseq_encoded + opt_pc, sp,
- local_size - param_size,
- iseq->body->stack_max);
+ vm_push_frame(ec, iseq, VM_FRAME_MAGIC_METHOD | VM_ENV_FLAG_LOCAL, recv,
+ block_handler, (VALUE)me,
+ pc, sp,
+ local_size - param_size,
+ stack_max);
return Qundef;
}
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)
+{
+ const rb_callable_method_entry_t *me = cc->me;
+ const rb_iseq_t *iseq = def_iseq_ptr(me->def);
+ return vm_call_iseq_setup_normal_internal(ec, cfp, calling->argc, calling->recv, calling->block_handler, me, iseq,
+ iseq->body->iseq_encoded + opt_pc, param_size, local_size, iseq->body->stack_max);
+}
+
+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)
{