diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2015-03-21 11:20:44 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2015-03-21 11:20:44 +0900 |
| commit | 4cf9b2fd1cc51bcb968a343c2e873b3777585752 (patch) | |
| tree | f4bc91a84b627374b3da422e1223b2b226b1eda4 | |
| parent | 0e218f53569002f8f5979629ae91f5fb28544251 (diff) | |
| download | mruby-4cf9b2fd1cc51bcb968a343c2e873b3777585752.tar.gz mruby-4cf9b2fd1cc51bcb968a343c2e873b3777585752.zip | |
execute ensure clause only when skipping call frame; fix #2726
| -rw-r--r-- | src/vm.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -1474,12 +1474,7 @@ RETRY_TRY_BLOCK: mrb->jmp = prev_jmp; MRB_THROW(prev_jmp); } - if (ci > mrb->c->cibase) { - while (eidx > ci[-1].eidx) { - ecall(mrb, --eidx); - } - } - else if (ci == mrb->c->cibase) { + if (ci == mrb->c->cibase) { if (ci->ridx == 0) { if (mrb->c == mrb->root_c) { regs = mrb->c->stack = mrb->c->stbase; @@ -1495,6 +1490,12 @@ RETRY_TRY_BLOCK: } break; } + /* call ensure only when we skip this callinfo */ + if (ci[0].ridx == ci[-1].ridx) { + while (eidx > ci[-1].eidx) { + ecall(mrb, --eidx); + } + } } L_RESCUE: if (ci->ridx == 0) goto L_STOP; |
