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

ruby-changes:37816

From: ko1 <ko1@a...>
Date: Mon, 9 Mar 2015 06:22:59 +0900 (JST)
Subject: [ruby-changes:37816] ko1:r49897 (trunk): * internal.h: define rb_cref_t and change to use it.

ko1	2015-03-09 06:22:43 +0900 (Mon, 09 Mar 2015)

  New Revision: 49897

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

  Log:
    * internal.h: define rb_cref_t and change to use it.
      rb_cref_t is data type of CREF. Now, the body is still NODE.
      It is easy to understand what is CREF and what is pure NODE.

  Modified files:
    trunk/ChangeLog
    trunk/class.c
    trunk/eval.c
    trunk/eval_intern.h
    trunk/insns.def
    trunk/internal.h
    trunk/method.h
    trunk/node.c
    trunk/node.h
    trunk/proc.c
    trunk/vm.c
    trunk/vm_core.h
    trunk/vm_eval.c
    trunk/vm_insnhelper.c
    trunk/vm_insnhelper.h
    trunk/vm_method.c
Index: eval_intern.h
===================================================================
--- eval_intern.h	(revision 49896)
+++ eval_intern.h	(revision 49897)
@@ -245,7 +245,7 @@ NORETURN(void rb_raise_method_missing(rb https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L245
 				      VALUE obj, int call_status));
 
 VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
-NODE *rb_vm_cref(void);
+rb_cref_t *rb_vm_cref(void);
 VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename);
 void rb_vm_set_progname(VALUE filename);
 void rb_thread_terminate_all(void);
Index: method.h
===================================================================
--- method.h	(revision 49896)
+++ method.h	(revision 49897)
@@ -84,7 +84,7 @@ typedef struct rb_method_definition_stru https://github.com/ruby/ruby/blob/trunk/method.h#L84
     union {
 	struct {
 	    rb_iseq_t *const iseq;            /* should be mark */
-	    NODE *cref;
+	    rb_cref_t *cref;
 	} iseq_body;
 	rb_method_cfunc_t cfunc;
 	rb_method_attr_t attr;
@@ -118,7 +118,7 @@ struct unlinked_method_entry_list_entry https://github.com/ruby/ruby/blob/trunk/method.h#L118
      UNDEFINED_METHOD_ENTRY_P((def)->body.orig_me))
 
 void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_flag_t noex);
-void rb_add_method_iseq(VALUE klass, ID mid, rb_iseq_t *iseq, NODE *cref, rb_method_flag_t noex);
+void rb_add_method_iseq(VALUE klass, ID mid, rb_iseq_t *iseq, rb_cref_t *cref, rb_method_flag_t noex);
 rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex);
 rb_method_entry_t *rb_method_entry(VALUE klass, ID id, VALUE *define_class_ptr);
 rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);
