propagate jmp_bufs (useful when C stack and scheme stack interleave)
This commit is contained in:
parent
a4d1a361e7
commit
6de5bc7550
|
@ -851,21 +851,19 @@ pic_codegen(pic_state *pic, pic_value obj)
|
|||
{
|
||||
struct pic_proc *proc;
|
||||
codegen_state *state;
|
||||
jmp_buf jmp, *prev_jmp = pic->jmp;
|
||||
|
||||
state = new_codegen_state(pic);
|
||||
|
||||
if (! pic->jmp) {
|
||||
jmp_buf jmp;
|
||||
|
||||
if (setjmp(jmp) == 0) {
|
||||
pic->jmp = &jmp;
|
||||
}
|
||||
else {
|
||||
/* error occured */
|
||||
pic->jmp = NULL;
|
||||
return NULL;
|
||||
}
|
||||
proc = NULL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
state->irep = new_irep(pic);
|
||||
state->irep->argc = 1;
|
||||
state->irep->localc = 0;
|
||||
|
@ -883,6 +881,9 @@ pic_codegen(pic_state *pic, pic_value obj)
|
|||
print_irep(pic, proc->u.irep);
|
||||
#endif
|
||||
|
||||
exit:
|
||||
pic->jmp = prev_jmp;
|
||||
|
||||
return proc;
|
||||
}
|
||||
|
||||
|
|
4
src/vm.c
4
src/vm.c
|
@ -278,7 +278,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
{
|
||||
struct pic_code *pc, c;
|
||||
int ai = pic_gc_arena_preserve(pic);
|
||||
jmp_buf jmp;
|
||||
jmp_buf jmp, *prev_jmp = pic->jmp;
|
||||
size_t argc, i;
|
||||
struct pic_code boot[2];
|
||||
|
||||
|
@ -653,7 +653,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
|||
L_STOP:
|
||||
val = POP();
|
||||
|
||||
pic->jmp = NULL;
|
||||
pic->jmp = prev_jmp;
|
||||
if (pic->errmsg) {
|
||||
return pic_undef_value();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue