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;
|
struct pic_proc *proc;
|
||||||
codegen_state *state;
|
codegen_state *state;
|
||||||
|
jmp_buf jmp, *prev_jmp = pic->jmp;
|
||||||
|
|
||||||
state = new_codegen_state(pic);
|
state = new_codegen_state(pic);
|
||||||
|
|
||||||
if (! pic->jmp) {
|
if (setjmp(jmp) == 0) {
|
||||||
jmp_buf jmp;
|
pic->jmp = &jmp;
|
||||||
|
|
||||||
if (setjmp(jmp) == 0) {
|
|
||||||
pic->jmp = &jmp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* error occured */
|
|
||||||
pic->jmp = NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
/* error occured */
|
||||||
|
proc = NULL;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
state->irep = new_irep(pic);
|
state->irep = new_irep(pic);
|
||||||
state->irep->argc = 1;
|
state->irep->argc = 1;
|
||||||
state->irep->localc = 0;
|
state->irep->localc = 0;
|
||||||
|
@ -883,6 +881,9 @@ pic_codegen(pic_state *pic, pic_value obj)
|
||||||
print_irep(pic, proc->u.irep);
|
print_irep(pic, proc->u.irep);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
exit:
|
||||||
|
pic->jmp = prev_jmp;
|
||||||
|
|
||||||
return proc;
|
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;
|
struct pic_code *pc, c;
|
||||||
int ai = pic_gc_arena_preserve(pic);
|
int ai = pic_gc_arena_preserve(pic);
|
||||||
jmp_buf jmp;
|
jmp_buf jmp, *prev_jmp = pic->jmp;
|
||||||
size_t argc, i;
|
size_t argc, i;
|
||||||
struct pic_code boot[2];
|
struct pic_code boot[2];
|
||||||
|
|
||||||
|
@ -653,7 +653,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
||||||
L_STOP:
|
L_STOP:
|
||||||
val = POP();
|
val = POP();
|
||||||
|
|
||||||
pic->jmp = NULL;
|
pic->jmp = prev_jmp;
|
||||||
if (pic->errmsg) {
|
if (pic->errmsg) {
|
||||||
return pic_undef_value();
|
return pic_undef_value();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue