diff options
author | Adrian Thurston <thurston@complang.org> | 2014-01-21 21:23:02 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2014-01-21 21:23:02 -0500 |
commit | 9ea5133db407277e819a097727c676ef77c5c558 (patch) | |
tree | 18bbf163db444fa415b7f2a46824e478a5fabb8e | |
parent | 5536f2ff0d8e0b803fc43eb9ba38c80c70419b0f (diff) | |
download | colm-9ea5133db407277e819a097727c676ef77c5c558.tar.gz |
stack block pop: utilize the full space of the block
-rw-r--r-- | src/program.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/program.c b/src/program.c index fc728344..21f197a2 100644 --- a/src/program.c +++ b/src/program.c @@ -145,16 +145,17 @@ Tree **vm_bs_pop( Program *prg, Tree **sp, int n ) prg->stackBlock = prg->stackBlock->next; prg->reserve = b; - /* Setup the bounds. Need to use offset here? Maybe we can grant more - * space in case any push that follows has fewer requirements. */ - prg->sb_beg = prg->stackBlock->data + prg->stackBlock->offset; + /* Setup the bounds. Note that we restore the full block, which is + * necessary to honour any CONTIGUOUS statements that counted on it + * before a subsequent CONTIGUOUS triggered a new block. */ + prg->sb_beg = prg->stackBlock->data; prg->sb_end = prg->stackBlock->data + prg->stackBlock->len; /* Update the total stack usage. */ prg->sb_total -= prg->stackBlock->len - prg->stackBlock->offset; n -= remaining; - sp = prg->sb_beg; + sp = prg->stackBlock->data + prg->stackBlock->offset; } } |