From 2bd797a1aa9d30f15ae06fe5da8555906e9af894 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 26 Oct 2015 06:16:32 -0700 Subject: Capture portion of stack beyond prompting block. Without this we don't properly capture some of the context in some built-in special operator functions like op_for when we capture up to their implicit blocks. * unwind.c (capture_cont): Capture an extra region of the stack above the delimiting block. 32 words seems like a reasonable fudge value. --- unwind.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unwind.c b/unwind.c index 6064ccfd..1da59d19 100644 --- a/unwind.c +++ b/unwind.c @@ -716,8 +716,10 @@ static val capture_cont(val tag, uw_frame_t *block) bug_unless (uw_stack < block); { + const int capture_extra = 16 * sizeof (val); + mem_t *lim = coerce(mem_t *, block + 1) + capture_extra; cnum bloff = coerce(mem_t *, block) - coerce(mem_t *, uw_stack); - cnum size = bloff + sizeof *block; + cnum size = coerce(mem_t *, lim) - coerce(mem_t *, uw_stack); mem_t *stack = chk_malloc(size); uw_frame_t *blcopy = coerce(uw_frame_t *, stack + bloff); struct cont *cont = coerce(struct cont *, chk_malloc(sizeof *cont)); -- cgit v1.2.3