Directly write `ARGUMENT_NORMALIZE()`
The common parts of `OP_SEND` and `OP_SUPER` have been merged so they no longer need to be independent.
This effectively means revert commit
@@ -1259,38 +1259,6 @@ hash_new_from_regs(mrb_state *mrb, mrb_int argc, mrb_int idx)
return hash;
}
-#define ARGUMENT_NORMALIZE(arg_base, arg_info, insn) do { \
- int n = *(arg_info)&0xf; \
- int nk = (*(arg_info)>>4)&0xf; \
- mrb_int bidx = (arg_base) + mrb_bidx(n,nk); \
- if (nk == CALL_MAXARGS) { \
- mrb_ensure_hash_type(mrb, regs[(arg_base)+(n==CALL_MAXARGS?1:n)+1]); \
- } \
- else if (nk > 0) { /* pack keyword arguments */ \
- mrb_int kidx = (arg_base)+(n==CALL_MAXARGS?1:n)+1; \
- mrb_value kdict = hash_new_from_regs(mrb, nk, kidx); \
- regs[kidx] = kdict; \
- nk = CALL_MAXARGS; \
- *(arg_info) = n | (nk<<4); \
- } \
- \
- mrb_assert(bidx < irep->nregs); \
- mrb_int new_bidx = (arg_base)+mrb_bidx(n, nk); \
- if ((insn) == OP_SEND) { \
- /* clear block argument */ \
- SET_NIL_VALUE(regs[new_bidx]); \
- SET_NIL_VALUE(blk); \
- } \
- else { \
- blk = regs[bidx]; \
- if (!mrb_nil_p(blk) && !mrb_proc_p(blk)) { \
- blk = mrb_type_convert(mrb, blk, MRB_TT_PROC, MRB_SYM(to_proc)); \
- /* The stack might have been reallocated during mrb_type_convert(), see #3622 */ \
- } \
- regs[new_bidx] = blk; \
- } \
-} while (0)
-
static mrb_value
ary_new_from_regs(mrb_state *mrb, mrb_int argc, mrb_int idx)
{
@@ -1724,7 +1692,38 @@ RETRY_TRY_BLOCK:
struct RClass *cls;
mrb_value recv, blk;
- ARGUMENT_NORMALIZE(a, &c, insn);
+ {
+ int n = c&0xf;
+ int nk = (c>>4)&0xf;
+ mrb_int bidx = a + mrb_bidx(n,nk);
+
+ if (nk == CALL_MAXARGS) {
+ mrb_ensure_hash_type(mrb, regs[a+(n==CALL_MAXARGS?1:n)+1]);
+ }
+ else if (nk > 0) { /* pack keyword arguments */
+ mrb_int kidx = a+(n==CALL_MAXARGS?1:n)+1;
+ mrb_value kdict = hash_new_from_regs(mrb, nk, kidx);
+ regs[kidx] = kdict;
+ nk = CALL_MAXARGS;
+ c = n | (nk<<4);
+ }
+
+ mrb_assert(bidx < irep->nregs);
+ mrb_int new_bidx = a+mrb_bidx(n, nk);
+ if (insn == OP_SEND) {
+ /* clear block argument */
+ SET_NIL_VALUE(regs[new_bidx]);
+ SET_NIL_VALUE(blk);
+ }
+ else {
+ blk = regs[bidx];
+ if (!mrb_nil_p(blk) && !mrb_proc_p(blk)) {
+ blk = mrb_type_convert(mrb, blk, MRB_TT_PROC, MRB_SYM(to_proc));
+ /* The stack might have been reallocated during mrb_type_convert(), see #3622 */
+ }
+ regs[new_bidx] = blk;
+ }
+ }
recv = regs[a];
ci = mrb->c->ci;
