Skip to content
Permalink
Browse files
Move to_proc conversion from OP_ENTER to OP_SENDB; fix #3227
  • Loading branch information
matz committed Oct 20, 2016
1 parent 8488425 commit 6fd0e601cf8b82e331710e6895dc3122cd7a5082
Showing 1 changed file with 13 additions and 8 deletions.
@@ -1094,14 +1094,22 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
mrb_callinfo *ci;
mrb_value recv, result;
mrb_sym mid = syms[GETARG_B(i)];
int bidx;

recv = regs[a];
if (n == CALL_MAXARGS) {
bidx = a+2;
}
else {
bidx = a+n+1;
}
if (GET_OPCODE(i) != OP_SENDB) {
if (n == CALL_MAXARGS) {
SET_NIL_VALUE(regs[a+2]);
}
else {
SET_NIL_VALUE(regs[a+n+1]);
SET_NIL_VALUE(regs[bidx]);
}
else {
mrb_value blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
regs[bidx] = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
}
}
c = mrb_class(mrb, recv);
@@ -1420,9 +1428,6 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
int len = m1 + o + r + m2;
mrb_value *blk = &argv[argc < 0 ? 1 : argc];

if (!mrb_nil_p(*blk) && mrb_type(*blk) != MRB_TT_PROC) {
*blk = mrb_convert_type(mrb, *blk, MRB_TT_PROC, "Proc", "to_proc");
}
if (argc < 0) {
struct RArray *ary = mrb_ary_ptr(regs[1]);
argv = ary->ptr;

0 comments on commit 6fd0e60

Please sign in to comment.