Index: insns.def
===================================================================
--- insns.def	(revision 49896)
+++ insns.def	(revision 49897)
@@ -159,8 +159,7 @@ getclassvariable https://github.com/ruby/ruby/blob/trunk/insns.def#L159
 ()
 (VALUE val)
 {
-    NODE *cref = rb_vm_get_cref(GET_EP());
-    val = rb_cvar_get(vm_get_cvar_base(cref, GET_CFP()), id);
+    val = rb_cvar_get(vm_get_cvar_base(rb_vm_get_cref(GET_EP()), GET_CFP()), id);
 }
 
 /**
@@ -174,8 +173,7 @@ setclassvariable https://github.com/ruby/ruby/blob/trunk/insns.def#L173
 (VALUE val)
 ()
 {
-    NODE *cref = rb_vm_get_cref(GET_EP());
-    rb_cvar_set(vm_get_cvar_base(cref, GET_CFP()), id, val);
+    rb_cvar_set(vm_get_cvar_base(rb_vm_get_cref(GET_EP()), GET_CFP()), id, val);
 }
 
 /**
@@ -738,7 +736,7 @@ defined https://github.com/ruby/ruby/blob/trunk/insns.def#L736
 	}
 	break;
       case DEFINED_CVAR: {
-	NODE *cref = rb_vm_get_cref(GET_EP());
+	const rb_cref_t *cref = rb_vm_get_cref(GET_EP());
 	klass = vm_get_cvar_base(cref, GET_CFP());
 	if (rb_cvar_defined(klass, SYM2ID(obj))) {
 	    expr_type = DEFINED_CVAR;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49896)
+++ ChangeLog	(revision 49897)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Mar  9 06:19:06 2015  Koichi Sasada  <ko1@a...>
+
+	* internal.h: define rb_cref_t and change to use it.
+
+	  rb_cref_t is data type of CREF. Now, the body is still NODE.
+	  It is easy to understand what is CREF and what is pure NODE.
+
 Mon Mar  9 06:00:37 2015  Koichi Sasada  <ko1@a...>
 
 	* vm_insnhelper.h (COPY_CREF_OMOD): fix translation miss.
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 49896)
+++ vm_core.h	(revision 49897)
@@ -117,7 +117,7 @@ typedef struct rb_compile_option_struct https://github.com/ruby/ruby/blob/trunk/vm_core.h#L117
 
 struct iseq_inline_cache_entry {
     rb_serial_t ic_serial;
-    NODE *ic_cref;
+    rb_cref_t *ic_cref;
     union {
 	size_t index;
 	VALUE value;
@@ -1000,7 +1000,7 @@ void rb_gc_mark_machine_stack(rb_thread_ https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1000
 
 int rb_autoloading_value(VALUE mod, ID id, VALUE* value);
 
-void rb_vm_rewrite_cref_stack(NODE *node, VALUE old_klass, VALUE new_klass, NODE **new_cref_ptr);
+void rb_vm_rewrite_cref_stack(rb_cref_t *node, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr);
 
 #define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
 
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 49896)
+++ vm_eval.c	(revision 49897)
@@ -16,12 +16,11 @@ struct local_var_list { https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L16
 };
 
 static inline VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status);
-static inline VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const NODE *cref);
+static inline VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const rb_cref_t *cref);
 static inline VALUE vm_yield(rb_thread_t *th, int argc, const VALUE *argv);
 static inline VALUE vm_yield_with_block(rb_thread_t *th, int argc, const VALUE *argv, const rb_block_t *blockargptr);
-static NODE *vm_cref_push(rb_thread_t *th, VALUE klass, int noex, rb_block_t *blockptr);
 static VALUE vm_exec(rb_thread_t *th);
-static void vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const NODE *cref, rb_block_t *base_block);
+static void vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const rb_cref_t *cref, rb_block_t *base_block);
 static int vm_collect_local_variables_in_heap(rb_thread_t *th, const VALUE *dfp, const struct local_var_list *vars);
 
 static VALUE rb_eUncaughtThrow;
@@ -1229,7 +1228,7 @@ rb_each(VALUE obj) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1228
 }
 
 static VALUE
-eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *const cref_arg, volatile VALUE file, volatile int line)
+eval_string_with_cref(VALUE self, VALUE src, VALUE scope, rb_cref_t *const cref_arg, volatile VALUE file, volatile int line)
 {
     int state;
     VALUE result = Qundef;
@@ -1239,7 +1238,7 @@ eval_string_with_cref(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1238
     rb_block_t block, *base_block;
     volatile int parse_in_eval;
     volatile int mild_compile_error;
-    NODE *orig_cref;
+    rb_cref_t *orig_cref;
     VALUE crefval;
 
     if (file == 0) {
@@ -1251,7 +1250,7 @@ eval_string_with_cref(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1250
     mild_compile_error = th->mild_compile_error;
     TH_PUSH_TAG(th);
     if ((state = TH_EXEC_TAG()) == 0) {
-	NODE *cref = cref_arg;
+	rb_cref_t *cref = cref_arg;
 	rb_binding_t *bind = 0;
 	rb_iseq_t *iseq;
 	volatile VALUE iseqval;
@@ -1308,7 +1307,7 @@ eval_string_with_cref(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1307
 	if (!cref && base_block->iseq) {
 	    if (NIL_P(scope)) {
 		orig_cref = rb_vm_get_cref(base_block->ep);
-		cref = NEW_CREF(Qnil);
+		cref = (rb_cref_t *)NEW_CREF(Qnil);
 		crefval = (VALUE) cref;
 		COPY_CREF(cref, orig_cref);
 	    }
@@ -1559,7 +1558,7 @@ yield_under(VALUE under, VALUE self, VAL https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1558
 {
     rb_thread_t *th = GET_THREAD();
     rb_block_t block, *blockptr;
-    NODE *cref;
+    rb_cref_t *cref;
 
     if ((blockptr = VM_CF_BLOCK_PTR(th->cfp)) != 0) {
 	block = *blockptr;
@@ -1582,7 +1581,7 @@ rb_yield_refine_block(VALUE refinement, https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1581
 {
     rb_thread_t *th = GET_THREAD();
     rb_block_t block, *blockptr;
-    NODE *cref;
+    rb_cref_t *cref;
 
     if ((blockptr = VM_CF_BLOCK_PTR(th->cfp)) != 0) {
 	block = *blockptr;
@@ -1591,7 +1590,7 @@ rb_yield_refine_block(VALUE refinement, https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1590
     }
     cref = vm_cref_push(th, refinement, NOEX_PUBLIC, blockptr);
     CREF_PUSHED_BY_EVAL_SET(cref);
-    RB_OBJ_WRITE(cref, &CREF_REFINEMENTS(cref), refinements);
+    CREF_REFINEMENTS_SET(cref, refinements);
 
     return vm_yield_with_cref(th, 0, NULL, cref);
 }
@@ -1600,7 +1599,7 @@ rb_yield_refine_block(VALUE refinement, https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1599
 static VALUE
 eval_under(VALUE under, VALUE self, VALUE src, VALUE file, int line)
 {
-    NODE *cref = vm_cref_push(GET_THREAD(), under, NOEX_PUBLIC, NULL);
+    rb_cref_t *cref = vm_cref_push(GET_THREAD(), under, NOEX_PUBLIC, NULL);
 
     if (SPECIAL_CONST_P(self) && !NIL_P(under)) {
 	CREF_PUSHED_BY_EVAL_SET(cref);
Index: proc.c
===================================================================
--- proc.c	(revision 49896)
+++ proc.c	(revision 49897)
@@ -14,7 +14,7 @@ https://github.com/ruby/ruby/blob/trunk/proc.c#L14
 #include "gc.h"
 #include "iseq.h"
 
-const NODE *rb_vm_cref_in_context(VALUE self, VALUE cbase);
+const rb_cref_t *rb_vm_cref_in_context(VALUE self, VALUE cbase);
 
 struct METHOD {
     VALUE recv;
@@ -1639,7 +1639,7 @@ rb_mod_define_method(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/proc.c#L1639
     ID id;
     VALUE body;
     int noex = NOEX_PUBLIC;
-    const NODE *cref = rb_vm_cref_in_context(mod, mod);
+    const rb_cref_t *cref = rb_vm_cref_in_context(mod, mod);
 
     if (cref) {
 	noex = CREF_VISI(cref);
@@ -2167,7 +2167,7 @@ method_get_iseq(rb_method_definition_t * https://github.com/ruby/ruby/blob/trunk/proc.c#L2167
     }
 }
 
-static NODE *
+static const rb_cref_t *
 method_get_cref(rb_method_definition_t *def)
 {
     switch (def->type) {
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 49896)
+++ vm_method.c	(revision 49897)
@@ -447,7 +447,7 @@ setup_method_cfunc_struct(rb_method_cfun https://github.com/ruby/ruby/blob/trunk/vm_method.c#L447
 }
 
 rb_method_entry_t *
-rb_add_method0(VALUE klass, ID mid, rb_method_type_t type, void *opts, rb_method_flag_t noex, NODE *cref)
+rb_add_method0(VALUE klass, ID mid, rb_method_type_t type, void *opts, rb_method_flag_t noex, rb_cref_t *cref)
 {
     rb_thread_t *th;
     rb_control_frame_t *cfp;
@@ -471,7 +471,7 @@ rb_add_method0(VALUE klass, ID mid, rb_m https://github.com/ruby/ruby/blob/trunk/vm_method.c#L471
     switch (type) {
       case VM_METHOD_TYPE_ISEQ: {
 	  rb_iseq_t *iseq = (rb_iseq_t *)opts;
-	  NODE *private_cref;
+	  rb_cref_t *private_cref;
 
 	  *(rb_iseq_t **)&def->body.iseq_body.iseq = iseq;
 	  RB_OBJ_WRITTEN(klass, Qundef, iseq->self); /* should be set iseq before newobj */
