diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-11 03:38:38 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-11 03:38:38 +0000 |
commit | b4b012c529d4c5ca71e6bcd3e543652001ab6903 (patch) | |
tree | dd7312cd9af9748bbab240bf8e6fdecacd183172 /vm_insnhelper.c | |
parent | 6dfaccf20da5deefe66221df8b4d95c68dfbe233 (diff) |
_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.c | 30 |
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) { |