summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--vm_insnhelper.c13
2 files changed, 11 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 2ddaffe765..c847055198 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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):
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index fe9228f9c6..f134487107 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -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];
}