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

ruby-changes:27865

From: nagachika <ko1@a...>
Date: Mon, 25 Mar 2013 01:58:25 +0900 (JST)
Subject: [ruby-changes:27865] nagachika:r39917 (ruby_2_0_0): merge revision(s) 39625,39626: [Backport #8008]

nagachika	2013-03-25 01:57:26 +0900 (Mon, 25 Mar 2013)

  New Revision: 39917

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

  Log:
    merge revision(s) 39625,39626: [Backport #8008]
    
    compile.c: calc in int
    
    * compile.c (iseq_compile_each): calculate argc as int, not as Fixnum.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/compile.c
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/compile.c
===================================================================
--- ruby_2_0_0/compile.c	(revision 39916)
+++ ruby_2_0_0/compile.c	(revision 39917)
@@ -3154,6 +3154,7 @@ static int https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3154
 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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3164
 	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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3194
 	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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3207
 
 	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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3240
 
 	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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3289
 		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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3328
 	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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3382
 
 	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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3420
 				     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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3459
       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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3468
 
 	    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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3498
 	    /* 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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3561
 	    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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3611
 	    }
 	    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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3628
 	    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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3646
 	    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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3678
 		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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3693
       }
       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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3710
 	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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3743
 	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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3772
 		}
 	    }
 	    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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3795
 					 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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3815
 	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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3835
 
       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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3867
 	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_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L3880
 	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, lin (... truncated)

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

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