fix stack operation bug
This commit is contained in:
parent
9b7fdb0725
commit
49e1f54195
5
src/vm.c
5
src/vm.c
|
@ -409,7 +409,7 @@ pic_run(pic_state *pic, struct pic_proc *proc, pic_value args)
|
||||||
NEXT;
|
NEXT;
|
||||||
}
|
}
|
||||||
CASE(OP_CALL) {
|
CASE(OP_CALL) {
|
||||||
pic_value c;
|
pic_value c, v;
|
||||||
struct pic_proc *proc;
|
struct pic_proc *proc;
|
||||||
|
|
||||||
pic_gc_protect(pic, c = POP());
|
pic_gc_protect(pic, c = POP());
|
||||||
|
@ -418,10 +418,11 @@ pic_run(pic_state *pic, struct pic_proc *proc, pic_value args)
|
||||||
ci->proc = proc;
|
ci->proc = proc;
|
||||||
ci->argc = pc->u.i;
|
ci->argc = pc->u.i;
|
||||||
if (pic_proc_cfunc_p(c)) {
|
if (pic_proc_cfunc_p(c)) {
|
||||||
PUSH(proc->u.cfunc(pic));
|
v = proc->u.cfunc(pic);
|
||||||
pic->sp -= ci->argc;
|
pic->sp -= ci->argc;
|
||||||
POPCI();
|
POPCI();
|
||||||
ci = pic->ci - 1;
|
ci = pic->ci - 1;
|
||||||
|
PUSH(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pic_raise(pic, "closure call not suppoted");
|
pic_raise(pic, "closure call not suppoted");
|
||||||
|
|
Loading…
Reference in New Issue