optimize vm_get_irep

This commit is contained in:
Yuichi Nishiwaki 2015-07-04 13:58:02 +09:00
parent ea208be508
commit 18df88d457
1 changed files with 11 additions and 21 deletions

View File

@ -431,21 +431,21 @@ pic_vm_tear_off(pic_state *pic)
} }
} }
static struct pic_irep * PIC_INLINE struct pic_irep *
vm_get_irep(pic_state *pic) vm_get_irep(pic_state *pic)
{ {
pic_value self; pic_value self;
struct pic_irep *irep; struct pic_proc *proc;
self = pic->ci->fp[0]; self = pic->ci->fp[0];
if (! pic_proc_p(self)) {
pic_errorf(pic, "logic flaw"); assert(pic_proc_p(self));
}
irep = pic_proc_ptr(self)->u.i.irep; proc = pic_proc_ptr(self);
if (! pic_proc_irep_p(pic_proc_ptr(self))) {
pic_errorf(pic, "logic flaw"); assert(pic_proc_irep_p(proc));
}
return irep; return proc->u.i.irep;
} }
#if VM_DEBUG #if VM_DEBUG
@ -827,17 +827,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value args)
NEXT; NEXT;
} }
CASE(OP_LAMBDA) { CASE(OP_LAMBDA) {
pic_value self; struct pic_irep *irep = vm_get_irep(pic);
struct pic_irep *irep;
self = pic->ci->fp[0];
if (! pic_proc_p(self)) {
pic_errorf(pic, "logic flaw");
}
irep = pic_proc_ptr(self)->u.i.irep;
if (! pic_proc_irep_p(pic_proc_ptr(self))) {
pic_errorf(pic, "logic flaw");
}
if (pic->ci->cxt == NULL) { if (pic->ci->cxt == NULL) {
vm_push_cxt(pic); vm_push_cxt(pic);