summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-16 11:03:37 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-16 11:03:37 +0000
commitec3a906bb63581adb3d1dab95fac645c9c8a053d (patch)
treedfb629ba03d6d0246120b0613ca8f94a455a6903
parent22c8cc44a27cceebc48418b2b05e0a6e1638994b (diff)
downloadbundler-ec3a906bb63581adb3d1dab95fac645c9c8a053d.tar.gz
Refactoring out the direct accesses of NODE's u1, u2, and u3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--compile.c14
-rw-r--r--node.c11
-rw-r--r--node.h8
-rw-r--r--vm.c2
4 files changed, 19 insertions, 16 deletions
diff --git a/compile.c b/compile.c
index 691271abe9..dcbfee2c17 100644
--- a/compile.c
+++ b/compile.c
@@ -6675,8 +6675,8 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
case NODE_ALIAS:{
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
- CHECK(COMPILE(ret, "alias arg1", node->u1.node));
- CHECK(COMPILE(ret, "alias arg2", node->u2.node));
+ CHECK(COMPILE(ret, "alias arg1", node->nd_1st));
+ CHECK(COMPILE(ret, "alias arg2", node->nd_2nd));
ADD_SEND(ret, line, id_core_set_method_alias, INT2FIX(3));
if (popped) {
@@ -6686,8 +6686,8 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
}
case NODE_VALIAS:{
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_INSN1(ret, line, putobject, ID2SYM(node->nd_alias));
+ ADD_INSN1(ret, line, putobject, ID2SYM(node->nd_orig));
ADD_SEND(ret, line, id_core_set_variable_alias, INT2FIX(2));
if (popped) {
@@ -6698,7 +6698,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
case NODE_UNDEF:{
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
- CHECK(COMPILE(ret, "undef arg", node->u2.node));
+ CHECK(COMPILE(ret, "undef arg", node->nd_undef));
ADD_SEND(ret, line, id_core_undef_method, INT2FIX(2));
if (popped) {
@@ -7058,8 +7058,8 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
const rb_compile_option_t *orig_opt = ISEQ_COMPILE_DATA(iseq)->option;
VALUE orig_cov = ISEQ_COVERAGE(iseq);
rb_compile_option_t new_opt = *orig_opt;
- if (node->nd_orig) {
- rb_iseq_make_compile_option(&new_opt, node->nd_orig);
+ if (node->nd_compile_option) {
+ rb_iseq_make_compile_option(&new_opt, node->nd_compile_option);
ISEQ_COMPILE_DATA(iseq)->option = &new_opt;
}
if (!new_opt.coverage_enabled) ISEQ_COVERAGE_SET(iseq, Qfalse);
diff --git a/node.c b/node.c
index 88574aa6fb..a5e0f4c7b7 100644
--- a/node.c
+++ b/node.c
@@ -802,17 +802,17 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("method alias statement");
ANN("format: alias [u1.node] [u2.node]");
ANN("example: alias bar foo");
- F_NODE(u1.node, "new name");
+ F_NODE(nd_1st, "new name");
LAST_NODE;
- F_NODE(u2.node, "old name");
+ F_NODE(nd_2nd, "old name");
return;
case NODE_VALIAS:
ANN("global variable alias statement");
ANN("format: alias [u1.id](gvar) [u2.id](gvar)");
ANN("example: alias $y $x");
- F_ID(u1.id, "new name");
- F_ID(u2.id, "old name");
+ F_ID(nd_alias, "new name");
+ F_ID(nd_orig, "old name");
return;
case NODE_UNDEF:
@@ -820,7 +820,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("format: undef [u2.node]");
ANN("example: undef foo");
LAST_NODE;
- F_NODE(u2.node, "old name");
+ F_NODE(nd_undef, "old name");
return;
case NODE_CLASS:
@@ -951,7 +951,6 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("pre-execution");
ANN("format: BEGIN { [nd_head] }; [nd_body]");
ANN("example: bar; BEGIN { foo }");
-#define nd_compile_option u3.value
F_NODE(nd_head, "prelude");
if (!node->nd_compile_option) LAST_NODE;
F_NODE(nd_body, "body");
diff --git a/node.h b/node.h
index a31e3b874c..296ab4161d 100644
--- a/node.h
+++ b/node.h
@@ -299,8 +299,6 @@ typedef struct RNode {
#define nd_body u2.node
#define nd_else u3.node
-#define nd_orig u3.value
-
#define nd_resq u2.node
#define nd_ensr u3.node
@@ -361,6 +359,12 @@ typedef struct RNode {
#define nd_visi_ u2.argc
+#define nd_alias u1.id
+#define nd_orig u2.id
+#define nd_undef u2.node
+
+#define nd_compile_option u3.value
+
#define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
#define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d))
diff --git a/vm.c b/vm.c
index 84d141011c..1965851519 100644
--- a/vm.c
+++ b/vm.c
@@ -950,7 +950,7 @@ rb_binding_add_dynavars(VALUE bindval, rb_binding_t *bind, int dyncount, const I
VALUE tempstr = rb_fstring_cstr("<temp>");
iseq = rb_iseq_new_top(node, tempstr, tempstr, tempstr, NULL);
}
- node->u1.tbl = 0; /* reset table */
+ node->nd_tbl = 0; /* reset table */
ALLOCV_END(idtmp);
vm_set_eval_stack(ec, iseq, 0, base_block);