@@ -531,7 +531,7 @@ rb_add_method(VALUE klass, ID mid, rb_me https://github.com/ruby/ruby/blob/trunk/vm_method.c#L531
 }
 
 void
-rb_add_method_iseq(VALUE klass, ID mid, rb_iseq_t *iseq, NODE *cref, rb_method_flag_t noex)
+rb_add_method_iseq(VALUE klass, ID mid, rb_iseq_t *iseq, rb_cref_t *cref, rb_method_flag_t noex)
 {
     rb_add_method0(klass, mid, VM_METHOD_TYPE_ISEQ, iseq, noex, cref);
 }
@@ -743,7 +743,7 @@ rb_method_entry_with_refinements(VALUE k https://github.com/ruby/ruby/blob/trunk/vm_method.c#L743
     rb_method_entry_t *me = rb_method_entry(klass, id, &defined_class);
 
     if (me && me->def->type == VM_METHOD_TYPE_REFINED) {
-	NODE *cref = rb_vm_cref();
+	const rb_cref_t *cref = rb_vm_cref();
 	VALUE refinements = cref ? CREF_REFINEMENTS(cref) : Qnil;
 
 	me = rb_resolve_refined_method(refinements, me, &defined_class);
Index: eval.c
===================================================================
--- eval.c	(revision 49896)
+++ eval.c	(revision 49897)
@@ -341,7 +341,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/eval.c#L341
 rb_mod_nesting(void)
 {
     VALUE ary = rb_ary_new();
-    const NODE *cref = rb_vm_cref();
+    const rb_cref_t *cref = rb_vm_cref();
 
     while (cref && CREF_NEXT(cref)) {
 	VALUE klass = CREF_CLASS(cref);
@@ -379,7 +379,7 @@ rb_mod_nesting(void) https://github.com/ruby/ruby/blob/trunk/eval.c#L379
 static VALUE
 rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
 {
-    const NODE *cref = rb_vm_cref();
+    const rb_cref_t *cref = rb_vm_cref();
     VALUE klass;
     VALUE cbase = 0;
     void *data = 0;
@@ -1154,18 +1154,18 @@ hidden_identity_hash_new(void) https://github.com/ruby/ruby/blob/trunk/eval.c#L1154
 }
 
 void
-rb_using_refinement(NODE *cref, VALUE klass, VALUE module)
+rb_using_refinement(rb_cref_t *cref, VALUE klass, VALUE module)
 {
     VALUE iclass, c, superclass = klass;
 
     Check_Type(klass, T_CLASS);
     Check_Type(module, T_MODULE);
     if (NIL_P(CREF_REFINEMENTS(cref))) {
-	RB_OBJ_WRITE(cref, &CREF_REFINEMENTS(cref), hidden_identity_hash_new());
+	CREF_REFINEMENTS_SET(cref, hidden_identity_hash_new());
     }
     else {
 	if (CREF_OMOD_SHARED(cref)) {
-	    RB_OBJ_WRITE(cref, &CREF_REFINEMENTS(cref), rb_hash_dup(CREF_REFINEMENTS(cref)));
+	    CREF_REFINEMENTS_SET(cref, rb_hash_dup(CREF_REFINEMENTS(cref)));
 	    CREF_OMOD_SHARED_UNSET(cref);
 	}
 	if (!NIL_P(c = rb_hash_lookup(CREF_REFINEMENTS(cref), klass))) {
@@ -1199,14 +1199,14 @@ rb_using_refinement(NODE *cref, VALUE kl https://github.com/ruby/ruby/blob/trunk/eval.c#L1199
 static int
 using_refinement(VALUE klass, VALUE module, VALUE arg)
 {
-    NODE *cref = (NODE *) arg;
+    rb_cref_t *cref = (rb_cref_t *) arg;
 
     rb_using_refinement(cref, klass, module);
     return ST_CONTINUE;
 }
 
 static void
-using_module_recursive(NODE *cref, VALUE klass)
+using_module_recursive(const rb_cref_t *cref, VALUE klass)
 {
     ID id_refinements;
     VALUE super, module, refinements;
@@ -1236,7 +1236,7 @@ using_module_recursive(NODE *cref, VALUE https://github.com/ruby/ruby/blob/trunk/eval.c#L1236
 }
 
 void
-rb_using_module(NODE *cref, VALUE module)
+rb_using_module(const rb_cref_t *cref, VALUE module)
 {
     Check_Type(module, T_MODULE);
     using_module_recursive(cref, module);
@@ -1348,7 +1348,7 @@ rb_mod_refine(VALUE module, VALUE klass) https://github.com/ruby/ruby/blob/trunk/eval.c#L1348
 static VALUE
 mod_using(VALUE self, VALUE module)
 {
-    NODE *cref = rb_vm_cref();
+    const rb_cref_t *cref = rb_vm_cref();
     rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
 
     if (prev_frame_func()) {
@@ -1485,7 +1485,7 @@ top_include(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/eval.c#L1485
 static VALUE
 top_using(VALUE self, VALUE module)
 {
-    NODE *cref = rb_vm_cref();
+    const rb_cref_t *cref = rb_vm_cref();
     rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
 
     if (CREF_NEXT(cref) || (prev_cfp && prev_cfp->me)) {
Index: class.c
===================================================================
--- class.c	(revision 49896)
+++ class.c	(revision 49897)
@@ -246,7 +246,7 @@ clone_method(VALUE klass, ID mid, const https://github.com/ruby/ruby/blob/trunk/class.c#L246
     VALUE newiseqval;
     if (me->def && me->def->type == VM_METHOD_TYPE_ISEQ) {
 	rb_iseq_t *iseq;
-	NODE *new_cref;
+	rb_cref_t *new_cref;
 	newiseqval = rb_iseq_clone(me->def->body.iseq_body.iseq->self, klass);
 	GetISeqPtr(newiseqval, iseq);
 	rb_vm_rewrite_cref_stack(me->def->body.iseq_body.cref, me->klass, klass, &new_cref);
Index: internal.h
===================================================================
--- internal.h	(revision 49896)
+++ internal.h	(revision 49897)
@@ -506,16 +506,95 @@ RCLASS_SET_SUPER(VALUE klass, VALUE supe https://github.com/ruby/ruby/blob/trunk/internal.h#L506
 }
 
 /* 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_)
+
+typedef struct rb_cref_struct {
+    VALUE flags;
+    VALUE refinements;
+    VALUE klass;
+    VALUE visi;
+    struct rb_cref_struct *next;
+} rb_cref_t;
+
+#define NODE_FL_CREF_PUSHED_BY_EVAL_ (((VALUE)1)<<15)
+#define NODE_FL_CREF_OMOD_SHARED_    (((VALUE)1)<<16)
+
+static inline VALUE
+CREF_CLASS(const rb_cref_t *cref)
+{
+    return cref->klass;
+}
+
+static inline void
+CREF_CLASS_SET(rb_cref_t *cref, VALUE klass)
+{
+    RB_OBJ_WRITE(cref, &cref->klass, klass);
+}
+
+static inline rb_cref_t *
+CREF_NEXT(const rb_cref_t *cref)
+{
+    return cref->next;
+}
+
+static inline void
+CREF_NEXT_SET(rb_cref_t *cref, const rb_cref_t *next_cref)
+{
+    RB_OBJ_WRITE(cref, &cref->next, next_cref);
+}
+
+static inline long
+CREF_VISI(const rb_cref_t *cref)
+{
+    return (long)cref->visi;
+}
+
+static inline void
+CREF_VISI_SET(rb_cref_t *cref, long v)
+{
+    cref->visi = v;
+}
+
+static inline VALUE
+CREF_REFINEMENTS(const rb_cref_t *cref)
+{
+    return cref->refinements;
+}
+
+static inline void
+CREF_REFINEMENTS_SET(rb_cref_t *cref, VALUE refs)
+{
+    RB_OBJ_WRITE(cref, &cref->refinements, refs);
+}
+
+static inline int
+CREF_PUSHED_BY_EVAL(const rb_cref_t *cref)
+{
+    return cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL_;
+}
+
+static inline void
+CREF_PUSHED_BY_EVAL_SET(rb_cref_t *cref)
+{
+    cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL_;
+}
+
+static inline int
+CREF_OMOD_SHARED(const rb_cref_t *cref)
+{
+    return cref->flags & NODE_FL_CREF_OMOD_SHARED_;
+}
+
+static inline void
+CREF_OMOD_SHARED_SET(rb_cref_t *cref)
+{
+    cref->flags |= NODE_FL_CREF_OMOD_SHARED_;
+}
+
+static inline void
+CREF_OMOD_SHARED_UNSET(rb_cref_t *cref)
+{
+    cref->flags &= ~NODE_FL_CREF_OMOD_SHARED_;
+}
 
 struct vtm; /* defined by timev.h */
 
Index: vm.c
===================================================================
--- vm.c	(revision 49896)
+++ vm.c	(revision 49897)
@@ -79,20 +79,20 @@ rb_vm_control_frame_block_ptr(const rb_c https://github.com/ruby/ruby/blob/trunk/vm.c#L79
     return VM_CF_BLOCK_PTR(cfp);
 }
 
-static NODE *
-vm_cref_new(VALUE klass, long visi, NODE *prev_cref)
+static rb_cref_t *
+vm_cref_new(VALUE klass, long visi, const rb_cref_t *prev_cref)
 {
-    NODE *cref = NEW_CREF(klass);
-    CREF_REFINEMENTS(cref) = Qnil;
+    rb_cref_t *cref = (rb_cref_t *)NEW_CREF(klass);
+    CREF_REFINEMENTS_SET(cref, Qnil);
     CREF_VISI_SET(cref, visi);
-    CREF_NEXT(cref) = prev_cref;
+    CREF_NEXT_SET(cref, prev_cref);
     return cref;
 }
 
-static NODE *
+static rb_cref_t *
 vm_cref_new_toplevel(rb_thread_t *th)
 {
-    NODE *cref = vm_cref_new(rb_cObject, NOEX_PRIVATE /* toplevel visibility is private */, NULL);
+    rb_cref_t *cref = vm_cref_new(rb_cObject, NOEX_PRIVATE /* toplevel visibility is private */, NULL);
 
     if (th->top_wrapper) {
 	cref = vm_cref_new(th->top_wrapper, NOEX_PRIVATE, cref);
@@ -102,7 +102,7 @@ vm_cref_new_toplevel(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L102
 }
 
 static void
-vm_cref_dump(const char *mesg, const NODE *cref)
+vm_cref_dump(const char *mesg, const rb_cref_t *cref)
 {
     fprintf(stderr, "vm_cref_dump: %s (%p)\n", mesg, cref);
 
@@ -251,7 +251,7 @@ vm_set_top_stack(rb_thread_t *th, VALUE https://github.com/ruby/ruby/blob/trunk/vm.c#L251
 }
 
 static void
-vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const NODE *cref, rb_block_t *base_block)
+vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const rb_cref_t *cref, rb_block_t *base_block)
 {
     rb_iseq_t *iseq;
     GetISeqPtr(iseqval, iseq);
@@ -795,7 +795,7 @@ rb_binding_add_dynavars(rb_binding_t *bi https://github.com/ruby/ruby/blob/trunk/vm.c#L795
 static inline VALUE
 invoke_block_from_c(rb_thread_t *th, const rb_block_t *block,
 		    VALUE self, int argc, const VALUE *argv,
-		    const rb_block_t *blockptr, const NODE *cref,
+		    const rb_block_t *blockptr, const rb_cref_t *cref,
 		    VALUE defined_class, int s (... truncated)

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

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