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

ruby-changes:37813

From: ko1 <ko1@a...>
Date: Mon, 9 Mar 2015 04:50:55 +0900 (JST)
Subject: [ruby-changes:37813] ko1:r49894 (trunk): * internal.h: define CREF accessor macros.

ko1	2015-03-09 04:50:37 +0900 (Mon, 09 Mar 2015)

  New Revision: 49894

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

  Log:
    * internal.h: define CREF accessor macros.
      * CREF_CLASS(cref)
      * CREF_NEXT(cref)
      * CREF_VISI(cref)
      * CREF_VISI_SET(cref, v)
      * CREF_REFINEMENTS(cref)
      * CREF_PUSHED_BY_EVAL(cref)
      * CREF_PUSHED_BY_EVAL_SET(cref)
      * CREF_OMOD_SHARED(cref)
      * CREF_OMOD_SHARED_SET(cref)
      * CREF_OMOD_SHARED_UNSET(cref)
      This is process to change CREF data type from NODE.

  Modified files:
    trunk/ChangeLog
    trunk/eval.c
    trunk/eval_intern.h
    trunk/internal.h
    trunk/node.c
    trunk/node.h
    trunk/proc.c
    trunk/vm.c
    trunk/vm_eval.c
    trunk/vm_insnhelper.c
    trunk/vm_insnhelper.h
    trunk/vm_method.c
Index: eval_intern.h
===================================================================
--- eval_intern.h	(revision 49893)
+++ eval_intern.h	(revision 49894)
@@ -210,9 +210,9 @@ enum ruby_tag_type { https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L210
 #define GET_THROWOBJ_CATCH_POINT(obj) ((rb_control_frame_t*)RNODE((obj))->u2.value)
 #define GET_THROWOBJ_STATE(obj)       ((int)RNODE((obj))->u3.value)
 
-#define SCOPE_TEST(f)  (rb_vm_cref()->nd_visi & (f))
-#define SCOPE_CHECK(f) (rb_vm_cref()->nd_visi == (f))
-#define SCOPE_SET(f)   (rb_vm_cref()->nd_visi = (f))
+#define SCOPE_TEST(f)  (CREF_VISI(rb_vm_cref()) & (f))
+#define SCOPE_CHECK(f) (CREF_VISI(rb_vm_cref()) == (f))
+#define SCOPE_SET(f)   (CREF_VISI_SET(rb_vm_cref(), (f)))
 
 void rb_thread_cleanup(void);
 void rb_thread_wait_other_threads(void);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49893)
+++ ChangeLog	(revision 49894)
@@ -1,3 +1,19 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Mar  9 04:47:58 2015  Koichi Sasada  <ko1@a...>
+
+	* internal.h: define CREF accessor macros.
+	  * CREF_CLASS(cref)
+	  * CREF_NEXT(cref)
+	  * CREF_VISI(cref)
+	  * CREF_VISI_SET(cref, v)
+	  * CREF_REFINEMENTS(cref)
+	  * CREF_PUSHED_BY_EVAL(cref)
+	  * CREF_PUSHED_BY_EVAL_SET(cref)
+	  * CREF_OMOD_SHARED(cref)
+	  * CREF_OMOD_SHARED_SET(cref)
+	  * CREF_OMOD_SHARED_UNSET(cref)
+
+	  This is process to change CREF data type from NODE.
+
 Sun Mar  8 22:50:57 2015  Tanaka Akira  <akr@f...>
 
 	* ext/zlib/zlib.c (rb_gzfile_close): Don't raise on double
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 49893)
+++ vm_eval.c	(revision 49894)
@@ -1567,7 +1567,7 @@ yield_under(VALUE under, VALUE self, VAL https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1567
 	VM_CF_LEP(th->cfp)[0] = VM_ENVVAL_BLOCK_PTR(&block);
     }
     cref = vm_cref_push(th, under, NOEX_PUBLIC, blockptr);
-    cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL;
+    CREF_PUSHED_BY_EVAL_SET(cref);
 
     if (values == Qundef) {
 	return vm_yield_with_cref(th, 1, &self, cref);
@@ -1590,8 +1590,8 @@ rb_yield_refine_block(VALUE refinement, https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1590
 	VM_CF_LEP(th->cfp)[0] = VM_ENVVAL_BLOCK_PTR(&block);
     }
     cref = vm_cref_push(th, refinement, NOEX_PUBLIC, blockptr);
-    cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL;
-    RB_OBJ_WRITE(cref, &cref->nd_refinements, refinements);
+    CREF_PUSHED_BY_EVAL_SET(cref);
+    RB_OBJ_WRITE(cref, &CREF_REFINEMENTS(cref), refinements);
 
     return vm_yield_with_cref(th, 0, NULL, cref);
 }
@@ -1603,7 +1603,7 @@ eval_under(VALUE under, VALUE self, VALU https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1603
     NODE *cref = vm_cref_push(GET_THREAD(), under, NOEX_PUBLIC, NULL);
 
     if (SPECIAL_CONST_P(self) && !NIL_P(under)) {
-	cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL;
+	CREF_PUSHED_BY_EVAL_SET(cref);
     }
     SafeStringValue(src);
 
Index: proc.c
===================================================================
--- proc.c	(revision 49893)
+++ proc.c	(revision 49894)
@@ -1642,7 +1642,7 @@ rb_mod_define_method(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/proc.c#L1642
     const NODE *cref = rb_vm_cref_in_context(mod, mod);
 
     if (cref) {
-	noex = (int)cref->nd_visi;
+	noex = CREF_VISI(cref);
     }
 
     if (argc == 1) {
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 49893)
+++ vm_method.c	(revision 49894)
@@ -479,7 +479,7 @@ rb_add_method0(VALUE klass, ID mid, rb_m https://github.com/ruby/ruby/blob/trunk/vm_method.c#L479
 
 	  private_cref = vm_cref_new_toplevel(GET_THREAD()); /* TODO: CREF should be shared with other methods */
 	  if (cref) COPY_CREF(private_cref, cref);
-	  private_cref->nd_visi = NOEX_PUBLIC;
+	  CREF_VISI_SET(private_cref, NOEX_PUBLIC);
 	  RB_OBJ_WRITE(klass, &def->body.iseq_body.cref, private_cref);
 	  break;
       }
@@ -744,7 +744,7 @@ rb_method_entry_with_refinements(VALUE k https://github.com/ruby/ruby/blob/trunk/vm_method.c#L744
 
     if (me && me->def->type == VM_METHOD_TYPE_REFINED) {
 	NODE *cref = rb_vm_cref();
-	VALUE refinements = cref ? cref->nd_refinements : Qnil;
+	VALUE refinements = cref ? CREF_REFINEMENTS(cref) : Qnil;
 
 	me = rb_resolve_refined_method(refinements, me, &defined_class);
     }
Index: eval.c
===================================================================
--- eval.c	(revision 49893)
+++ eval.c	(revision 49894)
@@ -343,13 +343,13 @@ rb_mod_nesting(void) https://github.com/ruby/ruby/blob/trunk/eval.c#L343
     VALUE ary = rb_ary_new();
     const NODE *cref = rb_vm_cref();
 
-    while (cref && cref->nd_next) {
-	VALUE klass = cref->nd_clss;
-	if (!(cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL) &&
+    while (cref && CREF_NEXT(cref)) {
+	VALUE klass = CREF_CLASS(cref);
+	if (!CREF_PUSHED_BY_EVAL(cref) &&
 	    !NIL_P(klass)) {
 	    rb_ary_push(ary, klass);
 	}
-	cref = cref->nd_next;
+	cref = CREF_NEXT(cref);
     }
     return ary;
 }
@@ -389,15 +389,15 @@ rb_mod_s_constants(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/eval.c#L389
     }
 
     while (cref) {
-	klass = cref->nd_clss;
-	if (!(cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL) &&
+	klass = CREF_CLASS(cref);
+	if (!CREF_PUSHED_BY_EVAL(cref) &&
 	    !NIL_P(klass)) {
-	    data = rb_mod_const_at(cref->nd_clss, data);
+	    data = rb_mod_const_at(CREF_CLASS(cref), data);
 	    if (!cbase) {
 		cbase = klass;
 	    }
 	}
-	cref = cref->nd_next;
+	cref = CREF_NEXT(cref);
     }
 
     if (cbase) {
@@ -1160,15 +1160,15 @@ rb_using_refinement(NODE *cref, VALUE kl https://github.com/ruby/ruby/blob/trunk/eval.c#L1160
 
     Check_Type(klass, T_CLASS);
     Check_Type(module, T_MODULE);
-    if (NIL_P(cref->nd_refinements)) {
-	RB_OBJ_WRITE(cref, &cref->nd_refinements, hidden_identity_hash_new());
+    if (NIL_P(CREF_REFINEMENTS(cref))) {
+	RB_OBJ_WRITE(cref, &CREF_REFINEMENTS(cref), hidden_identity_hash_new());
     }
     else {
-	if (cref->flags & NODE_FL_CREF_OMOD_SHARED) {
-	    RB_OBJ_WRITE(cref, &cref->nd_refinements, rb_hash_dup(cref->nd_refinements));
-	    cref->flags &= ~NODE_FL_CREF_OMOD_SHARED;
+	if (CREF_OMOD_SHARED(cref)) {
+	    RB_OBJ_WRITE(cref, &CREF_REFINEMENTS(cref), rb_hash_dup(CREF_REFINEMENTS(cref)));
+	    CREF_OMOD_SHARED_UNSET(cref);
 	}
-	if (!NIL_P(c = rb_hash_lookup(cref->nd_refinements, klass))) {
+	if (!NIL_P(c = rb_hash_lookup(CREF_REFINEMENTS(cref), klass))) {
 	    superclass = c;
 	    while (c && RB_TYPE_P(c, T_ICLASS)) {
 		if (RBASIC(c)->klass == module) {
@@ -1193,7 +1193,7 @@ rb_using_refinement(NODE *cref, VALUE kl https://github.com/ruby/ruby/blob/trunk/eval.c#L1193
 	RCLASS_REFINED_CLASS(c) = klass;
 	module = RCLASS_SUPER(module);
     }
-    rb_hash_aset(cref->nd_refinements, klass, iclass);
+    rb_hash_aset(CREF_REFINEMENTS(cref), klass, iclass);
 }
 
 static int
@@ -1488,7 +1488,7 @@ top_using(VALUE self, VALUE module) https://github.com/ruby/ruby/blob/trunk/eval.c#L1488
     NODE *cref = rb_vm_cref();
     rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
 
-    if (cref->nd_next || (prev_cfp && prev_cfp->me)) {
+    if (CREF_NEXT(cref) || (prev_cfp && prev_cfp->me)) {
 	rb_raise(rb_eRuntimeError,
 		 "main.using is permitted only at toplevel");
     }
Index: internal.h
===================================================================
--- internal.h	(revision 49893)
+++ internal.h	(revision 49894)
@@ -505,6 +505,18 @@ RCLASS_SET_SUPER(VALUE klass, VALUE supe https://github.com/ruby/ruby/blob/trunk/internal.h#L505
     return super;
 }
 
+/* CREF */
+#define CREF_CLASS(cref)       ((cref)->nd_clss_)
+#define CREF_NEXT(cref)        ((cref)->nd_next)
+#define CREF_VISI(cref)        ((cref)->nd_visi_)
+#define CREF_VISI_SET(cref, v) ((cref)->nd_visi_ = (v))
+#define CREF_REFINEMENTS(cref) ((cref)->nd_refinements_)
+#define CREF_PUSHED_BY_EVAL(cref)     ((cref)->flags & NODE_FL_CREF_PUSHED_BY_EVAL_)
+#define CREF_PUSHED_BY_EVAL_SET(cref) ((cref)->flags |= NODE_FL_CREF_PUSHED_BY_EVAL_)
+#define CREF_OMOD_SHARED(cref)        ((cref)->flags & NODE_FL_CREF_OMOD_SHARED_)
+#define CREF_OMOD_SHARED_SET(cref)    ((cref)->flags |= NODE_FL_CREF_OMOD_SHARED_)
+#define CREF_OMOD_SHARED_UNSET(cref)  ((cref)->flags &= ~NODE_FL_CREF_OMOD_SHARED_)
+
 struct vtm; /* defined by timev.h */
 
 /* array.c */
Index: vm.c
===================================================================
--- vm.c	(revision 49893)
+++ vm.c	(revision 49894)
@@ -83,9 +83,9 @@ static NODE * https://github.com/ruby/ruby/blob/trunk/vm.c#L83
 vm_cref_new(VALUE klass, long visi, NODE *prev_cref)
 {
     NODE *cref = NEW_CREF(klass);
-    cref->nd_refinements = Qnil;
-    cref->nd_visi = visi;
-    cref->nd_next = prev_cref;
+    CREF_REFINEMENTS(cref) = Qnil;
+    CREF_VISI_SET(cref, visi);
+    CREF_NEXT(cref) = prev_cref;
     return cref;
 }
 
@@ -107,8 +107,8 @@ vm_cref_dump(const char *mesg, const NOD https://github.com/ruby/ruby/blob/trunk/vm.c#L107
     fprintf(stderr, "vm_cref_dump: %s (%p)\n", mesg, cref);
 
     while (cref) {
-	fprintf(stderr, "= cref| klass: %s\n", RSTRING_PTR(rb_class_path(cref->nd_clss)));
-	cref = cref->nd_next;
+	fprintf(stderr, "= cref| klass: %s\n", RSTRING_PTR(rb_class_path(CREF_CLASS(cref))));
+	cref = CREF_NEXT(cref);
     }
 }
 
@@ -1060,7 +1060,7 @@ rb_vm_cref_in_context(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/vm.c#L1060
     const NODE *cref;
     if (cfp->self != self) return NULL;
     cref = rb_vm_get_cref(cfp->ep);
-    if (cref->nd_clss != cbase) return NULL;
+    if (CREF_CLASS(cref) != cbase) return NULL;
     return cref;
 }
 
@@ -1069,9 +1069,9 @@ void https://github.com/ruby/ruby/blob/trunk/vm.c#L1069
 debug_cref(NODE *cref)
 {
     while (cref) {
-	dp(cref->nd_clss);
-	printf("%ld\n", cref->nd_visi);
-	cref = cref->nd_next;
+	dp(CREF_CLASS(cref));
+	printf("%ld\n", CREF_VISI(cref));
+	cref = CREF_NEXT(cref);
     }
 }
 #endif
@@ -2266,8 +2266,8 @@ static void https://github.com/ruby/ruby/blob/trunk/vm.c#L2266
 vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
 		 rb_num_t is_singleton, NODE *cref)
 {
-    VALUE klass = cref->nd_clss;
-    int noex = (int)cref->nd_visi;
+    VALUE klass = CREF_CLASS(cref);
+    int noex = CREF_VISI(cref);
     rb_iseq_t *miseq;
     GetISeqPtr(iseqval, miseq);
 
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 49893)
+++ vm_insnhelper.c	(revision 49894)
@@ -299,18 +299,18 @@ rb_vm_rewrite_cref_stack(NODE *node, VAL https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L299
     NODE *new_node;
 
     while (node) {
-	if (node->nd_clss == old_klass) {
+	if (CREF_CLASS(node) == old_klass) {
 	    new_node = NEW_CREF(new_klass);
 	    COPY_CREF_OMOD(new_node, node);
-	    RB_OBJ_WRITE(new_node, &new_node->nd_next, node->nd_next);
+	    RB_OBJ_WRITE(new_node, &CREF_NEXT(new_node), CREF_NEXT(node));
 	    *new_cref_ptr = new_node;
 	    return;
 	}
-	new_node = NEW_CREF(node->nd_clss);
+	new_node = NEW_CREF(CREF_CLASS(node));
 	COPY_CREF_OMOD(new_node, node);
-	node = node->nd_next;
+	node = CREF_NEXT(node);
 	*new_cref_ptr = new_node;
-	new_cref_ptr = &new_node->nd_next;
+	new_cref_ptr = &CREF_NEXT(new_node);
     }
     *new_cref_ptr = NULL;
 }
@@ -333,10 +333,10 @@ vm_cref_push(rb_thread_t *th, VALUE klas https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L333
     }
     cref = vm_cref_new(klass, noex, prev_cref);
 
-    /* TODO: why cref->nd_next is 1? */
-    if (cref->nd_next && cref->nd_next != (void *) 1 &&
-	!NIL_P(cref->nd_next->nd_refinements)) {
-	COPY_CREF_OMOD(cref, cref->nd_next);
+    /* TODO: why CREF_NEXT(cref) is 1? */
+    if (CREF_NEXT(cref) && CREF_NEXT(cref) != (void *) 1 &&
+	!NIL_P(CREF_REFINEMENTS(CREF_NEXT(cref)))) {
+	COPY_CREF_OMOD(cref, CREF_NEXT(cref));
     }
 
     return cref;
@@ -349,10 +349,10 @@ vm_get_cbase(const VALUE *ep) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L349
     VALUE klass = Qundef;
 
     while (cref) {
-	if ((klass = cref->nd_clss) != 0) {
+	if ((klass = CREF_CLASS(cref)) != 0) {
 	    break;
 	}
-	cref = cref->nd_next;
+	cref = CREF_NEXT(cref);
     }
 
     return klass;
@@ -365,11 +365,11 @@ vm_get_const_base(const VALUE *ep) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L365
     VALUE klass = Qundef;
 
     while (cref) {
-	if (!(cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL) &&
-	    (klass = cref->nd_clss) != 0) {
+	if (!CREF_PUSHED_BY_EVAL(cref) &&
+	    (klass = CREF_CLASS(cref)) != 0) {
 	    break;
 	}
-	cref = cref->nd_next;
+	cref = CREF_NEXT(cref);
     }
 
     return klass;
@@ -411,18 +411,18 @@ vm_get_ev_const(rb_thread_t *th, VALUE o https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L411
 	const NODE *cref;
 	VALUE klass = orig_klass;
 
-	while (root_cref && root_cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL) {
-	    root_cref = root_cref->nd_next;
+	while (root_cref && CREF_PUSHED_BY_EVAL(root_cref)) {
+	    root_cref = CREF_NEXT(root_cref);
 	}
 	cref = root_cref;
-	while (cref && cref->nd_next) {
-	    if (cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL) {
+	while (cref && CREF_NEXT(cref)) {
+	    if (CREF_PUSHED_BY_EVAL(cref)) {
 		klass = Qnil;
 	    }
 	    else {
-		klass = cref->nd_clss;
+		klass = CREF_CLASS(cref);
 	    }
-	    cref = cref->nd_next;
+	    cref = CREF_NEXT(cref);
 
 	    if (!NIL_P(klass)) {
 		VALUE av, am = 0;
@@ -451,8 +451,8 @@ vm_get_ev_const(rb_thread_t *th, VALUE o https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L451
 	}
 
 	/* search self */
-	if (root_cref && !NIL_P(root_cref->nd_clss)) {
-	    klass = vm_get_iclass(th->cfp, root_cref->nd_clss);
+	if (root_cref && !NIL_P(CREF_CLASS(root_cref))) {
+	    klass = vm_get_iclass(th->cfp, CREF_CLASS(root_cref));
 	}
 	else {
 	    klass = CLASS_OF(th->cfp->self);
@@ -485,16 +485,16 @@ vm_get_cvar_base(NODE *cref, rb_control_ https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L485
 	rb_bug("vm_get_cvar_base: no cref");
     }
 
-    while (cref->nd_next &&
-	   (NIL_P(cref->nd_clss) || FL_TEST(cref->nd_clss, FL_SINGLETON) ||
-	    (cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL))) {
-	cref = cref->nd_next;
+    while (CREF_NEXT(cref) &&
+	   (NIL_P(CREF_CLASS(cref)) || FL_TEST(CREF_CLASS(cref), FL_SINGLETON) ||
+	    CREF_PUSHED_BY_EVAL(cref))) {
+	cref = CREF_NEXT(cref);
     }
-    if (!cref->nd_next) {
+    if (!CREF_NEXT(cref)) {
 	rb_warn("class variable access from toplevel");
     }
 
-    klass = vm_get_iclass(cfp, cref->nd_clss);
+    klass = vm_get_iclass(cfp, CREF_CLASS(cref));
 
     if (NIL_P(klass)) {
 	rb_raise(rb_eTypeError, "no class variables available");
@@ -1785,7 +1785,7 @@ vm_call_method(rb_thread_t *th, rb_contr https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1785
 		break;
 	      case VM_METHOD_TYPE_REFINED:{
 		NODE *cref = rb_vm_get_cref(cfp->ep);
-		VALUE refinements = cref ? cref->nd_refinements : Qnil;
+		VALUE refinements = cref ? CREF_REFINEMENTS(cref) : Qnil;
 		VALUE refinement, defined_class;
 		rb_method_entry_t *me;
 
Index: vm_insnhelper.h
===================================================================
--- vm_insnhelper.h	(revision 49893)
+++ vm_insnhelper.h	(revision 49894)
@@ -146,21 +146,21 @@ enum vm_regan_acttype { https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L146
 /**********************************************************/
 
 #define COPY_CREF_OMOD(c1, c2) do {  \
-  RB_OBJ_WRITE((c1), &(c1)->nd_refinements, (c2)->nd_refinements); \
-  if (!NIL_P((c2)->nd_refinements)) { \
-      (c1)->flags |= NODE_FL_CREF_OMOD_SHARED; \
-      (c2)->flags |= NODE_FL_CREF_OMOD_SHARED; \
+  RB_OBJ_WRITE((c1), &CREF_REFINEMENTS(c1), CREF_REFINEMENTS(c2)); \
+  if (!CREF_REFINEMENTS(c2)) { \
+      CREF_OMOD_SHARED_SET(c1); \
+      CREF_OMOD_SHARED_SET(c2); \
   } \
 } while (0)
 
 #define COPY_CREF(c1, c2) do {  \
   NODE *__tmp_c2 = (c2); \
   COPY_CREF_OMOD(c1, __tmp_c2); \
-  RB_OBJ_WRITE((c1), &(c1)->nd_clss, __tmp_c2->nd_clss); \
-  (c1)->nd_visi = __tmp_c2->nd_visi;\
-  RB_OBJ_WRITE((c1), &(c1)->nd_next, __tmp_c2->nd_next); \
-  if (__tmp_c2->flags & NODE_FL_CREF_PUSHED_BY_EVAL) { \
-      (c1)->flags |= NODE_FL_CREF_PUSHED_BY_EVAL; \
+  RB_OBJ_WRITE((c1), &CREF_CLASS(c1), CREF_CLASS(__tmp_c2)); \
+  CREF_VISI_SET((c1), CREF_VISI(__tmp_c2));\
+  RB_OBJ_WRITE((c1), &CREF_NEXT(c1), CREF_NEXT(__tmp_c2)); \
+  if (CREF_PUSHED_BY_EVAL(__tmp_c2)) { \
+      CREF_PUSHED_BY_EVAL_SET(c1); \
   } \
 } while (0)
 
Index: node.c
===================================================================
--- node.c	(revision 49893)
+++ node.c	(revision 49894)
@@ -947,7 +947,7 @@ rb_gc_mark_node(NODE *obj) https://github.com/ruby/ruby/blob/trunk/node.c#L947
 {
     switch (nd_type(obj)) {
       case NODE_IF:		/* 1,2,3 */
-	rb_gc_mark(obj->nd_refinements); /* use as SVAR */
+	rb_gc_mark(CREF_REFINEMENTS(obj)); /* use as SVAR */
       case NODE_FOR:
       case NODE_ITER:
       case NODE_WHEN:
@@ -1070,9 +1070,9 @@ rb_gc_mark_node(NODE *obj) https://github.com/ruby/ruby/blob/trunk/node.c#L1070
 	break;
 
       case NODE_CREF:
-	rb_gc_mark(obj->nd_refinements);
-	rb_gc_mark(RNODE(obj)->nd_clss);
-	return (VALUE)RNODE(obj)->nd_next;
+	rb_gc_mark(CREF_REFINEMENTS(obj));
+	rb_gc_mark(CREF_CLASS(obj));
+	return (VALUE)CREF_NEXT(obj);;
 
       default:		/* unlisted NODE */
 	rb_gc_mark_maybe(RNODE(obj)->u1.value);
Index: node.h
===================================================================
--- node.h	(revision 49893)
+++ node.h	(revision 49894)
@@ -272,9 +272,9 @@ typedef struct RNode { https://github.com/ruby/ruby/blob/trunk/node.h#L272
  *          15: NODE_FL_CREF_PUSHED_BY_EVAL
  *          16: NODE_FL_CREF_OMOD_SHARED
  */
-#define NODE_FL_NEWLINE             (((VALUE)1)<<7)
-#define NODE_FL_CREF_PUSHED_BY_EVAL (((VALUE)1)<<15)
-#define NODE_FL_CREF_OMOD_SHARED    (((VALUE)1)<<16)
+#define NODE_FL_NEWLINE              (((VALUE)1)<<7)
+#define NODE_FL_CREF_PUSHED_BY_EVAL_ (((VALUE)1)<<15)
+#define NODE_FL_CREF_OMOD_SHARED_    (((VALUE)1)<<16)
 
 #define NODE_TYPESHIFT 8
 #define NODE_TYPEMASK  (((VALUE)0x7f)<<NODE_TYPESHIFT)
@@ -289,7 +289,7 @@ typedef struct RNode { https://github.com/ruby/ruby/blob/trunk/node.h#L289
 #define nd_set_line(n,l) \
     RNODE(n)->flags=((RNODE(n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))
 
-#define nd_refinements  nd_reserved
+#define nd_refinements_  nd_reserved
 
 #define nd_head  u1.node
 #define nd_alen  u2.argc
@@ -347,7 +347,7 @@ typedef struct RNode { https://github.com/ruby/ruby/blob/trunk/node.h#L347
 #define nd_super u3.node
 
 #define nd_modl  u1.id
-#define nd_clss  u1.value
+#define nd_clss_  u1.value
 
 #define nd_beg   u1.node
 #define nd_end   u2.node
@@ -359,7 +359,7 @@ typedef struct RNode { https://github.com/ruby/ruby/blob/trunk/node.h#L359
 #define nd_tag   u1.id
 #define nd_tval  u2.value
 
-#define nd_visi  u2.argc
+#define nd_visi_  u2.argc
 
 #define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
 

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

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