mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 03:30:27 +02:00
Add SCM_F_DYNSTACK_PROMPT_PUSH_NARGS prompt flag
* libguile/dynstack.h (scm_t_dynstack_prompt_flags): New flag, SCM_F_DYNSTACK_PROMPT_PUSH_NARGS, set if the continuation expects the number of args to be pushed on the top of the stack. * libguile/control.c (scm_c_abort): Only push nargs if requested. * libguile/eval.c (eval): * libguile/throw.c (pre_init_catch): * libguile/vm-i-system.c (prompt): Set SCM_F_DYNSTACK_PROMPT_PUSH_NARGS.
This commit is contained in:
parent
b7f10defe6
commit
c6cd692f08
5 changed files with 9 additions and 4 deletions
|
@ -214,7 +214,8 @@ scm_c_abort (SCM vm, SCM tag, size_t n, SCM *argv,
|
|||
*(++(SCM_VM_DATA (vm)->sp)) = cont;
|
||||
for (i = 0; i < n; i++)
|
||||
*(++(SCM_VM_DATA (vm)->sp)) = argv[i];
|
||||
*(++(SCM_VM_DATA (vm)->sp)) = scm_from_size_t (n+1); /* +1 for continuation */
|
||||
if (flags & SCM_F_DYNSTACK_PROMPT_PUSH_NARGS)
|
||||
*(++(SCM_VM_DATA (vm)->sp)) = scm_from_size_t (n+1); /* +1 for continuation */
|
||||
|
||||
/* Jump! */
|
||||
SCM_I_LONGJMP (*registers, 1);
|
||||
|
|
|
@ -130,7 +130,8 @@ typedef enum {
|
|||
} scm_t_dynstack_winder_flags;
|
||||
|
||||
typedef enum {
|
||||
SCM_F_DYNSTACK_PROMPT_ESCAPE_ONLY = (1 << SCM_DYNSTACK_TAG_FLAGS_SHIFT)
|
||||
SCM_F_DYNSTACK_PROMPT_ESCAPE_ONLY = (1 << SCM_DYNSTACK_TAG_FLAGS_SHIFT),
|
||||
SCM_F_DYNSTACK_PROMPT_PUSH_NARGS = (2 << SCM_DYNSTACK_TAG_FLAGS_SHIFT)
|
||||
} scm_t_dynstack_prompt_flags;
|
||||
|
||||
typedef void (*scm_t_guard) (void *);
|
||||
|
|
|
@ -413,7 +413,8 @@ eval (SCM x, SCM env)
|
|||
|
||||
/* Push the prompt onto the dynamic stack. */
|
||||
scm_dynstack_push_prompt (&SCM_I_CURRENT_THREAD->dynstack,
|
||||
SCM_F_DYNSTACK_PROMPT_ESCAPE_ONLY,
|
||||
SCM_F_DYNSTACK_PROMPT_ESCAPE_ONLY
|
||||
| SCM_F_DYNSTACK_PROMPT_PUSH_NARGS,
|
||||
k,
|
||||
SCM_VM_DATA (vm)->fp,
|
||||
SCM_VM_DATA (vm)->sp,
|
||||
|
|
|
@ -474,7 +474,8 @@ pre_init_catch (SCM tag, SCM thunk, SCM handler, SCM pre_unwind_handler)
|
|||
|
||||
/* Push the prompt onto the dynamic stack. */
|
||||
scm_dynstack_push_prompt (dynstack,
|
||||
SCM_F_DYNSTACK_PROMPT_ESCAPE_ONLY,
|
||||
SCM_F_DYNSTACK_PROMPT_ESCAPE_ONLY
|
||||
| SCM_F_DYNSTACK_PROMPT_PUSH_NARGS,
|
||||
sym_pre_init_catch_tag,
|
||||
SCM_VM_DATA (vm)->fp,
|
||||
SCM_VM_DATA (vm)->sp,
|
||||
|
|
|
@ -1453,6 +1453,7 @@ VM_DEFINE_INSTRUCTION (87, prompt, "prompt", 4, 2, 0)
|
|||
SYNC_REGISTER ();
|
||||
/* Push the prompt onto the dynamic stack. */
|
||||
flags = escape_only_p ? SCM_F_DYNSTACK_PROMPT_ESCAPE_ONLY : 0;
|
||||
flags |= SCM_F_DYNSTACK_PROMPT_PUSH_NARGS;
|
||||
scm_dynstack_push_prompt (¤t_thread->dynstack, flags, k,
|
||||
fp, sp, ip + offset, ®isters);
|
||||
NEXT;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue