ruby-changes:39746
From: ko1 <ko1@a...>
Date: Sat, 12 Sep 2015 03:26:04 +0900 (JST)
Subject: [ruby-changes:39746] ko1:r51827 (trunk): * vm_core.h: remove rb_call_info_t::aux.opt_pc.
ko1 2015-09-12 03:25:54 +0900 (Sat, 12 Sep 2015) New Revision: 51827 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51827 Log: * vm_core.h: remove rb_call_info_t::aux.opt_pc. * vm_insnhelper.c: introduce shortcut functions for opt_pc == 0 because opt_pc is always 0 on shortcut function. Modified files: trunk/ChangeLog trunk/vm_core.h trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 51826) +++ ChangeLog (revision 51827) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Sep 11 20:23:35 2015 Koichi Sasada <ko1@a...> + + * vm_core.h: remove rb_call_info_t::aux.opt_pc. + + * vm_insnhelper.c: introduce shortcut functions for opt_pc == 0 + because opt_pc is always 0 on shortcut function. + Fri Sep 11 17:49:36 2015 Koichi Sasada <ko1@a...> * iseq.c: disable ISeq.load. It enabled accidentally at r51794. Index: vm_core.h =================================================================== --- vm_core.h (revision 51826) +++ vm_core.h (revision 51827) @@ -210,7 +210,6 @@ typedef struct rb_call_info_struct { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L210 VALUE recv; int argc; union { - int opt_pc; /* used by iseq */ unsigned int index; /* used by ivar */ enum method_missing_reason method_missing_reason; /* used by method_missing */ int inc_sp; /* used by cfunc */ Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 51826) +++ vm_insnhelper.c (revision 51827) @@ -1221,9 +1221,11 @@ vm_base_ptr(rb_control_frame_t *cfp) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1221 #include "vm_args.c" -static VALUE vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci); -static inline VALUE vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci); -static inline VALUE vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci); +static VALUE vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc); +static inline VALUE vm_call_iseq_setup_normal_0start(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci); +static inline VALUE vm_call_iseq_setup_tailcall_0start(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci); +static inline VALUE vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc); +static inline VALUE vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc); static inline VALUE @@ -1261,7 +1263,7 @@ simple_iseq_p(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1263 iseq->body->param.flags.has_block == FALSE; } -static inline void +static inline int vm_callee_setup_block_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq, VALUE *argv, const enum arg_setup_type arg_setup_type) { if (LIKELY(simple_iseq_p(iseq))) { @@ -1301,14 +1303,14 @@ vm_callee_setup_block_arg(rb_thread_t *t https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1303 } } - ci->aux.opt_pc = 0; + return 0; } else { - ci->aux.opt_pc = setup_parameters_complex(th, iseq, ci, argv, arg_setup_type); + return setup_parameters_complex(th, iseq, ci, argv, arg_setup_type); } } -static inline void +static inline int vm_callee_setup_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq, VALUE *argv) { if (LIKELY(simple_iseq_p(iseq))) { @@ -1320,14 +1322,15 @@ vm_callee_setup_arg(rb_thread_t *th, rb_ https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1322 argument_arity_error(th, iseq, ci->argc, iseq->body->param.lead_num, iseq->body->param.lead_num); } - ci->aux.opt_pc = 0; - CI_SET_FASTPATH(ci, - (UNLIKELY(ci->flag & VM_CALL_TAILCALL) ? vm_call_iseq_setup_tailcall : vm_call_iseq_setup_normal), + (UNLIKELY(ci->flag & VM_CALL_TAILCALL) ? vm_call_iseq_setup_tailcall_0start : + vm_call_iseq_setup_normal_0start), (!IS_ARGS_SPLAT(ci) && !IS_ARGS_KEYWORD(ci) && !(METHOD_ENTRY_VISI(ci->me) == METHOD_VISI_PROTECTED))); + + return 0; } else { - ci->aux.opt_pc = setup_parameters_complex(th, iseq, ci, argv, arg_setup_method); + return setup_parameters_complex(th, iseq, ci, argv, arg_setup_method); } } @@ -1343,23 +1346,23 @@ def_iseq_ptr(rb_method_definition_t *def https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1346 static VALUE vm_call_iseq_setup(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) { - vm_callee_setup_arg(th, ci, def_iseq_ptr(ci->me->def), cfp->sp - ci->argc); - return vm_call_iseq_setup_2(th, cfp, ci); + int opt_pc = vm_callee_setup_arg(th, ci, def_iseq_ptr(ci->me->def), cfp->sp - ci->argc); + return vm_call_iseq_setup_2(th, cfp, ci, opt_pc); } static VALUE -vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) +vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc) { if (LIKELY(!(ci->flag & VM_CALL_TAILCALL))) { - return vm_call_iseq_setup_normal(th, cfp, ci); + return vm_call_iseq_setup_normal(th, cfp, ci, opt_pc); } else { - return vm_call_iseq_setup_tailcall(th, cfp, ci); + return vm_call_iseq_setup_tailcall(th, cfp, ci, opt_pc); } } static inline VALUE -vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) +vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc) { int i, local_size; VALUE *argv = cfp->sp - ci->argc; @@ -1374,14 +1377,14 @@ vm_call_iseq_setup_normal(rb_thread_t *t https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1377 vm_push_frame(th, iseq, VM_FRAME_MAGIC_METHOD, ci->recv, VM_ENVVAL_BLOCK_PTR(ci->blockptr), (VALUE)me, - iseq->body->iseq_encoded + ci->aux.opt_pc, sp, 0, iseq->body->stack_max); + iseq->body->iseq_encoded + opt_pc, sp, 0, iseq->body->stack_max); cfp->sp = argv - 1 /* recv */; return Qundef; } static inline VALUE -vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) +vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc) { unsigned int i; VALUE *argv = cfp->sp - ci->argc; @@ -1413,12 +1416,24 @@ vm_call_iseq_setup_tailcall(rb_thread_t https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1416 vm_push_frame(th, iseq, VM_FRAME_MAGIC_METHOD | finish_flag, ci->recv, VM_ENVVAL_BLOCK_PTR(ci->blockptr), (VALUE)me, - iseq->body->iseq_encoded + ci->aux.opt_pc, sp, 0, iseq->body->stack_max); + iseq->body->iseq_encoded + opt_pc, sp, 0, iseq->body->stack_max); cfp->sp = sp_orig; return Qundef; } +static inline VALUE +vm_call_iseq_setup_normal_0start(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) +{ + return vm_call_iseq_setup_normal(th, cfp, ci, 0); +} + +static inline VALUE +vm_call_iseq_setup_tailcall_0start(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) +{ + return vm_call_iseq_setup_tailcall(th, cfp, ci, 0); +} + static VALUE call_cfunc_m2(VALUE (*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv) { @@ -2284,8 +2299,7 @@ vm_yield_with_cfunc(rb_thread_t *th, con https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2299 static int vm_yield_callee_setup_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq, VALUE *argv, enum arg_setup_type arg_setup_type) { - vm_callee_setup_block_arg(th, ci, iseq, argv, arg_setup_type); - return ci->aux.opt_pc; + return vm_callee_setup_block_arg(th, ci, iseq, argv, arg_setup_type); } static int @@ -2315,12 +2329,10 @@ vm_invoke_block(rb_thread_t *th, rb_cont https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2329 iseq = block->iseq; if (!RUBY_VM_IFUNC_P(iseq)) { - int opt_pc; const int arg_size = iseq->body->param.size; int is_lambda = block_proc_is_lambda(block->proc); VALUE * const rsp = GET_SP() - ci->argc; - - opt_pc = vm_yield_callee_setup_arg(th, ci, iseq, rsp, is_lambda ? arg_setup_lambda : arg_setup_block); + int opt_pc = vm_yield_callee_setup_arg(th, ci, iseq, rsp, is_lambda ? arg_setup_lambda : arg_setup_block); SET_SP(rsp); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/