Commit 3f3568a2 authored by Masaki Muranaka's avatar Masaki Muranaka

Simplify conditional expressions. This is for speed tuning.

parent 632875a6
......@@ -885,8 +885,12 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
ci->mid = mid;
ci->proc = m;
ci->stackidx = mrb->stack - mrb->stbase;
if (n == CALL_MAXARGS) {
ci->argc = -1;
}
else {
ci->argc = n;
if (ci->argc == CALL_MAXARGS) ci->argc = -1;
}
ci->target_class = c;
ci->pc = pc + 1;
ci->acc = a;
......@@ -1023,8 +1027,12 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
ci->mid = mid;
ci->proc = m;
ci->stackidx = mrb->stack - mrb->stbase;
if (n == CALL_MAXARGS) {
ci->argc = -1;
}
else {
ci->argc = n;
if (ci->argc == CALL_MAXARGS) ci->argc = -1;
}
ci->target_class = m->target_class;
ci->pc = pc + 1;
......@@ -1051,7 +1059,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
pool = irep->pool;
syms = irep->syms;
ci->nregs = irep->nregs;
if (ci->argc < 0) {
if (n == CALL_MAXARGS) {
stack_extend(mrb, (irep->nregs < 3) ? 3 : irep->nregs, 3);
}
else {
......@@ -1341,8 +1349,12 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
ci = mrb->ci;
ci->mid = mid;
ci->target_class = m->target_class;
if (n == CALL_MAXARGS) {
ci->argc = -1;
}
else {
ci->argc = n;
if (ci->argc == CALL_MAXARGS) ci->argc = -1;
}
/* move stack */
value_move(mrb->stack, &regs[a], ci->argc+1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment