From 0d7d3a80dd2e64951297b3122d5055fc1ff40091 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sun, 24 Mar 2013 16:57:26 +0000 Subject: merge revision(s) 39625,39626: [Backport #8008] compile.c: calc in int * compile.c (iseq_compile_each): calculate argc as int, not as Fixnum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 824 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 414 insertions(+), 410 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 1aedf56d7f..14e285420f 100644 --- a/compile.c +++ b/compile.c @@ -3154,6 +3154,7 @@ static int iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) { enum node_type type; + int line; if (node == 0) { if (!poped) { @@ -3163,13 +3164,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) return COMPILE_OK; } - iseq->compile_data->last_line = (int)nd_line(node); + iseq->compile_data->last_line = line = (int)nd_line(node); debug_node_start(node); type = nd_type(node); if (node->flags & NODE_FL_NEWLINE) { - ADD_TRACE(ret, nd_line(node), RUBY_EVENT_LINE); + ADD_TRACE(ret, line, RUBY_EVENT_LINE); } switch (type) { @@ -3193,9 +3194,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) INIT_ANCHOR(cond_seq); INIT_ANCHOR(then_seq); INIT_ANCHOR(else_seq); - then_label = NEW_LABEL(nd_line(node)); - else_label = NEW_LABEL(nd_line(node)); - end_label = NEW_LABEL(nd_line(node)); + then_label = NEW_LABEL(line); + else_label = NEW_LABEL(line); + end_label = NEW_LABEL(line); compile_branch_condition(iseq, cond_seq, node->nd_cond, then_label, else_label); @@ -3206,7 +3207,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) ADD_LABEL(ret, then_label); ADD_SEQ(ret, then_seq); - ADD_INSNL(ret, nd_line(node), jump, end_label); + ADD_INSNL(ret, line, jump, end_label); ADD_LABEL(ret, else_label); ADD_SEQ(ret, else_seq); @@ -3239,24 +3240,25 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) node = node->nd_body; type = nd_type(node); + line = nd_line(node); if (type != NODE_WHEN) { COMPILE_ERROR((ERROR_ARGS "NODE_CASE: unexpected node. must be NODE_WHEN, but %s", ruby_node_name(type))); } - endlabel = NEW_LABEL(nd_line(node)); - elselabel = NEW_LABEL(nd_line(node)); + endlabel = NEW_LABEL(line); + elselabel = NEW_LABEL(line); ADD_SEQ(ret, head); /* case VAL */ while (type == NODE_WHEN) { LABEL *l1; - l1 = NEW_LABEL(nd_line(node)); + l1 = NEW_LABEL(line); ADD_LABEL(body_seq, l1); - ADD_INSN(body_seq, nd_line(node), pop); + ADD_INSN(body_seq, line, pop); COMPILE_(body_seq, "when body", node->nd_body, poped); - ADD_INSNL(body_seq, nd_line(node), jump, endlabel); + ADD_INSNL(body_seq, line, jump, endlabel); vals = node->nd_head; if (vals) { @@ -3287,13 +3289,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) break; } type = nd_type(node); + line = nd_line(node); } /* else */ if (node) { ADD_LABEL(cond_seq, elselabel); - ADD_INSN(cond_seq, nd_line(node), pop); + ADD_INSN(cond_seq, line, pop); COMPILE_(cond_seq, "else", node, poped); - ADD_INSNL(cond_seq, nd_line(node), jump, endlabel); + ADD_INSNL(cond_seq, line, jump, endlabel); } else { debugs("== else (implicit)\n"); @@ -3325,13 +3328,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) DECL_ANCHOR(body_seq); INIT_ANCHOR(body_seq); - endlabel = NEW_LABEL(nd_line(node)); + endlabel = NEW_LABEL(line); while (node && nd_type(node) == NODE_WHEN) { - LABEL *l1 = NEW_LABEL(nd_line(node)); + LABEL *l1 = NEW_LABEL(line = nd_line(node)); ADD_LABEL(body_seq, l1); COMPILE_(body_seq, "when", node->nd_body, poped); - ADD_INSNL(body_seq, nd_line(node), jump, endlabel); + ADD_INSNL(body_seq, line, jump, endlabel); vals = node->nd_head; if (!vals) { @@ -3379,28 +3382,28 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) struct iseq_compile_data_ensure_node_stack enl; - LABEL *next_label = iseq->compile_data->start_label = NEW_LABEL(nd_line(node)); /* next */ - LABEL *redo_label = iseq->compile_data->redo_label = NEW_LABEL(nd_line(node)); /* redo */ - LABEL *break_label = iseq->compile_data->end_label = NEW_LABEL(nd_line(node)); /* break */ - LABEL *end_label = NEW_LABEL(nd_line(node)); + LABEL *next_label = iseq->compile_data->start_label = NEW_LABEL(line); /* next */ + LABEL *redo_label = iseq->compile_data->redo_label = NEW_LABEL(line); /* redo */ + LABEL *break_label = iseq->compile_data->end_label = NEW_LABEL(line); /* break */ + LABEL *end_label = NEW_LABEL(line); - LABEL *next_catch_label = NEW_LABEL(nd_line(node)); + LABEL *next_catch_label = NEW_LABEL(line); LABEL *tmp_label = NULL; iseq->compile_data->loopval_popped = 0; push_ensure_entry(iseq, &enl, 0, 0); if (type == NODE_OPT_N || node->nd_state == 1) { - ADD_INSNL(ret, nd_line(node), jump, next_label); + ADD_INSNL(ret, line, jump, next_label); } else { - tmp_label = NEW_LABEL(nd_line(node)); - ADD_INSNL(ret, nd_line(node), jump, tmp_label); + tmp_label = NEW_LABEL(line); + ADD_INSNL(ret, line, jump, tmp_label); } - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); ADD_LABEL(ret, next_catch_label); - ADD_INSN(ret, nd_line(node), pop); - ADD_INSNL(ret, nd_line(node), jump, next_label); + ADD_INSN(ret, line, pop); + ADD_INSNL(ret, line, jump, next_label); if (tmp_label) ADD_LABEL(ret, tmp_label); ADD_LABEL(ret, redo_label); @@ -3417,26 +3420,26 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) end_label, redo_label); } else { - ADD_CALL_RECEIVER(ret, nd_line(node)); - ADD_CALL(ret, nd_line(node), ID2SYM(idGets), INT2FIX(0)); - ADD_INSNL(ret, nd_line(node), branchif, redo_label); + ADD_CALL_RECEIVER(ret, line); + ADD_CALL(ret, line, ID2SYM(idGets), INT2FIX(0)); + ADD_INSNL(ret, line, branchif, redo_label); /* opt_n */ } ADD_LABEL(ret, end_label); if (node->nd_state == Qundef) { - /* ADD_INSN(ret, nd_line(node), putundef); */ + /* ADD_INSN(ret, line, putundef); */ rb_bug("unsupported: putundef"); } else { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); } ADD_LABEL(ret, break_label); /* break */ if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } ADD_CATCH_ENTRY(CATCH_TYPE_BREAK, redo_label, break_label, @@ -3456,8 +3459,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) case NODE_ITER: case NODE_FOR:{ VALUE prevblock = iseq->compile_data->current_block; - LABEL *retry_label = NEW_LABEL(nd_line(node)); - LABEL *retry_end_l = NEW_LABEL(nd_line(node)); + LABEL *retry_label = NEW_LABEL(line); + LABEL *retry_end_l = NEW_LABEL(line); ADD_LABEL(ret, retry_label); if (nd_type(node) == NODE_FOR) { @@ -3465,21 +3468,21 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) iseq->compile_data->current_block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), - ISEQ_TYPE_BLOCK, nd_line(node)); + ISEQ_TYPE_BLOCK, line); - ADD_SEND_R(ret, nd_line(node), ID2SYM(idEach), INT2FIX(0), + ADD_SEND_R(ret, line, ID2SYM(idEach), INT2FIX(0), iseq->compile_data->current_block, INT2FIX(0)); } else { iseq->compile_data->current_block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), - ISEQ_TYPE_BLOCK, nd_line(node)); + ISEQ_TYPE_BLOCK, line); COMPILE(ret, "iter caller", node->nd_iter); } ADD_LABEL(ret, retry_end_l); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } iseq->compile_data->current_block = prevblock; @@ -3495,23 +3498,23 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) /* while/until */ LABEL *splabel = NEW_LABEL(0); ADD_LABEL(ret, splabel); - ADD_ADJUST(ret, nd_line(node), iseq->compile_data->redo_label); + ADD_ADJUST(ret, line, iseq->compile_data->redo_label); COMPILE_(ret, "break val (while/until)", node->nd_stts, iseq->compile_data->loopval_popped); add_ensure_iseq(ret, iseq, 0); - ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->end_label); + ADD_INSNL(ret, line, jump, iseq->compile_data->end_label); ADD_ADJUST_RESTORE(ret, splabel); if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); } } else if (iseq->type == ISEQ_TYPE_BLOCK) { break_by_insn: /* escape from block */ COMPILE(ret, "break val (block)", node->nd_stts); - ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | 0x02) /* TAG_BREAK */ ); + ADD_INSN1(ret, line, throw, INT2FIX(level | 0x02) /* TAG_BREAK */ ); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } } else if (iseq->type == ISEQ_TYPE_EVAL) { @@ -3558,25 +3561,25 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) ADD_LABEL(ret, splabel); COMPILE(ret, "next val/valid syntax?", node->nd_stts); add_ensure_iseq(ret, iseq, 0); - ADD_ADJUST(ret, nd_line(node), iseq->compile_data->redo_label); - ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->start_label); + ADD_ADJUST(ret, line, iseq->compile_data->redo_label); + ADD_INSNL(ret, line, jump, iseq->compile_data->start_label); ADD_ADJUST_RESTORE(ret, splabel); if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); } } else if (iseq->compile_data->end_label) { LABEL *splabel = NEW_LABEL(0); debugs("next in block\n"); ADD_LABEL(ret, splabel); - ADD_ADJUST(ret, nd_line(node), iseq->compile_data->start_label); + ADD_ADJUST(ret, line, iseq->compile_data->start_label); COMPILE(ret, "next val", node->nd_stts); add_ensure_iseq(ret, iseq, 0); - ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->end_label); + ADD_INSNL(ret, line, jump, iseq->compile_data->end_label); ADD_ADJUST_RESTORE(ret, splabel); if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); } } else if (iseq->type == ISEQ_TYPE_EVAL) { @@ -3608,10 +3611,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } if (ip != 0) { COMPILE(ret, "next val", node->nd_stts); - ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | 0x03) /* TAG_NEXT */ ); + ADD_INSN1(ret, line, throw, INT2FIX(level | 0x03) /* TAG_NEXT */ ); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } } else { @@ -3625,12 +3628,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) LABEL *splabel = NEW_LABEL(0); debugs("redo in while"); ADD_LABEL(ret, splabel); - ADD_ADJUST(ret, nd_line(node), iseq->compile_data->redo_label); + ADD_ADJUST(ret, line, iseq->compile_data->redo_label); add_ensure_iseq(ret, iseq, 0); - ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->redo_label); + ADD_INSNL(ret, line, jump, iseq->compile_data->redo_label); ADD_ADJUST_RESTORE(ret, splabel); if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); } } else if (iseq->type == ISEQ_TYPE_EVAL) { @@ -3643,12 +3646,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) debugs("redo in block"); ADD_LABEL(ret, splabel); add_ensure_iseq(ret, iseq, 0); - ADD_ADJUST(ret, nd_line(node), iseq->compile_data->start_label); - ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->start_label); + ADD_ADJUST(ret, line, iseq->compile_data->start_label); + ADD_INSNL(ret, line, jump, iseq->compile_data->start_label); ADD_ADJUST_RESTORE(ret, splabel); if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); } } else { @@ -3675,11 +3678,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) ip = ip->parent_iseq; } if (ip != 0) { - ADD_INSN(ret, nd_line(node), putnil); - ADD_INSN1(ret, nd_line(node), throw, INT2FIX(level | 0x05) /* TAG_REDO */ ); + ADD_INSN(ret, line, putnil); + ADD_INSN1(ret, line, throw, INT2FIX(level | 0x05) /* TAG_REDO */ ); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } } else { @@ -3690,11 +3693,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } case NODE_RETRY:{ if (iseq->type == ISEQ_TYPE_RESCUE) { - ADD_INSN(ret, nd_line(node), putnil); - ADD_INSN1(ret, nd_line(node), throw, INT2FIX(0x04) /* TAG_RETRY */ ); + ADD_INSN(ret, line, putnil); + ADD_INSN1(ret, line, throw, INT2FIX(0x04) /* TAG_RETRY */ ); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } } else { @@ -3707,26 +3710,26 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) break; } case NODE_RESCUE:{ - LABEL *lstart = NEW_LABEL(nd_line(node)); - LABEL *lend = NEW_LABEL(nd_line(node)); - LABEL *lcont = NEW_LABEL(nd_line(node)); + LABEL *lstart = NEW_LABEL(line); + LABEL *lend = NEW_LABEL(line); + LABEL *lcont = NEW_LABEL(line); VALUE rescue = NEW_CHILD_ISEQVAL( node->nd_resq, rb_str_concat(rb_str_new2("rescue in "), iseq->location.label), - ISEQ_TYPE_RESCUE, nd_line(node)); + ISEQ_TYPE_RESCUE, line); ADD_LABEL(ret, lstart); COMPILE(ret, "rescue head", node->nd_head); ADD_LABEL(ret, lend); if (node->nd_else) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); COMPILE(ret, "rescue else", node->nd_else); } - ADD_INSN(ret, nd_line(node), nop); + ADD_INSN(ret, line, nop); ADD_LABEL(ret, lcont); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } /* register catch entry */ @@ -3740,28 +3743,28 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) LABEL *label_miss, *label_hit; while (resq) { - label_miss = NEW_LABEL(nd_line(node)); - label_hit = NEW_LABEL(nd_line(node)); + label_miss = NEW_LABEL(line); + label_hit = NEW_LABEL(line); narg = resq->nd_args; if (narg) { switch (nd_type(narg)) { case NODE_ARRAY: while (narg) { - ADD_INSN2(ret, nd_line(node), getlocal, INT2FIX(2), INT2FIX(0)); + ADD_INSN2(ret, line, getlocal, INT2FIX(2), INT2FIX(0)); COMPILE(ret, "rescue arg", narg->nd_head); - ADD_INSN1(ret, nd_line(node), checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE)); - ADD_INSNL(ret, nd_line(node), branchif, label_hit); + ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE)); + ADD_INSNL(ret, line, branchif, label_hit); narg = narg->nd_next; } break; case NODE_SPLAT: case NODE_ARGSCAT: case NODE_ARGSPUSH: - ADD_INSN2(ret, nd_line(node), getlocal, INT2FIX(2), INT2FIX(0)); + ADD_INSN2(ret, line, getlocal, INT2FIX(2), INT2FIX(0)); COMPILE(ret, "rescue/cond splat", narg); - ADD_INSN1(ret, nd_line(node), checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE | VM_CHECKMATCH_ARRAY)); - ADD_INSNL(ret, nd_line(node), branchif, label_hit); + ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE | VM_CHECKMATCH_ARRAY)); + ADD_INSNL(ret, line, branchif, label_hit); break; default: rb_bug("NODE_RESBODY: unknown node (%s)", @@ -3769,18 +3772,18 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } } else { - ADD_INSN2(ret, nd_line(node), getlocal, INT2FIX(2), INT2FIX(0)); - ADD_INSN1(ret, nd_line(node), putobject, rb_eStandardError); - ADD_INSN1(ret, nd_line(node), checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE)); - ADD_INSNL(ret, nd_line(node), branchif, label_hit); + ADD_INSN2(ret, line, getlocal, INT2FIX(2), INT2FIX(0)); + ADD_INSN1(ret, line, putobject, rb_eStandardError); + ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE)); + ADD_INSNL(ret, line, branchif, label_hit); } - ADD_INSNL(ret, nd_line(node), jump, label_miss); + ADD_INSNL(ret, line, jump, label_miss); ADD_LABEL(ret, label_hit); COMPILE(ret, "resbody body", resq->nd_body); if (iseq->compile_data->option->tailcall_optimization) { - ADD_INSN(ret, nd_line(node), nop); + ADD_INSN(ret, line, nop); } - ADD_INSN(ret, nd_line(node), leave); + ADD_INSN(ret, line, leave); ADD_LABEL(ret, label_miss); resq = resq->nd_head; } @@ -3792,10 +3795,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) rb_str_concat(rb_str_new2 ("ensure in "), iseq->location.label), - ISEQ_TYPE_ENSURE, nd_line(node)); - LABEL *lstart = NEW_LABEL(nd_line(node)); - LABEL *lend = NEW_LABEL(nd_line(node)); - LABEL *lcont = NEW_LABEL(nd_line(node)); + ISEQ_TYPE_ENSURE, line); + LABEL *lstart = NEW_LABEL(line); + LABEL *lend = NEW_LABEL(line); + LABEL *lcont = NEW_LABEL(line); struct ensure_range er; struct iseq_compile_data_ensure_node_stack enl; struct ensure_range *erange; @@ -3812,7 +3815,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) COMPILE_(ret, "ensure head", node->nd_head, poped); ADD_LABEL(ret, lend); if (ensr->anchor.next == 0) { - ADD_INSN(ret, nd_line(node), nop); + ADD_INSN(ret, line, nop); } else { ADD_SEQ(ret, ensr); @@ -3832,19 +3835,19 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) case NODE_AND: case NODE_OR:{ - LABEL *end_label = NEW_LABEL(nd_line(node)); + LABEL *end_label = NEW_LABEL(line); COMPILE(ret, "nd_1st", node->nd_1st); if (!poped) { - ADD_INSN(ret, nd_line(node), dup); + ADD_INSN(ret, line, dup); } if (type == NODE_AND) { - ADD_INSNL(ret, nd_line(node), branchunless, end_label); + ADD_INSNL(ret, line, branchunless, end_label); } else { - ADD_INSNL(ret, nd_line(node), branchif, end_label); + ADD_INSNL(ret, line, branchif, end_label); } if (!poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } COMPILE_(ret, "nd_2nd", node->nd_2nd, poped); ADD_LABEL(ret, end_label); @@ -3864,9 +3867,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) COMPILE(ret, "rvalue", node->nd_value); if (!poped) { - ADD_INSN(ret, nd_line(node), dup); + ADD_INSN(ret, line, dup); } - ADD_INSN2(ret, nd_line(node), setlocal, INT2FIX(idx), INT2FIX(get_lvar_level(iseq))); + ADD_INSN2(ret, line, setlocal, INT2FIX(idx), INT2FIX(get_lvar_level(iseq))); break; } @@ -3877,7 +3880,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) debugp_param("dassn id", rb_str_new2(rb_id2name(node->nd_vid) ? rb_id2name(node->nd_vid) : "*")); if (!poped) { - ADD_INSN(ret, nd_line(node), dup); + ADD_INSN(ret, line, dup); } idx = get_dyna_var_idx(iseq, node->nd_vid, &lv, &ls); @@ -3886,16 +3889,16 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) rb_bug("NODE_DASGN(_CURR): unknown id (%s)", rb_id2name(node->nd_vid)); } - ADD_INSN2(ret, nd_line(node), setlocal, INT2FIX(ls - idx), INT2FIX(lv)); + ADD_INSN2(ret, line, setlocal, INT2FIX(ls - idx), INT2FIX(lv)); break; } case NODE_GASGN:{ COMPILE(ret, "lvalue", node->nd_value); if (!poped) { - ADD_INSN(ret, nd_line(node), dup); + ADD_INSN(ret, line, dup); } - ADD_INSN1(ret, nd_line(node), setglobal, + ADD_INSN1(ret, line, setglobal, ((VALUE)node->nd_entry | 1)); break; } @@ -3903,9 +3906,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) case NODE_IASGN2:{ COMPILE(ret, "lvalue", node->nd_value); if (!poped) { - ADD_INSN(ret, nd_line(node), dup); + ADD_INSN(ret, line, dup); } - ADD_INSN2(ret, nd_line(node), setinstancevariable, + ADD_INSN2(ret, line, setinstancevariable, ID2SYM(node->nd_vid), INT2FIX(iseq->ic_size++)); break; } @@ -3913,26 +3916,26 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) COMPILE(ret, "lvalue", node->nd_value); if (!poped) { - ADD_INSN(ret, nd_line(node), dup); + ADD_INSN(ret, line, dup); } if (node->nd_vid) { - ADD_INSN1(ret, nd_line(node), putspecialobject, + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CONST_BASE)); - ADD_INSN1(ret, nd_line(node), setconstant, ID2SYM(node->nd_vid)); + ADD_INSN1(ret, line, setconstant, ID2SYM(node->nd_vid)); } else { compile_cpath(ret, iseq, node->nd_else); - ADD_INSN1(ret, nd_line(node), setconstant, ID2SYM(node->nd_else->nd_mid)); + ADD_INSN1(ret, line, setconstant, ID2SYM(node->nd_else->nd_mid)); } break; } case NODE_CVASGN:{ COMPILE(ret, "cvasgn val", node->nd_value); if (!poped) { - ADD_INSN(ret, nd_line(node), dup); + ADD_INSN(ret, line, dup); } - ADD_INSN1(ret, nd_line(node), setclassvariable, + ADD_INSN1(ret, line, setclassvariable, ID2SYM(node->nd_vid)); break; } @@ -3967,7 +3970,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) */ if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); } COMPILE(ret, "NODE_OP_ASGN1 recv", node->nd_recv); switch (nd_type(node->nd_args->nd_head)) { @@ -3981,8 +3984,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) argc = setup_args(iseq, args, node->nd_args->nd_head, &flag); ADD_SEQ(ret, args); } - ADD_INSN1(ret, nd_line(node), dupn, FIXNUM_INC(argc, 1 + boff)); - ADD_SEND_R(ret, nd_line(node), ID2SYM(idAREF), argc, Qfalse, LONG2FIX(flag)); + ADD_INSN1(ret, line, dupn, FIXNUM_INC(argc, 1 + boff)); + ADD_SEND_R(ret, line, ID2SYM(idAREF), argc, Qfalse, LONG2FIX(flag)); if (id == 0 || id == 1) { /* 0: or, 1: and @@ -3994,92 +3997,92 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) nil end */ - LABEL *label = NEW_LABEL(nd_line(node)); - LABEL *lfin = NEW_LABEL(nd_line(node)); + LABEL *label = NEW_LABEL(line); + LABEL *lfin = NEW_LABEL(line); - ADD_INSN(ret, nd_line(node), dup); + ADD_INSN(ret, line, dup); if (id == 0) { /* or */ - ADD_INSNL(ret, nd_line(node), branchif, label); + ADD_INSNL(ret, line, branchif, label); } else { /* and */ - ADD_INSNL(ret, nd_line(node), branchunless, label); + ADD_INSNL(ret, line, branchunless, label); } - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); COMPILE(ret, "NODE_OP_ASGN1 args->body: ", node->nd_args->nd_body); if (!poped) { - ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 2+boff)); + ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2+boff)); } if (flag & VM_CALL_ARGS_SPLAT) { - ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1)); + ADD_INSN1(ret, line, newarray, INT2FIX(1)); if (boff > 0) { - ADD_INSN1(ret, nd_line(node), dupn, INT2FIX(3)); - ADD_INSN(ret, nd_line(node), swap); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN1(ret, line, dupn, INT2FIX(3)); + ADD_INSN(ret, line, swap); + ADD_INSN(ret, line, pop); } - ADD_INSN(ret, nd_line(node), concatarray); + ADD_INSN(ret, line, concatarray); if (boff > 0) { - ADD_INSN1(ret, nd_line(node), setn, INT2FIX(3)); - ADD_INSN(ret, nd_line(node), pop); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN1(ret, line, setn, INT2FIX(3)); + ADD_INSN(ret, line, pop); + ADD_INSN(ret, line, pop); } - ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET), + ADD_SEND_R(ret, line, ID2SYM(idASET), argc, Qfalse, LONG2FIX(flag)); } else { if (boff > 0) - ADD_INSN(ret, nd_line(node), swap); - ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET), + ADD_INSN(ret, line, swap); + ADD_SEND_R(ret, line, ID2SYM(idASET), FIXNUM_INC(argc, 1), Qfalse, LONG2FIX(flag)); } - ADD_INSN(ret, nd_line(node), pop); - ADD_INSNL(ret, nd_line(node), jump, lfin); + ADD_INSN(ret, line, pop); + ADD_INSNL(ret, line, jump, lfin); ADD_LABEL(ret, label); if (!poped) { - ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 2+boff)); + ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2+boff)); } - ADD_INSN1(ret, nd_line(node), adjuststack, FIXNUM_INC(argc, 2+boff)); + ADD_INSN1(ret, line, adjuststack, FIXNUM_INC(argc, 2+boff)); ADD_LABEL(ret, lfin); } else { COMPILE(ret, "NODE_OP_ASGN1 args->body: ", node->nd_args->nd_body); - ADD_SEND(ret, nd_line(node), ID2SYM(id), INT2FIX(1)); + ADD_SEND(ret, line, ID2SYM(id), INT2FIX(1)); if (!poped) { - ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 2+boff)); + ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2+boff)); } if (flag & VM_CALL_ARGS_SPLAT) { - ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1)); + ADD_INSN1(ret, line, newarray, INT2FIX(1)); if (boff > 0) { - ADD_INSN1(ret, nd_line(node), dupn, INT2FIX(3)); - ADD_INSN(ret, nd_line(node), swap); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN1(ret, line, dupn, INT2FIX(3)); + ADD_INSN(ret, line, swap); + ADD_INSN(ret, line, pop); } - ADD_INSN(ret, nd_line(node), concatarray); + ADD_INSN(ret, line, concatarray); if (boff > 0) { - ADD_INSN1(ret, nd_line(node), setn, INT2FIX(3)); - ADD_INSN(ret, nd_line(node), pop); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN1(ret, line, setn, INT2FIX(3)); + ADD_INSN(ret, line, pop); + ADD_INSN(ret, line, pop); } - ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET), + ADD_SEND_R(ret, line, ID2SYM(idASET), argc, Qfalse, LONG2FIX(flag)); } else { if (boff > 0) - ADD_INSN(ret, nd_line(node), swap); - ADD_SEND_R(ret, nd_line(node), ID2SYM(idASET), + ADD_INSN(ret, line, swap); + ADD_SEND_R(ret, line, ID2SYM(idASET), FIXNUM_INC(argc, 1), Qfalse, LONG2FIX(flag)); } - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_OP_ASGN2:{ ID atype = node->nd_next->nd_mid; - LABEL *lfin = NEW_LABEL(nd_line(node)); - LABEL *lcfin = NEW_LABEL(nd_line(node)); + LABEL *lfin = NEW_LABEL(line); + LABEL *lcfin = NEW_LABEL(line); /* class C; attr_accessor :c; end r = C.new @@ -4123,47 +4126,47 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) */ COMPILE(ret, "NODE_OP_ASGN2#recv", node->nd_recv); - ADD_INSN(ret, nd_line(node), dup); - ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next->nd_vid), + ADD_INSN(ret, line, dup); + ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_vid), INT2FIX(0)); if (atype == 0 || atype == 1) { /* 0: OR or 1: AND */ - ADD_INSN(ret, nd_line(node), dup); + ADD_INSN(ret, line, dup); if (atype == 0) { - ADD_INSNL(ret, nd_line(node), branchif, lcfin); + ADD_INSNL(ret, line, branchif, lcfin); } else { - ADD_INSNL(ret, nd_line(node), branchunless, lcfin); + ADD_INSNL(ret, line, branchunless, lcfin); } - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value); - ADD_INSN(ret, nd_line(node), swap); - ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1)); - ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next->nd_aid), + ADD_INSN(ret, line, swap); + ADD_INSN1(ret, line, topn, INT2FIX(1)); + ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_aid), INT2FIX(1)); - ADD_INSNL(ret, nd_line(node), jump, lfin); + ADD_INSNL(ret, line, jump, lfin); ADD_LABEL(ret, lcfin); - ADD_INSN(ret, nd_line(node), swap); + ADD_INSN(ret, line, swap); ADD_LABEL(ret, lfin); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); if (poped) { /* we can apply more optimize */ - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } } else { COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value); - ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next->nd_mid), + ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_mid), INT2FIX(1)); if (!poped) { - ADD_INSN(ret, nd_line(node), swap); - ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1)); + ADD_INSN(ret, line, swap); + ADD_INSN1(ret, line, topn, INT2FIX(1)); } - ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next->nd_aid), + ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_aid), INT2FIX(1)); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -4174,7 +4177,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) switch (nd_type(node->nd_head)) { case NODE_COLON3: - ADD_INSN1(ret, nd_line(node), putobject, rb_cObject); + ADD_INSN1(ret, line, putobject, rb_cObject); break; case NODE_COLON2: COMPILE(ret, "NODE_OP_CDECL/colon2#nd_head", node->nd_head->nd_head); @@ -4189,55 +4192,55 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) mid = node->nd_head->nd_mid; /* cref */ if (node->nd_aid == 0) { - lassign = NEW_LABEL(nd_line(node)); - ADD_INSN(ret, nd_line(node), dup); /* cref cref */ - ADD_INSN3(ret, nd_line(node), defined, INT2FIX(DEFINED_CONST), + lassign = NEW_LABEL(line); + ADD_INSN(ret, line, dup); /* cref cref */ + ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_CONST), ID2SYM(mid), Qfalse); /* cref bool */ - ADD_INSNL(ret, nd_line(node), branchunless, lassign); /* cref */ + ADD_INSNL(ret, line, branchunless, lassign); /* cref */ } - ADD_INSN(ret, nd_line(node), dup); /* cref cref */ - ADD_INSN1(ret, nd_line(node), getconstant, ID2SYM(mid)); /* cref obj */ + ADD_INSN(ret, line, dup); /* cref cref */ + ADD_INSN1(ret, line, getconstant, ID2SYM(mid)); /* cref obj */ if (node->nd_aid == 0 || node->nd_aid == 1) { - lfin = NEW_LABEL(nd_line(node)); - if (!poped) ADD_INSN(ret, nd_line(node), dup); /* cref [obj] obj */ + lfin = NEW_LABEL(line); + if (!poped) ADD_INSN(ret, line, dup); /* cref [obj] obj */ if (node->nd_aid == 0) - ADD_INSNL(ret, nd_line(node), branchif, lfin); + ADD_INSNL(ret, line, branchif, lfin); else - ADD_INSNL(ret, nd_line(node), branchunless, lfin); + ADD_INSNL(ret, line, branchunless, lfin); /* cref [obj] */ - if (!poped) ADD_INSN(ret, nd_line(node), pop); /* cref */ + if (!poped) ADD_INSN(ret, line, pop); /* cref */ if (lassign) ADD_LABEL(ret, lassign); COMPILE(ret, "NODE_OP_CDECL#nd_value", node->nd_value); /* cref value */ if (poped) - ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1)); /* cref value cref */ + ADD_INSN1(ret, line, topn, INT2FIX(1)); /* cref value cref */ else { - ADD_INSN1(ret, nd_line(node), dupn, INT2FIX(2)); /* cref value cref value */ - ADD_INSN(ret, nd_line(node), swap); /* cref value value cref */ + ADD_INSN1(ret, line, dupn, INT2FIX(2)); /* cref value cref value */ + ADD_INSN(ret, line, swap); /* cref value value cref */ } - ADD_INSN1(ret, nd_line(node), setconstant, ID2SYM(mid)); /* cref [value] */ + ADD_INSN1(ret, line, setconstant, ID2SYM(mid)); /* cref [value] */ ADD_LABEL(ret, lfin); /* cref [value] */ - if (!poped) ADD_INSN(ret, nd_line(node), swap); /* [value] cref */ - ADD_INSN(ret, nd_line(node), pop); /* [value] */ + if (!poped) ADD_INSN(ret, line, swap); /* [value] cref */ + ADD_INSN(ret, line, pop); /* [value] */ } else { COMPILE(ret, "NODE_OP_CDECL#nd_value", node->nd_value); /* cref obj value */ - ADD_CALL(ret, nd_line(node), ID2SYM(node->nd_aid), INT2FIX(1)); + ADD_CALL(ret, line, ID2SYM(node->nd_aid), INT2FIX(1)); /* cref value */ - ADD_INSN(ret, nd_line(node), swap); /* value cref */ + ADD_INSN(ret, line, swap); /* value cref */ if (!poped) { - ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1)); /* value cref value */ - ADD_INSN(ret, nd_line(node), swap); /* value value cref */ + ADD_INSN1(ret, line, topn, INT2FIX(1)); /* value cref value */ + ADD_INSN(ret, line, swap); /* value value cref */ } - ADD_INSN1(ret, nd_line(node), setconstant, ID2SYM(mid)); + ADD_INSN1(ret, line, setconstant, ID2SYM(mid)); } break; } case NODE_OP_ASGN_AND: case NODE_OP_ASGN_OR:{ - LABEL *lfin = NEW_LABEL(nd_line(node)); + LABEL *lfin = NEW_LABEL(line); LABEL *lassign; if (nd_type(node) == NODE_OP_ASGN_OR) { @@ -4247,32 +4250,32 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) defined_expr(iseq, ret, node->nd_head, lfinish, Qfalse); lassign = lfinish[1]; if (!lassign) { - lassign = NEW_LABEL(nd_line(node)); + lassign = NEW_LABEL(line); } - ADD_INSNL(ret, nd_line(node), branchunless, lassign); + ADD_INSNL(ret, line, branchunless, lassign); } else { - lassign = NEW_LABEL(nd_line(node)); + lassign = NEW_LABEL(line); } COMPILE(ret, "NODE_OP_ASGN_AND/OR#nd_head", node->nd_head); - ADD_INSN(ret, nd_line(node), dup); + ADD_INSN(ret, line, dup); if (nd_type(node) == NODE_OP_ASGN_AND) { - ADD_INSNL(ret, nd_line(node), branchunless, lfin); + ADD_INSNL(ret, line, branchunless, lfin); } else { - ADD_INSNL(ret, nd_line(node), branchif, lfin); + ADD_INSNL(ret, line, branchif, lfin); } - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); ADD_LABEL(ret, lassign); COMPILE(ret, "NODE_OP_ASGN_AND/OR#nd_value", node->nd_value); ADD_LABEL(ret, lfin); if (poped) { /* we can apply more optimize */ - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -4303,11 +4306,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) CONST_ID(id_answer, "the_answer_to_life_the_universe_and_everything"); if (mid == id_bitblt) { - ADD_INSN(ret, nd_line(node), bitblt); + ADD_INSN(ret, line, bitblt); break; } else if (mid == id_answer) { - ADD_INSN(ret, nd_line(node), answer); + ADD_INSN(ret, line, answer); break; } } @@ -4335,8 +4338,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) label_name = SYM2ID(node->nd_args->nd_head->nd_lit); if (!st_lookup(labels_table, (st_data_t)label_name, &data)) { - label = NEW_LABEL(nd_line(node)); - label->position = nd_line(node); + label = NEW_LABEL(line); + label->position = line; st_insert(labels_table, (st_data_t)label_name, (st_data_t)label); } else { @@ -4349,7 +4352,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) if (mid == goto_id) { - ADD_INSNL(ret, nd_line(node), jump, label); + ADD_INSNL(ret, line, jump, label); } else { ADD_LABEL(ret, label); @@ -4363,7 +4366,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) COMPILE(recv, "recv", node->nd_recv); } else if (type == NODE_FCALL || type == NODE_VCALL) { - ADD_CALL_RECEIVER(recv, nd_line(node)); + ADD_CALL_RECEIVER(recv, line); } /* args */ @@ -4388,25 +4391,26 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) flag |= VM_CALL_FCALL; } - ADD_SEND_R(ret, nd_line(node), ID2SYM(mid), + ADD_SEND_R(ret, line, ID2SYM(mid), argc, parent_block, LONG2FIX(flag)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_SUPER: case NODE_ZSUPER:{ DECL_ANCHOR(args); - VALUE argc; + int argc; VALUE flag = 0; VALUE parent_block = iseq->compile_data->current_block; INIT_ANCHOR(args); iseq->compile_data->current_block = Qfalse; if (nd_type(node) == NODE_SUPER) { - argc = setup_args(iseq, args, node->nd_args, &flag); + VALUE vargc = setup_args(iseq, args, node->nd_args, &flag); + argc = FIX2INT(vargc); } else { /* NODE_ZSUPER */ @@ -4414,12 +4418,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) rb_iseq_t *liseq = iseq->local_iseq; int lvar_level = get_lvar_level(iseq); - argc = INT2FIX(liseq->argc); + argc = liseq->argc; /* normal arguments */ for (i = 0; i < liseq->argc; i++) { int idx = liseq->local_size - i; - ADD_INSN2(args, nd_line(node), getlocal, INT2FIX(idx), INT2FIX(lvar_level)); + ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level)); } if (!liseq->arg_simple) { @@ -4428,17 +4432,17 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) int j; for (j = 0; j < liseq->arg_opts - 1; j++) { int idx = liseq->local_size - (i + j); - ADD_INSN2(args, nd_line(node), getlocal, INT2FIX(idx), INT2FIX(lvar_level)); + ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level)); } i += j; - argc = INT2FIX(i); + argc = i; } if (liseq->arg_rest != -1) { /* rest argument */ int idx = liseq->local_size - liseq->arg_rest; - ADD_INSN2(args, nd_line(node), getlocal, INT2FIX(idx), INT2FIX(lvar_level)); - argc = INT2FIX(liseq->arg_rest + 1); + ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level)); + argc = liseq->arg_rest + 1; flag |= VM_CALL_ARGS_SPLAT; } @@ -4451,19 +4455,19 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) int j; for (j=0; jlocal_size - (post_start + j); - ADD_INSN2(args, nd_line(node), getlocal, INT2FIX(idx), INT2FIX(lvar_level)); + ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level)); } - ADD_INSN1(args, nd_line(node), newarray, INT2FIX(j)); - ADD_INSN (args, nd_line(node), concatarray); + ADD_INSN1(args, line, newarray, INT2FIX(j)); + ADD_INSN (args, line, concatarray); /* argc is setteled at above */ } else { int j; for (j=0; jlocal_size - (post_start + j); - ADD_INSN2(args, nd_line(node), getlocal, INT2FIX(idx), INT2FIX(lvar_level)); + ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level)); } - argc = INT2FIX(post_len + post_start); + argc = post_len + post_start; } } @@ -4486,13 +4490,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } /* dummy receiver */ - ADD_INSN1(ret, nd_line(node), putobject, nd_type(node) == NODE_ZSUPER ? Qfalse : Qtrue); + ADD_INSN1(ret, line, putobject, nd_type(node) == NODE_ZSUPER ? Qfalse : Qtrue); ADD_SEQ(ret, args); - ADD_INSN1(ret, nd_line(node), invokesuper, new_callinfo(iseq, 0, FIX2INT(argc), parent_block, + ADD_INSN1(ret, line, invokesuper, new_callinfo(iseq, 0, argc, parent_block, flag | VM_CALL_SUPER | VM_CALL_FCALL)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -4502,7 +4506,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } case NODE_ZARRAY:{ if (!poped) { - ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(0)); + ADD_INSN1(ret, line, newarray, INT2FIX(0)); } break; } @@ -4512,9 +4516,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) COMPILE(ret, "values item", n->nd_head); n = n->nd_next; } - ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(node->nd_alen)); + ADD_INSN1(ret, line, newarray, INT2FIX(node->nd_alen)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -4530,7 +4534,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) break; case NODE_ZARRAY: - ADD_INSN1(ret, nd_line(node), newhash, INT2FIX(0)); + ADD_INSN1(ret, line, newhash, INT2FIX(0)); break; default: @@ -4538,7 +4542,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -4555,25 +4559,25 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) if (is->type == ISEQ_TYPE_METHOD) { splabel = NEW_LABEL(0); ADD_LABEL(ret, splabel); - ADD_ADJUST(ret, nd_line(node), 0); + ADD_ADJUST(ret, line, 0); } COMPILE(ret, "return nd_stts (return val)", node->nd_stts); if (is->type == ISEQ_TYPE_METHOD) { add_ensure_iseq(ret, iseq, 1); - ADD_TRACE(ret, nd_line(node), RUBY_EVENT_RETURN); - ADD_INSN(ret, nd_line(node), leave); + ADD_TRACE(ret, line, RUBY_EVENT_RETURN); + ADD_INSN(ret, line, leave); ADD_ADJUST_RESTORE(ret, splabel); if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); } } else { - ADD_INSN1(ret, nd_line(node), throw, INT2FIX(0x01) /* TAG_RETURN */ ); + ADD_INSN1(ret, line, throw, INT2FIX(0x01) /* TAG_RETURN */ ); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } } } @@ -4598,10 +4602,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } ADD_SEQ(ret, args); - ADD_INSN1(ret, nd_line(node), invokeblock, new_callinfo(iseq, 0, FIX2INT(argc), 0, flag)); + ADD_INSN1(ret, line, invokeblock, new_callinfo(iseq, 0, FIX2INT(argc), 0, flag)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -4611,7 +4615,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) int idx = iseq->local_iseq->local_size - get_local_var_idx(iseq, id); debugs("id: %s idx: %d\n", rb_id2name(id), idx); - ADD_INSN2(ret, nd_line(node), getlocal, INT2FIX(idx), INT2FIX(get_lvar_level(iseq))); + ADD_INSN2(ret, line, getlocal, INT2FIX(idx), INT2FIX(get_lvar_level(iseq))); } break; } @@ -4623,22 +4627,22 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) if (idx < 0) { rb_bug("unknown dvar (%s)", rb_id2name(node->nd_vid)); } - ADD_INSN2(ret, nd_line(node), getlocal, INT2FIX(ls - idx), INT2FIX(lv)); + ADD_INSN2(ret, line, getlocal, INT2FIX(ls - idx), INT2FIX(lv)); } break; } case NODE_GVAR:{ - ADD_INSN1(ret, nd_line(node), getglobal, + ADD_INSN1(ret, line, getglobal, ((VALUE)node->nd_entry | 1)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_IVAR:{ debugi("nd_vid", node->nd_vid); if (!poped) { - ADD_INSN2(ret, nd_line(node), getinstancevariable, + ADD_INSN2(ret, line, getinstancevariable, ID2SYM(node->nd_vid), INT2FIX(iseq->ic_size++)); } break; @@ -4647,41 +4651,41 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) debugi("nd_vid", node->nd_vid); if (iseq->compile_data->option->inline_const_cache) { - LABEL *lend = NEW_LABEL(nd_line(node)); + LABEL *lend = NEW_LABEL(line); int ic_index = iseq->ic_size++; - ADD_INSN2(ret, nd_line(node), getinlinecache, lend, INT2FIX(ic_index)); - ADD_INSN1(ret, nd_line(node), getconstant, ID2SYM(node->nd_vid)); - ADD_INSN1(ret, nd_line(node), setinlinecache, INT2FIX(ic_index)); + ADD_INSN2(ret, line, getinlinecache, lend, INT2FIX(ic_index)); + ADD_INSN1(ret, line, getconstant, ID2SYM(node->nd_vid)); + ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index)); ADD_LABEL(ret, lend); } else { - ADD_INSN(ret, nd_line(node), putnil); - ADD_INSN1(ret, nd_line(node), getconstant, ID2SYM(node->nd_vid)); + ADD_INSN(ret, line, putnil); + ADD_INSN1(ret, line, getconstant, ID2SYM(node->nd_vid)); } if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_CVAR:{ if (!poped) { - ADD_INSN1(ret, nd_line(node), getclassvariable, + ADD_INSN1(ret, line, getclassvariable, ID2SYM(node->nd_vid)); } break; } case NODE_NTH_REF:{ if (!poped) { - ADD_INSN2(ret, nd_line(node), getspecial, INT2FIX(1) /* '~' */, + ADD_INSN2(ret, line, getspecial, INT2FIX(1) /* '~' */, INT2FIX(node->nd_nth << 1)); } break; } case NODE_BACK_REF:{ if (!poped) { - ADD_INSN2(ret, nd_line(node), getspecial, INT2FIX(1) /* '~' */, + ADD_INSN2(ret, line, getspecial, INT2FIX(1) /* '~' */, INT2FIX(0x01 | (node->nd_nth << 1))); } break; @@ -4696,8 +4700,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) INIT_ANCHOR(val); switch (nd_type(node)) { case NODE_MATCH: - ADD_INSN1(recv, nd_line(node), putobject, node->nd_lit); - ADD_INSN2(val, nd_line(node), getspecial, INT2FIX(0), + ADD_INSN1(recv, line, putobject, node->nd_lit); + ADD_INSN2(val, line, getspecial, INT2FIX(0), INT2FIX(0)); break; case NODE_MATCH2: @@ -4716,30 +4720,30 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) INSN_OF(recv->last) == BIN(putobject) && nd_type(node) == NODE_MATCH2) { ADD_SEQ(ret, val); - ADD_INSN1(ret, nd_line(node), opt_regexpmatch1, + ADD_INSN1(ret, line, opt_regexpmatch1, OPERAND_AT(recv->last, 0)); } else { ADD_SEQ(ret, recv); ADD_SEQ(ret, val); - ADD_INSN(ret, nd_line(node), opt_regexpmatch2); + ADD_INSN(ret, line, opt_regexpmatch2); } } else { ADD_SEQ(ret, recv); ADD_SEQ(ret, val); - ADD_SEND(ret, nd_line(node), ID2SYM(idEqTilde), INT2FIX(1)); + ADD_SEND(ret, line, ID2SYM(idEqTilde), INT2FIX(1)); } if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_LIT:{ debugp_param("lit", node->nd_lit); if (!poped) { - ADD_INSN1(ret, nd_line(node), putobject, node->nd_lit); + ADD_INSN1(ret, line, putobject, node->nd_lit); } break; } @@ -4747,7 +4751,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) debugp_param("nd_lit", node->nd_lit); if (!poped) { OBJ_FREEZE(node->nd_lit); - ADD_INSN1(ret, nd_line(node), putstring, node->nd_lit); + ADD_INSN1(ret, line, putstring, node->nd_lit); } break; } @@ -4755,28 +4759,28 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) compile_dstr(iseq, ret, node); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_XSTR:{ OBJ_FREEZE(node->nd_lit); - ADD_CALL_RECEIVER(ret, nd_line(node)); - ADD_INSN1(ret, nd_line(node), putobject, node->nd_lit); - ADD_CALL(ret, nd_line(node), ID2SYM(idBackquote), INT2FIX(1)); + ADD_CALL_RECEIVER(ret, line); + ADD_INSN1(ret, line, putobject, node->nd_lit); + ADD_CALL(ret, line, ID2SYM(idBackquote), INT2FIX(1)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_DXSTR:{ - ADD_CALL_RECEIVER(ret, nd_line(node)); + ADD_CALL_RECEIVER(ret, line); compile_dstr(iseq, ret, node); - ADD_CALL(ret, nd_line(node), ID2SYM(idBackquote), INT2FIX(1)); + ADD_CALL(ret, line, ID2SYM(idBackquote), INT2FIX(1)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -4784,10 +4788,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) COMPILE(ret, "nd_body", node->nd_body); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } else { - ADD_INSN(ret, nd_line(node), tostring); + ADD_INSN(ret, line, tostring); } break; } @@ -4795,83 +4799,83 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) compile_dregx(iseq, ret, node); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_DREGX_ONCE:{ /* TODO: once? */ - LABEL *lend = NEW_LABEL(nd_line(node)); + LABEL *lend = NEW_LABEL(line); int ic_index = iseq->ic_size++; - ADD_INSN2(ret, nd_line(node), onceinlinecache, lend, INT2FIX(ic_index)); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN2(ret, line, onceinlinecache, lend, INT2FIX(ic_index)); + ADD_INSN(ret, line, pop); compile_dregx(iseq, ret, node); - ADD_INSN1(ret, nd_line(node), setinlinecache, INT2FIX(ic_index)); + ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index)); ADD_LABEL(ret, lend); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_ARGSCAT:{ if (poped) { COMPILE(ret, "argscat head", node->nd_head); - ADD_INSN1(ret, nd_line(node), splatarray, Qfalse); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN1(ret, line, splatarray, Qfalse); + ADD_INSN(ret, line, pop); COMPILE(ret, "argscat body", node->nd_body); - ADD_INSN1(ret, nd_line(node), splatarray, Qfalse); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN1(ret, line, splatarray, Qfalse); + ADD_INSN(ret, line, pop); } else { COMPILE(ret, "argscat head", node->nd_head); COMPILE(ret, "argscat body", node->nd_body); - ADD_INSN(ret, nd_line(node), concatarray); + ADD_INSN(ret, line, concatarray); } break; } case NODE_ARGSPUSH:{ if (poped) { COMPILE(ret, "arsgpush head", node->nd_head); - ADD_INSN1(ret, nd_line(node), splatarray, Qfalse); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN1(ret, line, splatarray, Qfalse); + ADD_INSN(ret, line, pop); COMPILE_(ret, "argspush body", node->nd_body, poped); } else { COMPILE(ret, "arsgpush head", node->nd_head); COMPILE_(ret, "argspush body", node->nd_body, poped); - ADD_INSN1(ret, nd_line(node), newarray, INT2FIX(1)); - ADD_INSN(ret, nd_line(node), concatarray); + ADD_INSN1(ret, line, newarray, INT2FIX(1)); + ADD_INSN(ret, line, concatarray); } break; } case NODE_SPLAT:{ COMPILE(ret, "splat", node->nd_head); - ADD_INSN1(ret, nd_line(node), splatarray, Qtrue); + ADD_INSN1(ret, line, splatarray, Qtrue); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_DEFN:{ VALUE iseqval = NEW_ISEQVAL(node->nd_defn, rb_str_dup(rb_id2str(node->nd_mid)), - ISEQ_TYPE_METHOD, nd_line(node)); + ISEQ_TYPE_METHOD, line); debugp_param("defn/iseq", iseqval); - ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); - ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE)); - ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->nd_mid)); - ADD_INSN1(ret, nd_line(node), putiseq, iseqval); - ADD_SEND (ret, nd_line(node), ID2SYM(id_core_define_method), INT2FIX(3)); + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE)); + ADD_INSN1(ret, line, putobject, ID2SYM(node->nd_mid)); + ADD_INSN1(ret, line, putiseq, iseqval); + ADD_SEND (ret, line, ID2SYM(id_core_define_method), INT2FIX(3)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } debugp_param("defn", iseqval); @@ -4880,52 +4884,52 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) case NODE_DEFS:{ VALUE iseqval = NEW_ISEQVAL(node->nd_defn, rb_str_dup(rb_id2str(node->nd_mid)), - ISEQ_TYPE_METHOD, nd_line(node)); + ISEQ_TYPE_METHOD, line); debugp_param("defs/iseq", iseqval); - ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); COMPILE(ret, "defs: recv", node->nd_recv); - ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->nd_mid)); - ADD_INSN1(ret, nd_line(node), putiseq, iseqval); - ADD_SEND (ret, nd_line(node), ID2SYM(id_core_define_singleton_method), INT2FIX(3)); + ADD_INSN1(ret, line, putobject, ID2SYM(node->nd_mid)); + ADD_INSN1(ret, line, putiseq, iseqval); + ADD_SEND (ret, line, ID2SYM(id_core_define_singleton_method), INT2FIX(3)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_ALIAS:{ - ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); - ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE)); + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE)); COMPILE(ret, "alias arg1", node->u1.node); COMPILE(ret, "alias arg2", node->u2.node); - ADD_SEND(ret, nd_line(node), ID2SYM(id_core_set_method_alias), INT2FIX(3)); + ADD_SEND(ret, line, ID2SYM(id_core_set_method_alias), INT2FIX(3)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_VALIAS:{ - ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); - ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->u1.id)); - ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->u2.id)); - ADD_SEND(ret, nd_line(node), ID2SYM(id_core_set_variable_alias), INT2FIX(2)); + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); + ADD_INSN1(ret, line, putobject, ID2SYM(node->u1.id)); + ADD_INSN1(ret, line, putobject, ID2SYM(node->u2.id)); + ADD_SEND(ret, line, ID2SYM(id_core_set_variable_alias), INT2FIX(2)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_UNDEF:{ - ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); - ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE)); + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE)); COMPILE(ret, "undef arg", node->u2.node); - ADD_SEND(ret, nd_line(node), ID2SYM(id_core_undef_method), INT2FIX(2)); + ADD_SEND(ret, line, ID2SYM(id_core_undef_method), INT2FIX(2)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -4934,17 +4938,17 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) NEW_CHILD_ISEQVAL( node->nd_body, rb_sprintf("", rb_id2name(node->nd_cpath->nd_mid)), - ISEQ_TYPE_CLASS, nd_line(node)); + ISEQ_TYPE_CLASS, line); VALUE noscope = compile_cpath(ret, iseq, node->nd_cpath); int flags = VM_DEFINECLASS_TYPE_CLASS; if (!noscope) flags |= VM_DEFINECLASS_FLAG_SCOPED; if (node->nd_super) flags |= VM_DEFINECLASS_FLAG_HAS_SUPERCLASS; COMPILE(ret, "super", node->nd_super); - ADD_INSN3(ret, nd_line(node), defineclass, + ADD_INSN3(ret, line, defineclass, ID2SYM(node->nd_cpath->nd_mid), iseqval, INT2FIX(flags)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -4952,16 +4956,16 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) VALUE iseqval = NEW_CHILD_ISEQVAL( node->nd_body, rb_sprintf("", rb_id2name(node->nd_cpath->nd_mid)), - ISEQ_TYPE_CLASS, nd_line(node)); + ISEQ_TYPE_CLASS, line); VALUE noscope = compile_cpath(ret, iseq, node->nd_cpath); int flags = VM_DEFINECLASS_TYPE_MODULE; if (!noscope) flags |= VM_DEFINECLASS_FLAG_SCOPED; - ADD_INSN (ret, nd_line(node), putnil); /* dummy */ - ADD_INSN3(ret, nd_line(node), defineclass, + ADD_INSN (ret, line, putnil); /* dummy */ + ADD_INSN3(ret, line, defineclass, ID2SYM(node->nd_cpath->nd_mid), iseqval, INT2FIX(flags)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -4969,24 +4973,24 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) ID singletonclass; VALUE iseqval = NEW_ISEQVAL(node->nd_body, rb_str_new2("singleton class"), - ISEQ_TYPE_CLASS, nd_line(node)); + ISEQ_TYPE_CLASS, line); COMPILE(ret, "sclass#recv", node->nd_recv); - ADD_INSN (ret, nd_line(node), putnil); + ADD_INSN (ret, line, putnil); CONST_ID(singletonclass, "singletonclass"); - ADD_INSN3(ret, nd_line(node), defineclass, + ADD_INSN3(ret, line, defineclass, ID2SYM(singletonclass), iseqval, INT2FIX(VM_DEFINECLASS_TYPE_SINGLETON_CLASS)); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_COLON2:{ if (rb_is_const_id(node->nd_mid)) { /* constant */ - LABEL *lend = NEW_LABEL(nd_line(node)); + LABEL *lend = NEW_LABEL(line); int ic_index = iseq->ic_size++; DECL_ANCHOR(pref); @@ -4997,16 +5001,16 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) compile_colon2(iseq, node, pref, body); if (LIST_SIZE_ZERO(pref)) { if (iseq->compile_data->option->inline_const_cache) { - ADD_INSN2(ret, nd_line(node), getinlinecache, lend, INT2FIX(ic_index)); + ADD_INSN2(ret, line, getinlinecache, lend, INT2FIX(ic_index)); } else { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); } ADD_SEQ(ret, body); if (iseq->compile_data->option->inline_const_cache) { - ADD_INSN1(ret, nd_line(node), setinlinecache, INT2FIX(ic_index)); + ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index)); ADD_LABEL(ret, lend); } } @@ -5017,38 +5021,38 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } else { /* function call */ - ADD_CALL_RECEIVER(ret, nd_line(node)); + ADD_CALL_RECEIVER(ret, line); COMPILE(ret, "colon2#nd_head", node->nd_head); - ADD_CALL(ret, nd_line(node), ID2SYM(node->nd_mid), + ADD_CALL(ret, line, ID2SYM(node->nd_mid), INT2FIX(1)); } if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_COLON3:{ - LABEL *lend = NEW_LABEL(nd_line(node)); + LABEL *lend = NEW_LABEL(line); int ic_index = iseq->ic_size++; debugi("colon3#nd_mid", node->nd_mid); /* add cache insn */ if (iseq->compile_data->option->inline_const_cache) { - ADD_INSN2(ret, nd_line(node), getinlinecache, lend, INT2FIX(ic_index)); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN2(ret, line, getinlinecache, lend, INT2FIX(ic_index)); + ADD_INSN(ret, line, pop); } - ADD_INSN1(ret, nd_line(node), putobject, rb_cObject); - ADD_INSN1(ret, nd_line(node), getconstant, ID2SYM(node->nd_mid)); + ADD_INSN1(ret, line, putobject, rb_cObject); + ADD_INSN1(ret, line, getconstant, ID2SYM(node->nd_mid)); if (iseq->compile_data->option->inline_const_cache) { - ADD_INSN1(ret, nd_line(node), setinlinecache, INT2FIX(ic_index)); + ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index)); ADD_LABEL(ret, lend); } if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -5058,19 +5062,19 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) COMPILE(ret, "min", (NODE *) node->nd_beg); COMPILE(ret, "max", (NODE *) node->nd_end); if (poped) { - ADD_INSN(ret, nd_line(node), pop); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); + ADD_INSN(ret, line, pop); } else { - ADD_INSN1(ret, nd_line(node), newrange, flag); + ADD_INSN1(ret, line, newrange, flag); } break; } case NODE_FLIP2: case NODE_FLIP3:{ - LABEL *lend = NEW_LABEL(nd_line(node)); - LABEL *lfin = NEW_LABEL(nd_line(node)); - LABEL *ltrue = NEW_LABEL(nd_line(node)); + LABEL *lend = NEW_LABEL(line); + LABEL *lfin = NEW_LABEL(line); + LABEL *ltrue = NEW_LABEL(line); rb_iseq_t *local_iseq = iseq->local_iseq; rb_num_t cnt; VALUE key; @@ -5078,63 +5082,63 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) cnt = local_iseq->flip_cnt++ + DEFAULT_SPECIAL_VAR_COUNT; key = INT2FIX(cnt); - ADD_INSN2(ret, nd_line(node), getspecial, key, INT2FIX(0)); - ADD_INSNL(ret, nd_line(node), branchif, lend); + ADD_INSN2(ret, line, getspecial, key, INT2FIX(0)); + ADD_INSNL(ret, line, branchif, lend); /* *flip == 0 */ COMPILE(ret, "flip2 beg", node->nd_beg); - ADD_INSN(ret, nd_line(node), dup); - ADD_INSNL(ret, nd_line(node), branchunless, lfin); + ADD_INSN(ret, line, dup); + ADD_INSNL(ret, line, branchunless, lfin); if (nd_type(node) == NODE_FLIP3) { - ADD_INSN(ret, nd_line(node), dup); - ADD_INSN1(ret, nd_line(node), setspecial, key); - ADD_INSNL(ret, nd_line(node), jump, lfin); + ADD_INSN(ret, line, dup); + ADD_INSN1(ret, line, setspecial, key); + ADD_INSNL(ret, line, jump, lfin); } else { - ADD_INSN1(ret, nd_line(node), setspecial, key); + ADD_INSN1(ret, line, setspecial, key); } /* *flip == 1 */ ADD_LABEL(ret, lend); COMPILE(ret, "flip2 end", node->nd_end); - ADD_INSNL(ret, nd_line(node), branchunless, ltrue); - ADD_INSN1(ret, nd_line(node), putobject, Qfalse); - ADD_INSN1(ret, nd_line(node), setspecial, key); + ADD_INSNL(ret, line, branchunless, ltrue); + ADD_INSN1(ret, line, putobject, Qfalse); + ADD_INSN1(ret, line, setspecial, key); ADD_LABEL(ret, ltrue); - ADD_INSN1(ret, nd_line(node), putobject, Qtrue); + ADD_INSN1(ret, line, putobject, Qtrue); ADD_LABEL(ret, lfin); break; } case NODE_SELF:{ if (!poped) { - ADD_INSN(ret, nd_line(node), putself); + ADD_INSN(ret, line, putself); } break; } case NODE_NIL:{ if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); } break; } case NODE_TRUE:{ if (!poped) { - ADD_INSN1(ret, nd_line(node), putobject, Qtrue); + ADD_INSN1(ret, line, putobject, Qtrue); } break; } case NODE_FALSE:{ if (!poped) { - ADD_INSN1(ret, nd_line(node), putobject, Qfalse); + ADD_INSN1(ret, line, putobject, Qfalse); } break; } case NODE_ERRINFO:{ if (!poped) { if (iseq->type == ISEQ_TYPE_RESCUE) { - ADD_INSN2(ret, nd_line(node), getlocal, INT2FIX(2), INT2FIX(0)); + ADD_INSN2(ret, line, getlocal, INT2FIX(2), INT2FIX(0)); } else { rb_iseq_t *ip = iseq; @@ -5147,10 +5151,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) level++; } if (ip) { - ADD_INSN2(ret, nd_line(node), getlocal, INT2FIX(2), INT2FIX(level)); + ADD_INSN2(ret, line, getlocal, INT2FIX(2), INT2FIX(level)); } else { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); } } } @@ -5159,12 +5163,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) case NODE_DEFINED:{ if (!poped) { LABEL *lfinish[2]; - lfinish[0] = NEW_LABEL(nd_line(node)); + lfinish[0] = NEW_LABEL(line); lfinish[1] = 0; - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); defined_expr(iseq, ret, node->nd_head, lfinish, Qtrue); - ADD_INSN(ret, nd_line(node), swap); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, swap); + ADD_INSN(ret, line, pop); if (lfinish[1]) { ADD_LABEL(ret, lfinish[1]); } @@ -5173,52 +5177,52 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) break; } case NODE_POSTEXE:{ - LABEL *lend = NEW_LABEL(nd_line(node)); - VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, nd_line(node)); + LABEL *lend = NEW_LABEL(line); + VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line); int ic_index = iseq->ic_size++; - ADD_INSN2(ret, nd_line(node), onceinlinecache, lend, INT2FIX(ic_index)); - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN2(ret, line, onceinlinecache, lend, INT2FIX(ic_index)); + ADD_INSN(ret, line, pop); - ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); - ADD_INSN1(ret, nd_line(node), putiseq, block); - ADD_SEND (ret, nd_line(node), ID2SYM(id_core_set_postexe), INT2FIX(1)); + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); + ADD_INSN1(ret, line, putiseq, block); + ADD_SEND (ret, line, ID2SYM(id_core_set_postexe), INT2FIX(1)); - ADD_INSN1(ret, nd_line(node), setinlinecache, INT2FIX(ic_index)); + ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index)); ADD_LABEL(ret, lend); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } case NODE_KW_ARG:{ - LABEL *default_label = NEW_LABEL(nd_line(node)); - LABEL *end_label = NEW_LABEL(nd_line(node)); + LABEL *default_label = NEW_LABEL(line); + LABEL *end_label = NEW_LABEL(line); int idx, lv, ls; ID id = node->nd_body->nd_vid; - ADD_INSN(ret, nd_line(node), dup); - ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(id)); - ADD_SEND(ret, nd_line(node), ID2SYM(rb_intern("key?")), INT2FIX(1)); - ADD_INSNL(ret, nd_line(node), branchunless, default_label); - ADD_INSN(ret, nd_line(node), dup); - ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(id)); - ADD_SEND(ret, nd_line(node), ID2SYM(rb_intern("delete")), INT2FIX(1)); + ADD_INSN(ret, line, dup); + ADD_INSN1(ret, line, putobject, ID2SYM(id)); + ADD_SEND(ret, line, ID2SYM(rb_intern("key?")), INT2FIX(1)); + ADD_INSNL(ret, line, branchunless, default_label); + ADD_INSN(ret, line, dup); + ADD_INSN1(ret, line, putobject, ID2SYM(id)); + ADD_SEND(ret, line, ID2SYM(rb_intern("delete")), INT2FIX(1)); switch (nd_type(node->nd_body)) { case NODE_LASGN: idx = iseq->local_iseq->local_size - get_local_var_idx(iseq, id); - ADD_INSN2(ret, nd_line(node), setlocal, INT2FIX(idx), INT2FIX(get_lvar_level(iseq))); + ADD_INSN2(ret, line, setlocal, INT2FIX(idx), INT2FIX(get_lvar_level(iseq))); break; case NODE_DASGN: case NODE_DASGN_CURR: idx = get_dyna_var_idx(iseq, id, &lv, &ls); - ADD_INSN2(ret, nd_line(node), setlocal, INT2FIX(ls - idx), INT2FIX(lv)); + ADD_INSN2(ret, line, setlocal, INT2FIX(ls - idx), INT2FIX(lv)); break; default: rb_bug("iseq_compile_each (NODE_KW_ARG): unknown node: %s", ruby_node_name(nd_type(node->nd_body))); } - ADD_INSNL(ret, nd_line(node), jump, end_label); + ADD_INSNL(ret, line, jump, end_label); ADD_LABEL(ret, default_label); COMPILE_POPED(ret, "keyword default argument", node->nd_body); ADD_LABEL(ret, end_label); @@ -5227,10 +5231,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) case NODE_DSYM:{ compile_dstr(iseq, ret, node); if (!poped) { - ADD_SEND(ret, nd_line(node), ID2SYM(idIntern), INT2FIX(0)); + ADD_SEND(ret, line, ID2SYM(idIntern), INT2FIX(0)); } else { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } @@ -5246,7 +5250,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) if (node->nd_recv == (NODE *) 1) { flag |= VM_CALL_FCALL; - ADD_INSN(recv, nd_line(node), putself); + ADD_INSN(recv, line, putself); } else { COMPILE(recv, "recv", node->nd_recv); @@ -5256,36 +5260,36 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) debugp_param("nd_mid", ID2SYM(node->nd_mid)); if (!poped) { - ADD_INSN(ret, nd_line(node), putnil); + ADD_INSN(ret, line, putnil); ADD_SEQ(ret, recv); ADD_SEQ(ret, args); if (flag & VM_CALL_ARGS_BLOCKARG) { - ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1)); + ADD_INSN1(ret, line, topn, INT2FIX(1)); if (flag & VM_CALL_ARGS_SPLAT) { - ADD_INSN1(ret, nd_line(node), putobject, INT2FIX(-1)); - ADD_SEND(ret, nd_line(node), ID2SYM(idAREF), INT2FIX(1)); + ADD_INSN1(ret, line, putobject, INT2FIX(-1)); + ADD_SEND(ret, line, ID2SYM(idAREF), INT2FIX(1)); } - ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 3)); - ADD_INSN (ret, nd_line(node), pop); + ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 3)); + ADD_INSN (ret, line, pop); } else if (flag & VM_CALL_ARGS_SPLAT) { - ADD_INSN(ret, nd_line(node), dup); - ADD_INSN1(ret, nd_line(node), putobject, INT2FIX(-1)); - ADD_SEND(ret, nd_line(node), ID2SYM(idAREF), INT2FIX(1)); - ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 2)); - ADD_INSN (ret, nd_line(node), pop); + ADD_INSN(ret, line, dup); + ADD_INSN1(ret, line, putobject, INT2FIX(-1)); + ADD_SEND(ret, line, ID2SYM(idAREF), INT2FIX(1)); + ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2)); + ADD_INSN (ret, line, pop); } else { - ADD_INSN1(ret, nd_line(node), setn, FIXNUM_INC(argc, 1)); + ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 1)); } } else { ADD_SEQ(ret, recv); ADD_SEQ(ret, args); } - ADD_SEND_R(ret, nd_line(node), ID2SYM(node->nd_mid), argc, 0, LONG2FIX(flag)); - ADD_INSN(ret, nd_line(node), pop); + ADD_SEND_R(ret, line, ID2SYM(node->nd_mid), argc, 0, LONG2FIX(flag)); + ADD_INSN(ret, line, pop); break; } @@ -5296,13 +5300,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } case NODE_LAMBDA:{ /* compile same as lambda{...} */ - VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, nd_line(node)); + VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line); VALUE argc = INT2FIX(0); - ADD_INSN1(ret, nd_line(node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); - ADD_CALL_WITH_BLOCK(ret, nd_line(node), ID2SYM(idLambda), argc, block); + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); + ADD_CALL_WITH_BLOCK(ret, line, ID2SYM(idLambda), argc, block); if (poped) { - ADD_INSN(ret, nd_line(node), pop); + ADD_INSN(ret, line, pop); } break; } -- cgit v1.2.3