mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-14 15:40:19 +02:00
fix a prompt bug
* libguile/control.h: * libguile/control.c (scm_c_make_prompt): Instead of taking a VM arg, take the registers directly. (scm_c_abort): Declare as returning void. In fact it will never return. * libguile/eval.c (eval): * libguile/throw.c (pre_init_catch): Adapt to prompt API change. * libguile/vm-i-system.c (prompt): Pass the abort ip as the ip to scm_c_make_prompt. This fixes a bug in which we used the "offset" local var, but it wasn't guaranteed to be around after a longjmp.
This commit is contained in:
parent
b8af64db76
commit
d296431516
4 changed files with 26 additions and 19 deletions
|
@ -1479,19 +1479,21 @@ VM_DEFINE_INSTRUCTION (83, prompt, "prompt", 4, 2, 0)
|
|||
POP (k);
|
||||
|
||||
SYNC_REGISTER ();
|
||||
/* Push the prompt onto the dynamic stack. The setjmp itself has to be local
|
||||
to this procedure. */
|
||||
/* FIXME: do more error checking */
|
||||
prompt = scm_c_make_prompt (vm, k, escape_only_p, vm_cookie);
|
||||
/* Push the prompt onto the dynamic stack. */
|
||||
prompt = scm_c_make_prompt (k, fp, sp, ip + offset, escape_only_p, vm_cookie);
|
||||
scm_i_set_dynwinds (scm_cons (prompt, scm_i_dynwinds ()));
|
||||
if (SCM_PROMPT_SETJMP (prompt))
|
||||
{
|
||||
/* The prompt exited nonlocally. Cache the regs back from the vp, and go
|
||||
to the handler.
|
||||
|
||||
Note, at this point, we must assume that any variable local to
|
||||
vm_engine that can be assigned *has* been assigned. So we need to pull
|
||||
all our state back from the ip/fp/sp.
|
||||
*/
|
||||
CACHE_REGISTER (); /* Really we only need SP. FP and IP should be
|
||||
unmodified. */
|
||||
ip += offset;
|
||||
CACHE_REGISTER ();
|
||||
program = SCM_FRAME_PROGRAM (fp);
|
||||
CACHE_PROGRAM ();
|
||||
NEXT;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue