1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 09:10:22 +02:00

Various VM stack management fixes

* libguile/vm.c (vm_increase_sp): New interface, to increase the SP to
  some new level, possibly expanding the stack.
  (vm_push_sp, vm_restore_sp): Intefaces to vm_increase_sp.
  (vm_return_to_continuation): Don't throw an error if there's not
  enough space; instead, expand.
  (vm_reinstate_partial_continuation): Use the new helper.
  (return_unused_stack_to_os): Avoid off-by-one error (sp points to
  valid memory.)
  (scm_call_n): Never write beyond the sp.
This commit is contained in:
Andy Wingo 2014-02-05 22:52:00 +01:00
parent b3ae2b5068
commit b914b236c3
2 changed files with 94 additions and 66 deletions

View file

@ -195,9 +195,11 @@
#define ALLOC_FRAME(n) \
do { \
vp->sp = LOCAL_ADDRESS (n - 1); \
CHECK_OVERFLOW (); \
if (vp->sp > vp->sp_max_since_gc) \
vp->sp_max_since_gc = vp->sp; \
{ \
vp->sp_max_since_gc = vp->sp; \
CHECK_OVERFLOW (); \
} \
} while (0)
/* Reset the current frame to hold N locals. Used when we know that no