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

ruby-changes:67392

From: Nobuyoshi <ko1@a...>
Date: Tue, 31 Aug 2021 15:32:52 +0900 (JST)
Subject: [ruby-changes:67392] f781e537b5 (master): Remove no longer used variable line_node

https://git.ruby-lang.org/ruby.git/commit/?id=f781e537b5

From f781e537b537fcb02e266d55f636850c7e681299 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 31 Aug 2021 11:41:32 +0900
Subject: Remove no longer used variable line_node

---
 compile.c | 515 +++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 257 insertions(+), 258 deletions(-)

diff --git a/compile.c b/compile.c
index 8120af3..007637e 100644
--- a/compile.c
+++ b/compile.c
@@ -8159,7 +8159,6 @@ static int https://github.com/ruby/ruby/blob/trunk/compile.c#L8159
 iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
 {
     const int line = (int)nd_line(node);
-    const NODE *const line_node = node;
     const enum node_type type = nd_type(node);
     struct rb_iseq_constant_body *const body = iseq->body;
 
@@ -8240,16 +8239,16 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const no https://github.com/ruby/ruby/blob/trunk/compile.c#L8239
 	LABEL *end_label = NEW_LABEL(line);
 	CHECK(COMPILE(ret, "nd_1st", node->nd_1st));
 	if (!popped) {
-	    ADD_INSN(ret, line_node, dup);
+	    ADD_INSN(ret, node, dup);
 	}
 	if (type == NODE_AND) {
-	    ADD_INSNL(ret, line_node, branchunless, end_label);
+	    ADD_INSNL(ret, node, branchunless, end_label);
 	}
 	else {
-	    ADD_INSNL(ret, line_node, branchif, end_label);
+	    ADD_INSNL(ret, node, branchif, end_label);
 	}
 	if (!popped) {
-	    ADD_INSN(ret, line_node, pop);
+	    ADD_INSN(ret, node, pop);
 	}
 	CHECK(COMPILE_(ret, "nd_2nd", node->nd_2nd, popped));
 	ADD_LABEL(ret, end_label);
@@ -8269,9 +8268,9 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const no https://github.com/ruby/ruby/blob/trunk/compile.c#L8268
 	CHECK(COMPILE(ret, "rvalue", node->nd_value));
 
 	if (!popped) {
-	    ADD_INSN(ret, line_node, dup);
+	    ADD_INSN(ret, node, dup);
 	}
-	ADD_SETLOCAL(ret, line_node, idx, get_lvar_level(iseq));
+	ADD_SETLOCAL(ret, node, idx, get_lvar_level(iseq));
 	break;
       }
       case NODE_DASGN:
@@ -8282,7 +8281,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const no https://github.com/ruby/ruby/blob/trunk/compile.c#L8281
 	debugi("dassn id", rb_id2str(id) ? id : '*');
 
 	if (!popped) {
-	    ADD_INSN(ret, line_node, dup);
+	    ADD_INSN(ret, node, dup);
 	}
 
 	idx = get_dyna_var_idx(iseq, id, &lv, &ls);
@@ -8292,24 +8291,24 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const no https://github.com/ruby/ruby/blob/trunk/compile.c#L8291
 			  rb_id2str(id));
 	    goto ng;
 	}
-	ADD_SETLOCAL(ret, line_node, ls - idx, lv);
+	ADD_SETLOCAL(ret, node, ls - idx, lv);
 	break;
       }
       case NODE_GASGN:{
 	CHECK(COMPILE(ret, "lvalue", node->nd_value));
 
 	if (!popped) {
-	    ADD_INSN(ret, line_node, dup);
+	    ADD_INSN(ret, node, dup);
 	}
-	ADD_INSN1(ret, line_node, setglobal, ID2SYM(node->nd_entry));
+	ADD_INSN1(ret, node, setglobal, ID2SYM(node->nd_entry));
 	break;
       }
       case NODE_IASGN:{
 	CHECK(COMPILE(ret, "lvalue", node->nd_value));
 	if (!popped) {
-	    ADD_INSN(ret, line_node, dup);
+	    ADD_INSN(ret, node, dup);
 	}
-	ADD_INSN2(ret, line_node, setinstancevariable,
+	ADD_INSN2(ret, node, setinstancevariable,
 		  ID2SYM(node->nd_vid),
 		  get_ivar_ic_value(iseq,node->nd_vid));
 	break;
@@ -8318,26 +8317,26 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const no https://github.com/ruby/ruby/blob/trunk/compile.c#L8317
         CHECK(COMPILE(ret, "lvalue", node->nd_value));
 
         if (!popped) {
-            ADD_INSN(ret, line_node, dup);
+            ADD_INSN(ret, node, dup);
         }
 
 	if (node->nd_vid) {
-	    ADD_INSN1(ret, line_node, putspecialobject,
+	    ADD_INSN1(ret, node, putspecialobject,
 		      INT2FIX(VM_SPECIAL_OBJECT_CONST_BASE));
-            ADD_INSN1(ret, line_node, setconstant, ID2SYM(node->nd_vid));
+            ADD_INSN1(ret, node, setconstant, ID2SYM(node->nd_vid));
 	}
 	else {
 	    compile_cpath(ret, iseq, node->nd_else);
-            ADD_INSN1(ret, line_node, setconstant, ID2SYM(node->nd_else->nd_mid));
+            ADD_INSN1(ret, node, setconstant, ID2SYM(node->nd_else->nd_mid));
 	}
 	break;
       }
       case NODE_CVASGN:{
 	CHECK(COMPILE(ret, "cvasgn val", node->nd_value));
 	if (!popped) {
-	    ADD_INSN(ret, line_node, dup);
+	    ADD_INSN(ret, node, dup);
 	}
-        ADD_INSN2(ret, line_node, setclassvariable,
+        ADD_INSN2(ret, node, setclassvariable,
                   ID2SYM(node->nd_vid),
                   get_ivar_ic_value(iseq,node->nd_vid));
 	break;
@@ -8373,7 +8372,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const no https://github.com/ruby/ruby/blob/trunk/compile.c#L8372
 	 */
 
 	if (!popped) {
-	    ADD_INSN(ret, line_node, putnil);
+	    ADD_INSN(ret, node, putnil);
 	}
 	asgnflag = COMPILE_RECV(ret, "NODE_OP_ASGN1 recv", node);
         CHECK(asgnflag != -1);
@@ -8388,9 +8387,9 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const no https://github.com/ruby/ruby/blob/trunk/compile.c#L8387
 	    argc = setup_args(iseq, ret, node->nd_args->nd_head, &flag, NULL);
 	    CHECK(!NIL_P(argc));
 	}
-	ADD_INSN1(ret, line_node, dupn, FIXNUM_INC(argc, 1 + boff));
+	ADD_INSN1(ret, node, dupn, FIXNUM_INC(argc, 1 + boff));
         flag |= asgnflag;
-	ADD_SEND_WITH_FLAG(ret, line_node, idAREF, argc, INT2FIX(flag));
+	ADD_SEND_WITH_FLAG(ret, node, idAREF, argc, INT2FIX(flag));
 
 	if (id == idOROP || id == idANDOP) {
 	    /* a[x] ||= y  or  a[x] &&= y
@@ -8404,75 +8403,75 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const no https://github.com/ruby/ruby/blob/trunk/compile.c#L8403
 	    LABEL *label = NEW_LABEL(line);
 	    LABEL *lfin = NEW_LABEL(line);
 
-	    ADD_INSN(ret, line_node, dup);
+	    ADD_INSN(ret, node, dup);
 	    if (id == idOROP) {
-		ADD_INSNL(ret, line_node, branchif, label);
+		ADD_INSNL(ret, node, branchif, label);
 	    }
 	    else { /* idANDOP */
-		ADD_INSNL(ret, line_node, branchunless, label);
+		ADD_INSNL(ret, node, branchunless, label);
 	    }
-	    ADD_INSN(ret, line_node, pop);
+	    ADD_INSN(ret, node, pop);
 
 	    CHECK(COMPILE(ret, "NODE_OP_ASGN1 args->body: ", node->nd_args->nd_body));
 	    if (!popped) {
-		ADD_INSN1(ret, line_node, setn, FIXNUM_INC(argc, 2+boff));
+		ADD_INSN1(ret, node, setn, FIXNUM_INC(argc, 2+boff));
 	    }
 	    if (flag & VM_CALL_ARGS_SPLAT) {
-		ADD_INSN1(ret, line_node, newarray, INT2FIX(1));
+		ADD_INSN1(ret, node, newarray, INT2FIX(1));
 		if (boff > 0) {
-		    ADD_INSN1(ret, line_node, dupn, INT2FIX(3));
-		    ADD_INSN(ret, line_node, swap);
-		    ADD_INSN(ret, line_node, pop);
+		    ADD_INSN1(ret, node, dupn, INT2FIX(3));
+		    ADD_INSN(ret, node, swap);
+		    ADD_INSN(ret, node, pop);
 		}
-		ADD_INSN(ret, line_node, concatarray);
+		ADD_INSN(ret, node, concatarray);
 		if (boff > 0) {
-		    ADD_INSN1(ret, line_node, setn, INT2FIX(3));
-		    ADD_INSN(ret, line_node, pop);
-		    ADD_INSN(ret, line_node, pop);
+		    ADD_INSN1(ret, node, setn, INT2FIX(3));
+		    ADD_INSN(ret, node, pop);
+		    ADD_INSN(ret, node, pop);
 		}
-		ADD_SEND_WITH_FLAG(ret, line_node, idASET, argc, INT2FIX(flag));
+		ADD_SEND_WITH_FLAG(ret, node, idASET, argc, INT2FIX(flag));
 	    }
 	    else {
 		if (boff > 0)
-		    ADD_INSN(ret, line_node, swap);
-		ADD_SEND_WITH_FLAG(ret, line_node, idASET, FIXNUM_INC(argc, 1), INT2FIX(flag));
+		    ADD_INSN(ret, node, swap);
+		ADD_SEND_WITH_FLAG(ret, node, idASET, FIXNUM_INC(argc, 1), INT2FIX(flag));
 	    }
-	    ADD_INSN(ret, line_node, pop);
-	    ADD_INSNL(ret, line_node, jump, lfin);
+	    ADD_INSN(ret, node, pop);
+	    ADD_INSNL(ret, node, jump, lfin);
 	    ADD_LABEL(ret, label);
 	    if (!popped) {
-		ADD_INSN1(ret, line_node, setn, FIXNUM_INC(argc, 2+boff));
+		ADD_INSN1(ret, node, setn, FIXNUM_INC(argc, 2+boff));
 	    }
-	    ADD_INSN1(ret, line_node, adjuststack, FIXNUM_INC(argc, 2+boff));
+	    ADD_INSN1(ret, node, adjuststack, FIXNUM_INC(argc, 2+boff));
 	    ADD_LABEL(ret, lfin);
 	}
 	else {
 	    CHECK(COMPILE(ret, "NODE_OP_ASGN1 args->body: ", node->nd_args->nd_body));
-	    ADD_SEND(ret, line_node, id, INT2FIX(1));
+	    ADD_SEND(ret, node, id, INT2FIX(1));
 	    if (!popped) {
-		ADD_INSN1(ret, line_node, setn, FIXNUM_INC(argc, 2+boff));
+		ADD_INSN1(ret, node, setn, FIXNUM_INC(argc, 2+boff));
 	    }
 	    if (flag & VM_CALL_ARGS_SPLAT) {
-		ADD_INSN1(ret, line_node, newarray, INT2FIX(1));
+		ADD_INSN1(ret, node, newarray, INT2FIX(1));
 		if (boff > 0) {
-		    ADD_INSN1(ret, line_node, dupn, INT2FIX(3));
-		    ADD_INSN(ret, line_node, swap);
-		    ADD_INSN(ret, line_node, pop);
+		    ADD_INSN1(ret, node, dupn, INT2FIX(3));
+		    ADD_INSN(ret, node, swap);
+		    ADD_INSN(ret, node, pop);
 		}
-		ADD_INSN(ret, line_node, concatarray);
+		ADD_INSN(ret, node, concatarray);
 		if (boff > 0) {
-		    ADD_INSN1(ret, line_node, setn, INT2FIX(3));
-		    ADD_INSN(ret, line_node, pop);
-		    ADD_INSN(ret, line_node, pop);
+		    ADD_INSN1(ret, node, setn, INT2FIX(3));
+		    ADD_INSN(ret, node, pop);
+		    ADD_INSN(ret, node, pop);
 		}
-		ADD_SEND_WITH_FLAG(ret, line_node, idASET, argc, INT2FIX(flag));
+		ADD_SEND_WITH_FLAG(ret, node, idASET, argc, INT2FIX(flag));
 	    }
 	    else {
 		if (boff > 0)
-		    ADD_INSN(ret, line_node, swap);
-		ADD_SEND_WITH_FLAG(ret, line_node, idASET, FIXNUM_INC(argc, 1), INT2FIX(flag));
+		    ADD_INSN(ret, node, swap);
+		ADD_SEND_WITH_FLAG(ret, node, idASET, FIXNUM_INC(argc, 1), INT2FIX(flag));
 	    }
-	    ADD_INSN(ret, line_node, pop);
+	    ADD_INSN(ret, node, pop);
 	}
 
 	break;
@@ -8530,52 +8529,52 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const no https://github.com/ruby/ruby/blob/trunk/compile.c#L8529
         CHECK(asgnflag != -1);
 	if (node->nd_next->nd_aid) {
 	    lskip = NEW_LABEL(line);
-	    ADD_INSN(ret, line_node, dup);
-	    ADD_INSNL(ret, lin (... truncated)

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

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