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

ruby-changes:48365

From: nobu <ko1@a...>
Date: Fri, 27 Oct 2017 21:00:44 +0900 (JST)
Subject: [ruby-changes:48365] nobu:r60479 (trunk): compile.c, iseq.c: consitfied NODE pointers

nobu	2017-10-27 21:00:38 +0900 (Fri, 27 Oct 2017)

  New Revision: 60479

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60479

  Log:
    compile.c, iseq.c: consitfied NODE pointers

  Modified files:
    trunk/compile.c
    trunk/iseq.c
    trunk/iseq.h
    trunk/vm_core.h
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 60478)
+++ vm_core.h	(revision 60479)
@@ -881,10 +881,10 @@ typedef enum { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L881
 RUBY_SYMBOL_EXPORT_BEGIN
 
 /* node -> iseq */
-rb_iseq_t *rb_iseq_new         (NODE *node, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum iseq_type);
-rb_iseq_t *rb_iseq_new_top     (NODE *node, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent);
-rb_iseq_t *rb_iseq_new_main    (NODE *node,             VALUE path, VALUE realpath, const rb_iseq_t *parent);
-rb_iseq_t *rb_iseq_new_with_opt(NODE* node, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno,
+rb_iseq_t *rb_iseq_new         (const NODE *node, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum iseq_type);
+rb_iseq_t *rb_iseq_new_top     (const NODE *node, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent);
+rb_iseq_t *rb_iseq_new_main    (const NODE *node,             VALUE path, VALUE realpath, const rb_iseq_t *parent);
+rb_iseq_t *rb_iseq_new_with_opt(const NODE *node, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno,
 				const rb_iseq_t *parent, enum iseq_type, const rb_compile_option_t*);
 
 /* src -> iseq */
Index: compile.c
===================================================================
--- compile.c	(revision 60478)
+++ compile.c	(revision 60479)
@@ -91,7 +91,7 @@ struct ensure_range { https://github.com/ruby/ruby/blob/trunk/compile.c#L91
 };
 
 struct iseq_compile_data_ensure_node_stack {
-    NODE *ensure_node;
+    const NODE *ensure_node;
     struct iseq_compile_data_ensure_node_stack *prev;
     struct ensure_range *erange;
 };
@@ -146,7 +146,7 @@ struct iseq_compile_data_ensure_node_sta https://github.com/ruby/ruby/blob/trunk/compile.c#L146
 
 #define debug_node_start(node)  ((void) \
   (compile_debug_print_indent(1) && \
-   (ruby_debug_print_node(1, CPDEBUG, "", (NODE *)(node)), gl_node_level)), \
+   (ruby_debug_print_node(1, CPDEBUG, "", (const NODE *)(node)), gl_node_level)), \
    gl_node_level++)
 
 #define debug_node_end()  gl_node_level --
@@ -409,7 +409,7 @@ compile_bug(rb_iseq_t *iseq, int line, c https://github.com/ruby/ruby/blob/trunk/compile.c#L409
 
 #define EXPECT_NODE(prefix, node, ndtype, errval) \
 do { \
-    NODE *error_node = (node); \
+    const NODE *error_node = (node); \
     enum node_type error_type = nd_type(error_node); \
     if (error_type != (ndtype)) { \
 	COMPILE_ERROR(ERROR_ARGS_AT(error_node) \
@@ -428,7 +428,7 @@ do { \ https://github.com/ruby/ruby/blob/trunk/compile.c#L428
 
 #define UNKNOWN_NODE(prefix, node, errval) \
 do { \
-    NODE *error_node = (node); \
+    const NODE *error_node = (node); \
     COMPILE_ERROR(ERROR_ARGS_AT(error_node) prefix ": unknown node (%s)", \
 		  ruby_node_name(nd_type(error_node))); \
     return errval; \
@@ -483,21 +483,21 @@ static INSN *new_insn_body(rb_iseq_t *is https://github.com/ruby/ruby/blob/trunk/compile.c#L483
 static LABEL *new_label_body(rb_iseq_t *iseq, long line);
 static ADJUST *new_adjust_body(rb_iseq_t *iseq, LABEL *label, int line);
 
-static int iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const anchor, NODE *n, int);
+static int iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const anchor, const NODE *n, int);
 static int iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *const anchor);
 static int iseq_optimize(rb_iseq_t *iseq, LINK_ANCHOR *const anchor);
 static int iseq_insns_unification(rb_iseq_t *iseq, LINK_ANCHOR *const anchor);
 
 static int iseq_set_local_table(rb_iseq_t *iseq, const ID *tbl);
 static int iseq_set_exception_local_table(rb_iseq_t *iseq);
-static int iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *const anchor, NODE *node);
+static int iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *const anchor, const NODE *node);
 
 static int iseq_set_sequence_stackcaching(rb_iseq_t *iseq, LINK_ANCHOR *const anchor);
 static int iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor);
 static int iseq_set_exception_table(rb_iseq_t *iseq);
 static int iseq_set_optargs_table(rb_iseq_t *iseq);
 
-static int compile_defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, VALUE needstr);
+static int compile_defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, VALUE needstr);
 
 /*
  * To make Array to LinkedList, use link_anchor
@@ -583,6 +583,14 @@ iseq_add_mark_object_compile_time(const https://github.com/ruby/ruby/blob/trunk/compile.c#L583
     return COMPILE_OK;
 }
 
+static inline VALUE
+freeze_literal(rb_iseq_t *iseq, VALUE lit)
+{
+    lit = rb_fstring(lit);
+    rb_ary_push(ISEQ_COMPILE_DATA(iseq)->mark_ary, lit);
+    return lit;
+}
+
 static int
 validate_label(st_data_t name, st_data_t label, st_data_t arg)
 {
@@ -606,7 +614,7 @@ validate_labels(rb_iseq_t *iseq, st_tabl https://github.com/ruby/ruby/blob/trunk/compile.c#L614
 }
 
 VALUE
-rb_iseq_compile_node(rb_iseq_t *iseq, NODE *node)
+rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node)
 {
     DECL_ANCHOR(ret);
     INIT_ANCHOR(ret);
@@ -1167,7 +1175,7 @@ new_insn_send(rb_iseq_t *iseq, int line_ https://github.com/ruby/ruby/blob/trunk/compile.c#L1175
 }
 
 static rb_iseq_t *
-new_child_iseq(rb_iseq_t *iseq, NODE *node,
+new_child_iseq(rb_iseq_t *iseq, const NODE *node,
 	       VALUE name, const rb_iseq_t *parent, enum iseq_type type, int line_no)
 {
     rb_iseq_t *ret_iseq;
@@ -1392,7 +1400,7 @@ static void https://github.com/ruby/ruby/blob/trunk/compile.c#L1400
 iseq_set_arguments_keywords(rb_iseq_t *iseq, LINK_ANCHOR *const optargs,
 			    const struct rb_args_info *args)
 {
-    NODE *node = args->kw_args;
+    const NODE *node = args->kw_args;
     struct rb_iseq_param_keyword *keyword;
     const VALUE default_values = rb_ary_tmp_new(1);
     const VALUE complex_mark = rb_str_tmp_new(0);
@@ -1403,10 +1411,10 @@ iseq_set_arguments_keywords(rb_iseq_t *i https://github.com/ruby/ruby/blob/trunk/compile.c#L1411
     keyword->bits_start = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_cflag);
 
     while (node) {
-	NODE *val_node = node->nd_body->nd_value;
+	const NODE *val_node = node->nd_body->nd_value;
 	VALUE dv;
 
-	if (val_node == (NODE *)-1) {
+	if (val_node == (const NODE *)-1) {
 	    ++rkw;
 	}
 	else {
@@ -1460,7 +1468,7 @@ iseq_set_arguments_keywords(rb_iseq_t *i https://github.com/ruby/ruby/blob/trunk/compile.c#L1468
 }
 
 static int
-iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *const optargs, NODE *node_args)
+iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *const optargs, const NODE *node_args)
 {
     debugs("iseq_set_arguments: %s\n", node_args ? "" : "0");
 
@@ -1490,7 +1498,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK https://github.com/ruby/ruby/blob/trunk/compile.c#L1498
 	}
 
 	if (args->opt_args) {
-	    NODE *node = args->opt_args;
+	    const NODE *node = args->opt_args;
 	    LABEL *label;
 	    VALUE labels = rb_ary_tmp_new(1);
 	    VALUE *opt_table;
@@ -3087,9 +3095,9 @@ iseq_set_sequence_stackcaching(rb_iseq_t https://github.com/ruby/ruby/blob/trunk/compile.c#L3095
 }
 
 static int
-compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int *cntp)
+compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int *cntp)
 {
-    NODE *list = node->nd_next;
+    const NODE *list = node->nd_next;
     VALUE lit = node->nd_lit;
     LINK_ELEMENT *first_lit = 0;
     int cnt = 0;
@@ -3102,7 +3110,7 @@ compile_dstr_fragments(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/compile.c#L3110
 			  rb_builtin_type_name(TYPE(lit)));
 	    return COMPILE_NG;
 	}
-	lit = node->nd_lit = rb_fstring(lit);
+	lit = freeze_literal(iseq, lit);
 	ADD_INSN1(ret, nd_line(node), putobject, lit);
 	if (RSTRING_LEN(lit) == 0) first_lit = LAST_ELEMENT(ret);
     }
@@ -3110,8 +3118,8 @@ compile_dstr_fragments(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/compile.c#L3118
     while (list) {
 	node = list->nd_head;
 	if (nd_type(node) == NODE_STR) {
-	    node->nd_lit = rb_fstring(node->nd_lit);
-	    ADD_INSN1(ret, nd_line(node), putobject, node->nd_lit);
+	    lit = freeze_literal(iseq, node->nd_lit);
+	    ADD_INSN1(ret, nd_line(node), putobject, lit);
 	    lit = Qnil;
 	}
 	else {
@@ -3130,7 +3138,7 @@ compile_dstr_fragments(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/compile.c#L3138
 }
 
 static int
-compile_dstr(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node)
+compile_dstr(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node)
 {
     int cnt;
     CHECK(compile_dstr_fragments(iseq, ret, node, &cnt));
@@ -3139,7 +3147,7 @@ compile_dstr(rb_iseq_t *iseq, LINK_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L3147
 }
 
 static int
-compile_dregx(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node)
+compile_dregx(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node)
 {
     int cnt;
     CHECK(compile_dstr_fragments(iseq, ret, node, &cnt));
@@ -3148,7 +3156,7 @@ compile_dregx(rb_iseq_t *iseq, LINK_ANCH https://github.com/ruby/ruby/blob/trunk/compile.c#L3156
 }
 
 static int
-compile_flip_flop(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int again,
+compile_flip_flop(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int again,
 		  LABEL *then_label, LABEL *else_label)
 {
     const int line = nd_line(node);
@@ -3181,7 +3189,7 @@ compile_flip_flop(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L3189
 }
 
 static int
-compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *cond,
+compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *cond,
 			 LABEL *then_label, LABEL *else_label)
 {
   again:
@@ -3247,10 +3255,10 @@ compile_array_keyword_arg(rb_iseq_t *ise https://github.com/ruby/ruby/blob/trunk/compile.c#L3255
     if (kw_arg_ptr == NULL) return FALSE;
 
     if (nd_type(root_node) == NODE_HASH && root_node->nd_head && nd_type(root_node->nd_head) == NODE_ARRAY) {
-	NODE *node = root_node->nd_head;
+	const NODE *node = root_node->nd_head;
 
 	while (node) {
-	    NODE *key_node = node->nd_head;
+	    const NODE *key_node = node->nd_head;
 
 	    assert(nd_type(node) == NODE_ARRAY);
 	    if (!key_node) {
@@ -3279,8 +3287,8 @@ compile_array_keyword_arg(rb_iseq_t *ise https://github.com/ruby/ruby/blob/trunk/compile.c#L3287
 	    *kw_arg_ptr = kw_arg;
 
 	    for (i=0; node != NULL; i++, node = node->nd_next->nd_next) {
-		NODE *key_node = node->nd_head;
-		NODE *val_node = node->nd_next->nd_head;
+		const NODE *key_node = node->nd_head;
+		const NODE *val_node = node->nd_next->nd_head;
 		keywords[i] = key_node->nd_lit;
 		COMPILE(ret, "keyword values", val_node);
 	    }
@@ -3298,7 +3306,7 @@ enum compile_array_type_t { https://github.com/ruby/ruby/blob/trunk/compile.c#L3306
 };
 
 static inline int
-static_literal_node_p(NODE *node)
+static_literal_node_p(const NODE *node)
 {
     node = node->nd_head;
     switch (nd_type(node)) {
@@ -3313,7 +3321,7 @@ static_literal_node_p(NODE *node) https://github.com/ruby/ruby/blob/trunk/compile.c#L3321
 }
 
 static inline VALUE
-static_literal_value(NODE *node)
+static_literal_value(const NODE *node)
 {
     node = node->nd_head;
     switch (nd_type(node)) {
@@ -3329,11 +3337,11 @@ static_literal_value(NODE *node) https://github.com/ruby/ruby/blob/trunk/compile.c#L3337
 }
 
 static int
-compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE* node_root,
+compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node_root,
 	      enum compile_array_type_t type, struct rb_call_info_kw_arg **keywords_ptr,
 	      unsigned int *flag, int popped)
 {
-    NODE *node = node_root;
+    const NODE *node = node_root;
     int line = (int)nd_line(node);
     int len = 0;
 
@@ -3351,8 +3359,8 @@ compile_array(rb_iseq_t *iseq, LINK_ANCH https://github.com/ruby/ruby/blob/trunk/compile.c#L3359
 	int first = 1, i;
 
 	while (node) {
-	    NODE *start_node = node, *end_node;
-	    NODE *kw = 0;
+	    const NODE *start_node = node, *end_node;
+	    const NODE *kw = 0;
 	    const int max = 0x100;
 	    DECL_ANCHOR(anchor);
 	    INIT_ANCHOR(anchor);
@@ -3496,7 +3504,7 @@ compile_array(rb_iseq_t *iseq, LINK_ANCH https://github.com/ruby/ruby/blob/trunk/compile.c#L3504
 }
 
 static VALUE
-case_when_optimizable_literal(NODE *node)
+case_when_optimizable_literal(const NODE *node)
 {
     switch (nd_type(node)) {
       case NODE_LIT: {
@@ -3518,17 +3526,17 @@ case_when_optimizable_literal(NODE *node https://github.com/ruby/ruby/blob/trunk/compile.c#L3526
       case NODE_FALSE:
 	return Qfalse;
       case NODE_STR:
-	return node->nd_lit = rb_fstring(node->nd_lit);
+	return rb_fstring(node->nd_lit);
     }
     return Qundef;
 }
 
 static int
-when_vals(rb_iseq_t *iseq, LINK_ANCHOR *const cond_seq, NODE *vals,
+when_vals(rb_iseq_t *iseq, LINK_ANCHOR *const cond_seq, const NODE *vals,
 	  LABEL *l1, int only_special_literals, VALUE literals)
 {
     while (vals) {
-	NODE* val = vals->nd_head;
+	const NODE *val = vals->nd_head;
 	VALUE lit = case_when_optimizable_literal(val);
 
 	if (lit == Qundef) {
@@ -3548,9 +3556,9 @@ when_vals(rb_iseq_t *iseq, LINK_ANCHOR * https://github.com/ruby/ruby/blob/trunk/compile.c#L3556
 	ADD_INSN(cond_seq, nd_line(val), dup); /* dup target */
 
 	if (nd_type(val) == NODE_STR) {
-	    val->nd_lit = rb_fstring(val->nd_lit);
 	    debugp_param("nd_lit", val->nd_lit);
-	    ADD_INSN1(cond_seq, nd_line(val), putobject, val->nd_lit);
+	    lit = freeze_literal(iseq, val->nd_lit);
+	    ADD_INSN1(cond_seq, nd_line(val), putobject, lit);
 	}
 	else {
 	    COMPILE(cond_seq, "when cond", val);
@@ -3564,7 +3572,7 @@ when_vals(rb_iseq_t *iseq, LINK_ANCHOR * https://github.com/ruby/ruby/blob/trunk/compile.c#L3572
 }
 
 static int
-compile_massign_lhs(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node)
+compile_massign_lhs(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node)
 {
     switch (nd_type(node)) {
       case NODE_ATTRASGN: {
@@ -3610,7 +3618,7 @@ compile_massign_lhs(rb_iseq_t *iseq, LIN https://github.com/ruby/ruby/blob/trunk/compile.c#L3618
 }
 
 static int
-compile_massign_opt_lhs(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *lhsn)
+compile_massign_opt_lhs(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *lhsn)
 {
     if (lhsn) {
 	CHECK(compile_massign_opt_lhs(iseq, ret, lhsn->nd_next));
@@ -3621,14 +3629,14 @@ compile_massign_opt_lhs(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/compile.c#L3629
 
 static int
 compile_massign_opt(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
-		    NODE *rhsn, NODE *orig_lhsn)
+		    const NODE *rhsn, const NODE *orig_lhsn)
 {
     VALUE mem[64];
     const int memsize = numberof(mem);
     int memindex = 0;
     int llen = 0, rlen = 0;
     int i;
-    NODE *lhsn = orig_lhsn;
+    const NODE *lhsn = orig_lhsn;
 
 #define MEMORY(v) { \
     int i; \
@@ -3644,7 +3652,7 @@ compile_massign_opt(rb_iseq_t *iseq, LIN https://github.com/ruby/ruby/blob/trunk/compile.c#L3652
     }
 
     while (lhsn) {
-	NODE *ln = lhsn->nd_head;
+	const NODE *ln = lhsn->nd_head;
 	switch (nd_type(ln)) {
 	  case NODE_LASGN:
 	    MEMORY(ln->nd_vid);
@@ -3695,11 +3703,11 @@ adjust_stack(rb_iseq_t *iseq, LINK_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L3703
 }
 
 static int
-compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popped)
+compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int popped)
 {
-    NODE *rhsn = node->nd_value;
-    NODE *splatn = node->nd_args;
-    NODE *lhsn = node->nd_head;
+    const NODE *rhsn = node->nd_value;
+    const NODE *splatn = node->nd_args;
+    const NODE *lhsn = node->nd_head;
     int lhs_splat = (splatn && (VALUE)splatn != (VALUE)-1) ? 1 : 0;
 
     if (!popped || splatn || !compile_massign_opt(iseq, ret, rhsn, lhsn)) {
@@ -3754,8 +3762,8 @@ compile_massign(rb_iseq_t *iseq, LINK_AN https://github.com/ruby/ruby/blob/trunk/compile.c#L3762
 	if (lhs_splat) {
 	    if (nd_type(splatn) == NODE_POSTARG) {
 		/*a, b, *r, p1, p2 */
-		NODE *postn = splatn->nd_2nd;
-		NODE *restn = splatn->nd_1st;
+		const NODE *postn = splatn->nd_2nd;
+		const NODE *restn = splatn->nd_1st;
 		int num = (int)postn->nd_alen;
 		int flag = 0x02 | (((VALUE)restn == (VALUE)-1) ? 0x00 : 0x01);
 
@@ -3780,7 +3788,7 @@ compile_massign(rb_iseq_t *iseq, LINK_AN https://github.com/ruby/ruby/blob/trunk/compile.c#L3788
 }
 
 static int
-compile_const_prefix(rb_iseq_t *iseq, NODE *node,
+compile_const_prefix(rb_iseq_t *iseq, const NODE *node,
 		     LINK_ANCHOR *const pref, LINK_ANCHOR *const body)
 {
     switch (nd_type(node)) {
@@ -3807,7 +3815,7 @@ compile_const_prefix(rb_iseq_t *iseq, NO https://github.com/ruby/ruby/blob/trunk/compile.c#L3815
 }
 
 static int
-compile_cpath(LINK_ANCHOR *const ret, rb_iseq_t *iseq, NODE *cpath)
+compile_cpath(LINK_ANCHOR *const ret, rb_iseq_t *iseq, const NODE *cpath)
 {
     if (nd_type(cpath) == NODE_COLON3) {
 	/* toplevel class ::Foo */
@@ -3830,11 +3838,11 @@ compile_cpath(LINK_ANCHOR *const ret, rb https://github.com/ruby/ruby/blob/trunk/compile.c#L3838
 #define private_recv_p(node) (nd_type((node)->nd_recv) == NODE_SELF)
 static int
 defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
-	     NODE *node, LABEL **lfinish, VALUE needstr);
+	     const NODE *node, LABEL **lfinish, VALUE needstr);
 
 static int
 defined_expr0(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
-	      NODE *node, LABEL **lfinish, VALUE needstr)
+	      const NODE *node, LABEL **lfinish, VALUE needstr)
 {
     enum defined_type expr_type = 0;
     enum node_type type;
@@ -3856,7 +3864,7 @@ defined_expr0(rb_iseq_t *iseq, LINK_ANCH https://github.com/ruby/ruby/blob/trunk/compile.c#L3864
 	break;
 
       case NODE_ARRAY:{
-	NODE *vals = node;
+	const NODE *vals = node;
 
 	do {
 	    defined_expr0(iseq, ret, vals->nd_head, lfinish, Qfalse);
@@ -4008,7 +4016,7 @@ defined_expr0(rb_iseq_t *iseq, LINK_ANCH https://github.com/ruby/ruby/blob/trunk/compile.c#L4016
 
 static int
 defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
-	     NODE *node, LABEL **lfinish, VALUE needstr)
+	     const NODE *node, LABEL **lfinish, VALUE needstr)
 {
     LINK_ELEMENT *lcur = ret->last;
     int done = defined_expr0(iseq, ret, node, lfinish, needstr);
@@ -4034,7 +4042,7 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L4042
 }
 
 static int
-compile_defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, VALUE needstr)
+compile_defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, VALUE needstr)
 {
     const int line = nd_line(node);
     if (!node->nd_head) {
@@ -4084,7 +4092,7 @@ make_name_for_block(const rb_iseq_t *ori https://github.com/ruby/ruby/blob/trunk/compile.c#L4092
 static void
 push_ensure_entry(rb_iseq_t *iseq,
 		  struct iseq_compile_data_ensure_node_stack *enl,
-		  struct ensure_range *er, NODE *node)
+		  struct ensure_range *er, const NODE *node)
 {
     enl->ensure_node = node;
     enl->prev = ISEQ_COMPILE_DATA(iseq)->ensure_node_stack;	/* prev */
@@ -4146,7 +4154,7 @@ add_ensure_iseq(LINK_ANCHOR *const ret, https://github.com/ruby/ruby/blob/trunk/compile.c#L4154
 }
 
 static VALUE
-setup_args(rb_iseq_t *iseq, LINK_ANCHOR *const args, NODE *argn,
+setup_args(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn,
 	   unsigned int *flag, struct rb_call_info_kw_arg **keywords)
 {
     VALUE argc = INT2FIX(0);
@@ -4242,7 +4250,7 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR https://github.com/ruby/ruby/blob/trunk/compile.c#L4250
 }
 
 static VALUE
-build_postexe_iseq(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *body)
+build_postexe_iseq(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *body)
 {
     int line = nd_line(body);
     VALUE argc = INT2FIX(0);
@@ -4255,9 +4263,9 @@ build_postexe_iseq(rb_iseq_t *iseq, LINK https://github.com/ruby/ruby/blob/trunk/compile.c#L4263
 }
 
 static void (... truncated)

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

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