mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
NULLSTACK fixes for nonlocal exits in reentrant pre-wind handlers
* libguile/vm-i-system.c (goto/cc): Add some asserts here. * libguile/vm.c (capture_vm_cont): Add some asserts here too. (reinstate_vm_cont): Null the correct number of bytes. Add a FIXME. (vm_reset_stack): Make the code a bit clearer. Null the correct number of bytes. * libguile/vm-engine.h (NULLSTACK_FOR_NONLOCAL_EXIT): New macro, handles a very tricky case that took me days to find! Amply commented. Expands to nothing in the normal case. * libguile/vm-i-system.c (call, goto/args, mv-call): Call NULLSTACK_FOR_NONLOCAL_EXIT in the right places. Fixes continuations.test.
This commit is contained in:
parent
0570c3f197
commit
66db076ae1
3 changed files with 24 additions and 5 deletions
|
@ -247,10 +247,17 @@
|
|||
# define CHECK_STACK_LEAKN(_n) ASSERT (!sp[_n]);
|
||||
# define CHECK_STACK_LEAK() CHECK_STACK_LEAKN(1)
|
||||
# define NULLSTACK(_n) { int __x = _n; CHECK_STACK_LEAKN (_n+1); while (__x > 0) sp[__x--] = NULL; }
|
||||
/* If you have a nonlocal exit in a pre-wind proc while invoking a continuation
|
||||
inside a dynwind (phew!), the stack is fully rewound but vm_reset_stack for
|
||||
that continuation doesn't have a chance to run. It's not important on a
|
||||
semantic level, but it does mess up our stack nulling -- so this macro is to
|
||||
fix that. */
|
||||
# define NULLSTACK_FOR_NONLOCAL_EXIT() if (vp->sp > sp) NULLSTACK (vp->sp - sp);
|
||||
#else
|
||||
# define CHECK_STACK_LEAKN(_n)
|
||||
# define CHECK_STACK_LEAK()
|
||||
# define NULLSTACK(_n)
|
||||
# define NULLSTACK_FOR_NONLOCAL_EXIT()
|
||||
#endif
|
||||
|
||||
#define CHECK_OVERFLOW() \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue