From 2a62eda85a6f838499792a8b7bbd1bcec05084a5 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 20 Feb 2014 10:43:40 +0100 Subject: [PATCH] Fix "VM never extends vp->sp ..." commit * libguile/vm.c (vm_expand_stack): Make sure the new SP is visible to vm_error if we throw because of stack overflow. --- libguile/vm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libguile/vm.c b/libguile/vm.c index 10d800f1e..af1531ba9 100644 --- a/libguile/vm.c +++ b/libguile/vm.c @@ -1018,7 +1018,7 @@ vm_expand_stack (struct scm_vm *vp, SCM *new_sp) SCM *fp; if (vp->fp) vp->fp += reloc; - vp->sp_max_since_gc += reloc; + new_sp += reloc; fp = vp->fp; while (fp) { @@ -1031,10 +1031,10 @@ vm_expand_stack (struct scm_vm *vp, SCM *new_sp) fp = next_fp; } } - - new_sp += reloc; } + vp->sp_max_since_gc = vp->sp = new_sp; + if (stack_size >= vp->max_stack_size) { /* Expand the soft limit by 256K entries to give us space to @@ -1055,7 +1055,6 @@ vm_expand_stack (struct scm_vm *vp, SCM *new_sp) } /* Otherwise continue, with the new enlarged stack. */ - vp->sp_max_since_gc = vp->sp = new_sp; } static struct scm_vm *