summaryrefslogtreecommitdiffstats
path: root/unwind.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-10-26 06:16:32 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-10-26 06:16:32 -0700
commit2bd797a1aa9d30f15ae06fe5da8555906e9af894 (patch)
tree0b0a15ff3b3c1db2431b10824c770f77ab8e2da7 /unwind.c
parent596f3633c74f5dbd90768355e389ffadfbf2e89f (diff)
downloadtxr-2bd797a1aa9d30f15ae06fe5da8555906e9af894.tar.gz
txr-2bd797a1aa9d30f15ae06fe5da8555906e9af894.tar.bz2
txr-2bd797a1aa9d30f15ae06fe5da8555906e9af894.zip
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.
Diffstat (limited to 'unwind.c')
-rw-r--r--unwind.c4
1 files changed, 3 insertions, 1 deletions
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));