[bugfix] don't refer to env storage when accessing non-captured variable
This commit is contained in:
parent
46c1d0f2a7
commit
b0b1b77c65
16
vm.c
16
vm.c
|
@ -755,20 +755,28 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
||||||
}
|
}
|
||||||
CASE(OP_LREF) {
|
CASE(OP_LREF) {
|
||||||
pic_callinfo *ci = pic->ci;
|
pic_callinfo *ci = pic->ci;
|
||||||
|
struct pic_irep *irep;
|
||||||
|
|
||||||
if (ci->env != NULL && ci->env->regs == ci->env->storage) {
|
if (ci->env != NULL && ci->env->regs == ci->env->storage) {
|
||||||
PUSH(ci->env->regs[c.u.i - (ci->regs - ci->fp)]);
|
irep = pic_get_proc(pic)->u.irep;
|
||||||
NEXT;
|
if (c.u.i >= irep->argc + irep->localc) {
|
||||||
|
PUSH(ci->env->regs[c.u.i - (ci->regs - ci->fp)]);
|
||||||
|
NEXT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PUSH(pic->ci->fp[c.u.i]);
|
PUSH(pic->ci->fp[c.u.i]);
|
||||||
NEXT;
|
NEXT;
|
||||||
}
|
}
|
||||||
CASE(OP_LSET) {
|
CASE(OP_LSET) {
|
||||||
pic_callinfo *ci = pic->ci;
|
pic_callinfo *ci = pic->ci;
|
||||||
|
struct pic_irep *irep;
|
||||||
|
|
||||||
if (ci->env != NULL && ci->env->regs == ci->env->storage) {
|
if (ci->env != NULL && ci->env->regs == ci->env->storage) {
|
||||||
ci->env->regs[c.u.i - (ci->regs - ci->fp)] = POP();
|
irep = pic_get_proc(pic)->u.irep;
|
||||||
NEXT;
|
if (c.u.i >= irep->argc + irep->localc) {
|
||||||
|
ci->env->regs[c.u.i - (ci->regs - ci->fp)] = POP();
|
||||||
|
NEXT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pic->ci->fp[c.u.i] = POP();
|
pic->ci->fp[c.u.i] = POP();
|
||||||
NEXT;
|
NEXT;
|
||||||
|
|
Loading…
Reference in New Issue