From 2ca7ad139f651baa6b8093f0f51fc0358e47b2c9 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 25 Aug 2007 21:05:20 +0000 Subject: [PATCH] * insnhelper.ci (vm_setup_method): reorder code for branch prediction. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ insnhelper.ci | 32 ++++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38dd02d4d9..d696a4658b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Aug 26 06:04:13 2007 Koichi Sasada + + * insnhelper.ci (vm_setup_method): reorder code for branch prediction. + Sun Aug 26 05:54:49 2007 Koichi Sasada * insnhelper.ci (vm_call_method): fix to relaxant safe level check diff --git a/insnhelper.ci b/insnhelper.ci index 7f1a8ef6f2..d0c9306ea0 100644 --- a/insnhelper.ci +++ b/insnhelper.ci @@ -425,7 +425,22 @@ vm_setup_method(rb_thread_t *th, rb_control_frame_t *cfp, /* stack overflow check */ CHECK_STACK_OVERFLOW(cfp, iseq->stack_max + 0x10); - if (flag & VM_CALL_TAILCALL_BIT) { + if (LIKELY(!(flag & VM_CALL_TAILCALL_BIT))) { + if (0) printf("local_size: %d, arg_size: %d\n", + iseq->local_size, iseq->arg_size); + + /* clear local variables */ + for (i = 0; i < iseq->local_size - iseq->arg_size; i++) { + *sp++ = Qnil; + } + + vm_push_frame(th, iseq, + FRAME_MAGIC_METHOD, recv, (VALUE) blockptr, + iseq->iseq_encoded + opt_pc, sp, 0, 0); + + cfp->sp = rsp - 1 /* recv */; + } + else { VALUE *p_rsp; cfp = ++th->cfp; /* pop cf */ p_rsp = th->cfp->sp; @@ -446,21 +461,6 @@ vm_setup_method(rb_thread_t *th, rb_control_frame_t *cfp, FRAME_MAGIC_METHOD, recv, (VALUE) blockptr, iseq->iseq_encoded + opt_pc, sp, 0, 0); } - else { - if (0) printf("local_size: %d, arg_size: %d\n", - iseq->local_size, iseq->arg_size); - - /* clear local variables */ - for (i = 0; i < iseq->local_size - iseq->arg_size; i++) { - *sp++ = Qnil; - } - - vm_push_frame(th, iseq, - FRAME_MAGIC_METHOD, recv, (VALUE) blockptr, - iseq->iseq_encoded + opt_pc, sp, 0, 0); - - cfp->sp = rsp - 1 /* recv */; - } } static inline VALUE