[前][次][番号順一覧][スレッド一覧]

ruby-changes:27574

From: nobu <ko1@a...>
Date: Thu, 7 Mar 2013 14:18:19 +0900 (JST)
Subject: [ruby-changes:27574] nobu:r39626 (trunk): compile.c: nd_line(node)

nobu	2013-03-07 14:17:04 +0900 (Thu, 07 Mar 2013)

  New Revision: 39626

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39626

  Log:
    compile.c: nd_line(node)
    
    * compile.c (iseq_compile_each): keep nd_line(node) in a local
      variable.

  Modified files:
    trunk/compile.c

Index: compile.c
===================================================================
--- compile.c	(revision 39625)
+++ compile.c	(revision 39626)
@@ -3155,6 +3155,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3155
 {
     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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3165
 	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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3196
 	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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3209
 
 	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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3242
 
 	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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3291
 		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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3330
 	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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3384
 
 	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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3422
 				     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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3461
       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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3470
 
 	    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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3500
 	    /* 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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3563
 	    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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3613
 	    }
 	    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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3630
 	    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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3648
 	    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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3680
 		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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3695
       }
       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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3712
 	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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3745
 	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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3774
 		}
 	    }
 	    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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3797
 					 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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3817
 	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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3837
 
       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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3869
 	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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3882
 	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_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3891
 	    rb_bug("NODE_DASGN(_CURR): unknown id (%s)", rb_id2name(node->nd_vid));
 	}
 
-	ADD_INSN2(ret, nd_line(node), set (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]