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:
parent
7161ec1133
commit
7dba1c2ff1
3 changed files with 63 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue