diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-29 18:57:18 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-29 18:57:18 +0900 |
| commit | 077ccaf4a54b66a3c6ea3ffa213eadd35a05c536 (patch) | |
| tree | 766093e806df1c16a185506df472d271b7512651 /src | |
| parent | 7bbda668248d16bbac5010accab29f33ba202454 (diff) | |
| parent | a13775eb227f8cce688d1984af3527cdf5d56be1 (diff) | |
| download | mruby-077ccaf4a54b66a3c6ea3ffa213eadd35a05c536.tar.gz mruby-077ccaf4a54b66a3c6ea3ffa213eadd35a05c536.zip | |
Merge pull request #2158 from kyab/support_doubling_stack
Add doubling stack extend, as fix for #2016
Diffstat (limited to 'src')
| -rw-r--r-- | src/vm.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -140,6 +140,12 @@ stack_extend_alloc(mrb_state *mrb, int room) int size = mrb->c->stend - mrb->c->stbase; int off = mrb->c->stack - mrb->c->stbase; +#ifdef MRB_STACK_EXTEND_DOUBLING + if (room <= size) + size *= 2; + else + size += room; +#else /* Use linear stack growth. It is slightly slower than doubling the stack space, but it saves memory on small devices. */ @@ -147,6 +153,7 @@ stack_extend_alloc(mrb_state *mrb, int room) size += MRB_STACK_GROWTH; else size += room; +#endif mrb->c->stbase = (mrb_value *)mrb_realloc(mrb, mrb->c->stbase, sizeof(mrb_value) * size); mrb->c->stack = mrb->c->stbase + off; |
