Permalink
Browse files

* vm_insnhelper.c (vm_setup_method): refactoring.

  Remove src_argc and use iseq->arg_size directly.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 948169c commit 2adb9fd4a51b054543cc40555718bd09901a324f @ko1 ko1 committed Sep 28, 2012
Showing with 11 additions and 7 deletions.
  1. +5 −0 ChangeLog
  2. +6 −7 vm_insnhelper.c
View
@@ -1,3 +1,8 @@
+Fri Sep 28 17:54:31 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_setup_method): refactoring.
+ Remove src_argc and use iseq->arg_size directly.
+
Fri Sep 28 17:26:27 2012 NARUSE, Yui <naruse@ruby-lang.org>
* lib/rubygems/installer.rb (check_that_user_bin_dir_is_in_path):
View
@@ -496,16 +496,16 @@ vm_setup_method(rb_thread_t *th, rb_control_frame_t *cfp,
const rb_method_entry_t *me, VALUE defined_class)
{
int opt_pc, i;
- VALUE *sp, *argv = cfp->sp - argc;
+ VALUE *argv = cfp->sp - argc;
rb_iseq_t *iseq = me->def->body.iseq;
VM_CALLEE_SETUP_ARG(opt_pc, th, iseq, argc, argv, &blockptr);
/* stack overflow check */
CHECK_STACK_OVERFLOW(cfp, iseq->stack_max);
- sp = argv + iseq->arg_size;
if (LIKELY(!(flag & VM_CALL_TAILCALL_BIT))) {
+ VALUE *sp = argv + iseq->arg_size;
/* clear local variables */
for (i = 0; i < iseq->local_size - iseq->arg_size; i++) {
@@ -520,19 +520,18 @@ vm_setup_method(rb_thread_t *th, rb_control_frame_t *cfp,
}
else {
VALUE *src_argv = argv;
- VALUE *sp_orig;
- const int src_argc = iseq->arg_size;
+ VALUE *sp_orig, *sp;
VALUE finish_flag = VM_FRAME_TYPE_FINISH_P(cfp) ? VM_FRAME_FLAG_FINISH : 0;
- cfp = th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp); /* pop cf */
- sp = sp_orig = cfp->sp;
+ cfp = th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp); /* pop cf */
+ sp_orig = sp = cfp->sp;
/* push self */
sp[0] = recv;
sp++;
/* copy arguments */
- for (i=0; i < src_argc; i++) {
+ for (i=0; i < iseq->arg_size; i++) {
*sp++ = src_argv[i];
}

0 comments on commit 2adb9fd

Please sign in to comment.