summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristopher Aue <[email protected]>2017-08-12 23:27:17 +0200
committerChristopher Aue <[email protected]>2017-08-12 23:27:17 +0200
commit198df6103924149d74f9668b5bb63c2e8e9e79ab (patch)
tree604519ddd9d4779474c0c4dd220db7b0176f5488
parentf2d46409983676383d8562fa79012ac855ff7210 (diff)
downloadmruby-198df6103924149d74f9668b5bb63c2e8e9e79ab.tar.gz
mruby-198df6103924149d74f9668b5bb63c2e8e9e79ab.zip
Removed unneeded ci->nregs checks in OP_SEND and OP_SUPER
Because of #3504 `ci->nregs = bidx+1` was introduced in b64f08784cc50861dec80c26fce715982c02c9e9. This led to the follow up error #3551 whose fix introduced the `if (bidx >= ci->nregs)` check in 071164b7999d0932fd60fb3c580a6c374ab1cf4f and the `stack_extend(mrb, ci->nregs)` in 93d802987e722444d0520a8d3f28002841c4f825. Then, the code causing #3504 reappeared again in #3590. The fix for it moved the code dealing with the block in OP_SUPER from below the `cipush` to above the `cipush` in d9fb8b69b0621e8cd2c7c43fd8511a83718d7e45. The `if (bidx >= ci->nregs) { ... }` from then on works with the original callinfo and not the pushed one. `ci->nregs` needed to be modified for the pushed one because it is initialized to 0. But for the original ci it is propertly set and a check is not needed.
-rw-r--r--src/vm.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/src/vm.c b/src/vm.c
index e0bc7b13d..90fa6b3b7 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1339,20 +1339,12 @@ RETRY_TRY_BLOCK:
recv = regs[a];
if (GET_OPCODE(i) != OP_SENDB) {
- if (bidx >= ci->nregs) {
- ci->nregs = bidx+1;
- stack_extend(mrb, ci->nregs);
- }
SET_NIL_VALUE(regs[bidx]);
blk = regs[bidx];
}
else {
blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
- if (bidx >= ci->nregs) {
- ci->nregs = bidx+1;
- stack_extend(mrb, ci->nregs);
- }
blk = regs[bidx] = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
}
}
@@ -1536,10 +1528,6 @@ RETRY_TRY_BLOCK:
recv = regs[0];
blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
- if (bidx >= ci->nregs) {
- ci->nregs = bidx+1;
- stack_extend(mrb, ci->nregs);
- }
blk = regs[bidx] = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
}
c = ci->target_class->super;