[前][次][番号順一覧][スレッド一覧]

ruby-changes:33241

From: nobu <ko1@a...>
Date: Wed, 12 Mar 2014 11:18:55 +0900 (JST)
Subject: [ruby-changes:33241] nobu:r45320 (trunk): vm_insnhelper.c: inline function

nobu	2014-03-12 11:18:50 +0900 (Wed, 12 Mar 2014)

  New Revision: 45320

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45320

  Log:
    vm_insnhelper.c: inline function
    
    * vm_insnhelper.c (vm_callee_setup_arg): turn a macro into an
      inline function.

  Modified files:
    trunk/ChangeLog
    trunk/vm_insnhelper.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45319)
+++ ChangeLog	(revision 45320)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Mar 12 11:18:40 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_insnhelper.c (vm_callee_setup_arg): turn a macro into an
+	  inline function.
+
 Wed Mar 12 07:26:05 2014  Eric Wong  <e@8...>
 
 	* insns.def (opt_regexpmatch2): respect redefined match op
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 45319)
+++ vm_insnhelper.c	(revision 45320)
@@ -1196,23 +1196,31 @@ static VALUE vm_call_iseq_setup_2(rb_thr https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1196
 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);
 
-#define VM_CALLEE_SETUP_ARG(th, ci, iseq, argv, is_lambda) \
-    if (LIKELY((iseq)->arg_simple & 0x01)) { \
-	/* simple check */ \
-	if ((ci)->argc != (iseq)->argc) { \
-	    argument_error((iseq), ((ci)->argc), (iseq)->argc, (iseq)->argc); \
-	} \
-	(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, !(is_lambda) && !((ci)->me->flag & NOEX_PROTECTED)); \
-    } \
-    else { \
-	(ci)->aux.opt_pc = vm_callee_setup_arg_complex((th), (ci), (iseq), (argv)); \
+static inline void
+vm_callee_setup_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq,
+		    VALUE *argv, int is_lambda)
+{
+    if (LIKELY(iseq->arg_simple & 0x01)) {
+	/* simple check */
+	if (ci->argc != iseq->argc) {
+	    argument_error(iseq, ci->argc, iseq->argc, iseq->argc);
+	}
+	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),
+			!is_lambda && !(ci->me->flag & NOEX_PROTECTED));
     }
+    else {
+	ci->aux.opt_pc = vm_callee_setup_arg_complex(th, ci, iseq, argv);
+    }
+}
 
 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, ci->me->def->body.iseq, cfp->sp - ci->argc, 0);
+    vm_callee_setup_arg(th, ci, ci->me->def->body.iseq, cfp->sp - ci->argc, 0);
     return vm_call_iseq_setup_2(th, cfp, ci);
 }
 
@@ -2299,7 +2307,7 @@ vm_yield_setup_args(rb_thread_t * const https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2307
 	ci_entry.flag = 0;
 	ci_entry.argc = argc;
 	ci_entry.blockptr = (rb_block_t *)blockptr;
-	VM_CALLEE_SETUP_ARG(th, &ci_entry, iseq, argv, 1);
+	vm_callee_setup_arg(th, &ci_entry, iseq, argv, 1);
 	return ci_entry.aux.opt_pc;
     }
     else {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]