mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_insnhelper.c: optimize for loop
* vm_insnhelper.c (vm_call_iseq_setup_normal): simple for loop condition optimization. this area shows up as a hotspot in VM profiles. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9797647e25
commit
4cd675ea9e
2 changed files with 9 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Dec 19 11:23:49 2013 Aman Gupta <ruby@tmm1.net>
|
||||||
|
|
||||||
|
* vm_insnhelper.c (vm_call_iseq_setup_normal): simple for loop
|
||||||
|
condition optimization. this area shows up as a hotspot in VM
|
||||||
|
profiles.
|
||||||
|
|
||||||
Thu Dec 19 10:50:13 2013 Koichi Sasada <ko1@atdot.net>
|
Thu Dec 19 10:50:13 2013 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* gc.c (newobj_of): don't need to RBASIC_SET_CLASS() which includes WB
|
* gc.c (newobj_of): don't need to RBASIC_SET_CLASS() which includes WB
|
||||||
|
|
|
@ -1228,13 +1228,13 @@ vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *c
|
||||||
static inline VALUE
|
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 i;
|
int i, local_size;
|
||||||
VALUE *argv = cfp->sp - ci->argc;
|
VALUE *argv = cfp->sp - ci->argc;
|
||||||
rb_iseq_t *iseq = ci->me->def->body.iseq;
|
rb_iseq_t *iseq = ci->me->def->body.iseq;
|
||||||
VALUE *sp = argv + iseq->arg_size;
|
VALUE *sp = argv + iseq->arg_size;
|
||||||
|
|
||||||
/* clear local variables */
|
/* clear local variables (arg_size...local_size) */
|
||||||
for (i = 0; i < iseq->local_size - iseq->arg_size; i++) {
|
for (i = iseq->arg_size, local_size = iseq->local_size; i < local_size; i++) {
|
||||||
*sp++ = Qnil;
|
*sp++ = Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue