summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-07 05:17:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-07 05:17:04 +0000
commit8a6898394c7cc04ffed49c92063d3fd2ab901497 (patch)
tree3dc580ceb7e62e757445f657e9beccf2a003c0c8 /compile.c
parentfedf4c2250fd543db2287b96d7b7cfa596749241 (diff)
compile.c: nd_line(node)
* compile.c (iseq_compile_each): keep nd_line(node) in a local variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c811
1 files changed, 407 insertions, 404 deletions
diff --git a/compile.c b/compile.c
index 0c8f048..b58ca12 100644
--- a/compile.c
+++ b/compile.c
@@ -3155,6 +3155,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
{
enum node_type type;
LINK_ELEMENT *saved_last_element = 0;
+ int line;
if (node == 0) {
if (!poped) {
@@ -3164,13 +3165,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);
saved_last_element = ret->last;
}
@@ -3195,9 +3196,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);
@@ -3208,7 +3209,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);
@@ -3241,24 +3242,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) {
@@ -3289,13 +3291,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");
@@ -3327,13 +3330,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) {
@@ -3381,28 +3384,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);
@@ -3419,26 +3422,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,
@@ -3458,8 +3461,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) {
@@ -3467,21 +3470,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;
@@ -3497,23 +3500,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) {
@@ -3560,25 +3563,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) {
@@ -3610,10 +3613,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 {
@@ -3627,12 +3630,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) {
@@ -3645,12 +3648,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 {
@@ -3677,11 +3680,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 {
@@ -3692,11 +3695,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 {
@@ -3709,26 +3712,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 */
@@ -3742,28 +3745,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)",
@@ -3771,18 +3774,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;
}
@@ -3794,10 +3797,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;
@@ -3814,7 +3817,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);
@@ -3834,19 +3837,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);
@@ -3866,9 +3869,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;
}
@@ -3879,7 +3882,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);
@@ -3888,16 +3891,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;
}
@@ -3905,9 +3908,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;
}
@@ -3915,26 +3918,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;
}
@@ -3969,7 +3972,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)) {
@@ -3983,8 +3986,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
@@ -3996,92 +3999,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
@@ -4125,47 +4128,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;
}
@@ -4176,7 +4179,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);
@@ -4191,55 +4194,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) {
@@ -4249,32 +4252,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;
}
@@ -4305,11 +4308,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;
}
}
@@ -4337,8 +4340,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 {
@@ -4351,7 +4354,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);
@@ -4365,7 +4368,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 */
@@ -4390,11 +4393,11 @@ 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;
}
@@ -4422,7 +4425,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
/* 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) {
@@ -4431,7 +4434,7 @@ 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 = i;
@@ -4440,7 +4443,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
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));
+ ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
argc = liseq->arg_rest + 1;
flag |= VM_CALL_ARGS_SPLAT;
}
@@ -4454,17 +4457,17 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
int j;
for (j=0; j<post_len; j++) {
int idx = liseq->local_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; j<post_len; j++) {
int idx = liseq->local_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 = post_len + post_start;
}
@@ -4473,13 +4476,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, 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;
}
@@ -4489,7 +4492,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;
}
@@ -4499,9 +4502,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;
}
@@ -4517,7 +4520,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:
@@ -4525,7 +4528,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;
}
@@ -4542,25 +4545,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);
}
}
}
@@ -4585,10 +4588,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;
}
@@ -4598,7 +4601,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;
}
@@ -4610,22 +4613,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;
@@ -4634,41 +4637,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;
@@ -4683,8 +4686,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:
@@ -4703,30 +4706,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;
}
@@ -4734,7 +4737,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;
}
@@ -4742,28 +4745,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;
}
@@ -4771,10 +4774,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;
}
@@ -4782,83 +4785,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);
@@ -4867,52 +4870,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;
}
@@ -4921,17 +4924,17 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
NEW_CHILD_ISEQVAL(
node->nd_body,
rb_sprintf("<class:%s>", 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;
}
@@ -4939,16 +4942,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("<module:%s>", 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;
}
@@ -4956,24 +4959,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);
@@ -4984,16 +4987,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);
}
}
@@ -5004,38 +5007,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;
}
@@ -5045,19 +5048,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;
@@ -5065,63 +5068,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;
@@ -5134,10 +5137,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);
}
}
}
@@ -5146,12 +5149,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]);
}
@@ -5160,52 +5163,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);
@@ -5214,10 +5217,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;
}
@@ -5233,7 +5236,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);
@@ -5243,36 +5246,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;
}
@@ -5283,13 +5286,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;
}