diff options
| author | Kouichi Nakanishi <[email protected]> | 2017-04-08 02:13:34 +0900 |
|---|---|---|
| committer | Kouichi Nakanishi <[email protected]> | 2017-04-08 11:22:41 +0900 |
| commit | 15b55c32e9bd1e4917408d6fdc1de4e04862500d (patch) | |
| tree | c0582e7d48630f80b6c4d488131bd69f18bb1a61 /src/vm.c | |
| parent | 7e285107255877f92db2df84d104afef54030ea8 (diff) | |
| download | mruby-15b55c32e9bd1e4917408d6fdc1de4e04862500d.tar.gz mruby-15b55c32e9bd1e4917408d6fdc1de4e04862500d.zip | |
Attach a name to embbeded value of rescue/ensure stack size
Diffstat (limited to 'src/vm.c')
| -rw-r--r-- | src/vm.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -35,6 +35,14 @@ void abort(void); #define STACK_INIT_SIZE 128 #define CALLINFO_INIT_SIZE 32 +#ifndef ENSURE_STACK_INIT_SIZE +#define ENSURE_STACK_INIT_SIZE 16 +#endif + +#ifndef RESCUE_STACK_INIT_SIZE +#define RESCUE_STACK_INIT_SIZE 16 +#endif + /* Define amount of linear stack growth. */ #ifndef MRB_STACK_GROWTH #define MRB_STACK_GROWTH 128 @@ -1074,7 +1082,7 @@ RETRY_TRY_BLOCK: CASE(OP_ONERR) { /* sBx pc+=sBx on exception */ if (mrb->c->rsize <= mrb->c->ci->ridx) { - if (mrb->c->rsize == 0) mrb->c->rsize = 16; + if (mrb->c->rsize == 0) mrb->c->rsize = RESCUE_STACK_INIT_SIZE; else mrb->c->rsize *= 2; mrb->c->rescue = (mrb_code **)mrb_realloc(mrb, mrb->c->rescue, sizeof(mrb_code*) * mrb->c->rsize); } @@ -1140,7 +1148,7 @@ RETRY_TRY_BLOCK: p = mrb_closure_new(mrb, irep->reps[GETARG_Bx(i)]); /* push ensure_stack */ if (mrb->c->esize <= mrb->c->ci->eidx+1) { - if (mrb->c->esize == 0) mrb->c->esize = 16; + if (mrb->c->esize == 0) mrb->c->esize = ENSURE_STACK_INIT_SIZE; else mrb->c->esize *= 2; mrb->c->ensure = (struct RProc **)mrb_realloc(mrb, mrb->c->ensure, sizeof(struct RProc*) * mrb->c->esize); } |
