move stack overflow checker
This commit is contained in:
parent
cb54f0e065
commit
315c17c8d4
6
vm.c
6
vm.c
|
@ -581,7 +581,7 @@ pic_apply5(pic_state *pic, struct pic_proc *proc, pic_value arg1, pic_value arg2
|
||||||
# define VM_LOOP_END } }
|
# define VM_LOOP_END } }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PUSH(v) ((pic->sp >= pic->stend) ? abort() : (*pic->sp++ = (v)))
|
#define PUSH(v) (*pic->sp++ = (v))
|
||||||
#define POP() (*--pic->sp)
|
#define POP() (*--pic->sp)
|
||||||
|
|
||||||
#define PUSHCI() (++pic->ci)
|
#define PUSHCI() (++pic->ci)
|
||||||
|
@ -843,6 +843,10 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
||||||
|
|
||||||
VM_CALL_PRINT;
|
VM_CALL_PRINT;
|
||||||
|
|
||||||
|
if (pic->sp >= pic->stend) {
|
||||||
|
pic_panic(pic, "VM stack overflow");
|
||||||
|
}
|
||||||
|
|
||||||
ci = PUSHCI();
|
ci = PUSHCI();
|
||||||
ci->argc = c.u.i;
|
ci->argc = c.u.i;
|
||||||
ci->retc = 1;
|
ci->retc = 1;
|
||||||
|
|
Loading…
Reference in New Issue