1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

Return unused parts of the stack to the OS

* libguile/vm.h (struct scm_vm): Reorder fields.  Add "sp_max_since_gc"
  field.
* libguile/vm-engine.c (ALLOC_FRAME, RESET_FRAME):
* libguile/vm.c (vm_return_to_continuation)
  (vm_reinstate_partial_continuation, scm_call_n): In places where we
  could increase the stack height, update sp_max_since_gc.
  (vm_expand_stack): Relocate sp_max_since_gc on expansion.
  (scm_bootstrap_vm): Record the page size using gnulib's getpagesize.
  (return_unused_stack_to_os): New routine, run when marking stacks.
This commit is contained in:
Andy Wingo 2014-01-31 21:41:36 +01:00
parent 7161ec1133
commit 7dba1c2ff1
3 changed files with 63 additions and 11 deletions

View file

@ -196,6 +196,8 @@
do { \
vp->sp = LOCAL_ADDRESS (n - 1); \
CHECK_OVERFLOW (); \
if (vp->sp > vp->sp_max_since_gc) \
vp->sp_max_since_gc = vp->sp; \
} while (0)
/* Reset the current frame to hold N locals. Used when we know that no
@ -203,6 +205,8 @@
#define RESET_FRAME(n) \
do { \
vp->sp = LOCAL_ADDRESS (n - 1); \
if (vp->sp > vp->sp_max_since_gc) \
vp->sp_max_since_gc = vp->sp; \
} while (0)
/* Compute the number of locals in the frame. At a call, this is equal