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

ruby-changes:24544

From: shugo <ko1@a...>
Date: Thu, 2 Aug 2012 20:09:03 +0900 (JST)
Subject: [ruby-changes:24544] shugo:r36595 (trunk): * class.c, insns.def, method.h, proc.c, vm.c, vm_core.h, vm_eval.c,

shugo	2012-08-02 20:08:44 +0900 (Thu, 02 Aug 2012)

  New Revision: 36595

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

  Log:
    * class.c, insns.def, method.h, proc.c, vm.c, vm_core.h, vm_eval.c,
      vm_insnhelper.c, vm_insnhelper.h, vm_method.c: add klass to
      rb_control_frame_t to implement super correctly.

  Modified files:
    trunk/ChangeLog
    trunk/class.c
    trunk/insns.def
    trunk/method.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: method.h
===================================================================
--- method.h	(revision 36594)
+++ method.h	(revision 36595)
@@ -89,9 +89,9 @@
 
 void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, 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);
+rb_method_entry_t *rb_method_entry(VALUE klass, ID id, VALUE *define_class_ptr);
 
-rb_method_entry_t *rb_method_entry_get_without_cache(VALUE klass, ID id);
+rb_method_entry_t *rb_method_entry_get_without_cache(VALUE klass, ID id, VALUE *define_class_ptr);
 rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex);
 
 int rb_method_entry_arity(const rb_method_entry_t *me);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36594)
+++ ChangeLog	(revision 36595)
@@ -1,3 +1,9 @@
+Thu Aug  2 20:08:02 2012  Shugo Maeda  <shugo@r...>
+
+	* class.c, insns.def, method.h, proc.c, vm.c, vm_core.h, vm_eval.c,
+	  vm_insnhelper.c, vm_insnhelper.h, vm_method.c: add klass to
+	  rb_control_frame_t to implement super correctly.
+
 Thu Aug  2 13:23:08 2012  NARUSE, Yui  <naruse@r...>
 
 	* configure.in (AC_PROG_CC): AC_PROG_CC tries clang at first on
Index: insns.def
===================================================================
--- insns.def	(revision 36594)
+++ insns.def	(revision 36595)
@@ -798,7 +798,7 @@
 	break;
       case DEFINED_METHOD:{
 	VALUE klass = CLASS_OF(v);
-	const rb_method_entry_t *me = rb_method_entry(klass, SYM2ID(obj));
+	const rb_method_entry_t *me = rb_method_entry(klass, SYM2ID(obj), 0);
 
 	if (me) {
 	    if (!(me->flag & NOEX_PRIVATE)) {
@@ -967,7 +967,7 @@
 
     /* enter scope */
     vm_push_frame(th, class_iseq, VM_FRAME_MAGIC_CLASS,
-		  klass, VM_ENVVAL_BLOCK_PTR(GET_BLOCK_PTR()),
+		  klass, 0, VM_ENVVAL_BLOCK_PTR(GET_BLOCK_PTR()),
 		  class_iseq->iseq_encoded, GET_SP(),
 		  class_iseq->local_size, 0);
     RESTORE_REGS();
@@ -999,7 +999,7 @@
 (VALUE val) // inc += - (int)(op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));
 {
     const rb_method_entry_t *me;
-    VALUE recv, klass;
+    VALUE recv, klass, defined_class;
     rb_block_t *blockptr = 0;
     VALUE flag = op_flag;
     int num = caller_setup_args(th, GET_CFP(), flag, (int)op_argc,
@@ -1009,8 +1009,8 @@
     /* get receiver */
     recv = TOPN(num);
     klass = CLASS_OF(recv);
-    me = vm_method_search(id, klass, ic);
-    CALL_METHOD(num, blockptr, flag, id, me, recv);
+    me = vm_method_search(id, klass, ic, &defined_class);
+    CALL_METHOD(num, blockptr, flag, id, me, recv, defined_class);
 }
 
 /**
@@ -1033,20 +1033,26 @@
     VALUE recv, klass;
     ID id;
     const rb_method_entry_t *me;
+    rb_iseq_t *ip;
 
     flag = VM_CALL_SUPER_BIT | VM_CALL_FCALL_BIT;
 
     recv = GET_SELF();
     vm_search_superclass(GET_CFP(), GET_ISEQ(), recv, TOPN(num), &id, &klass);
 
-    /* temporary measure for [Bug #2402] [Bug #2502] [Bug #3136] */
-    if (!rb_obj_is_kind_of(recv, klass)) {
-	rb_raise(rb_eNotImpError, "super from singleton method that is defined to multiple classes is not supported; this will be fixed in 1.9.3 or later");
+    ip = GET_ISEQ();
+    while (ip && !ip->klass) {
+	ip = ip->parent_iseq;
     }
+  again:
+    me = rb_method_entry(klass, id, &klass);
+    if (me && me->def->type == VM_METHOD_TYPE_ISEQ &&
+	me->def->body.iseq == ip) {
+	klass = RCLASS_SUPER(klass);
+	goto again;
+    }
 
-    me = rb_method_entry(klass, id);
-
-    CALL_METHOD(num, blockptr, flag, id, me, recv);
+    CALL_METHOD(num, blockptr, flag, id, me, recv, klass);
 }
 
 /**
@@ -1652,7 +1658,7 @@
 (VALUE val)
 {
     extern VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2);
-    const rb_method_entry_t *me = vm_method_search(idNeq, CLASS_OF(recv), ic);
+    const rb_method_entry_t *me = vm_method_search(idNeq, CLASS_OF(recv), ic, 0);
     val = Qundef;
 
     if (check_cfunc(me, rb_obj_not_equal)) {
@@ -2056,7 +2062,7 @@
 (VALUE val)
 {
     extern VALUE rb_obj_not(VALUE obj);
-    const rb_method_entry_t *me = vm_method_search(idNot, CLASS_OF(recv), ic);
+    const rb_method_entry_t *me = vm_method_search(idNot, CLASS_OF(recv), ic, 0);
 
     if (check_cfunc(me, rb_obj_not)) {
 	val = RTEST(recv) ? Qfalse : Qtrue;
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 36594)
+++ vm_core.h	(revision 36595)
@@ -137,6 +137,9 @@
 	rb_method_entry_t *method;
 	long index;
     } ic_value;
+    union {
+	VALUE defined_class;
+    } ic_value2;
 };
 
 #if 1
@@ -349,14 +352,16 @@
     rb_iseq_t *iseq;		/* cfp[3] */
     VALUE flag;			/* cfp[4] */
     VALUE self;			/* cfp[5] / block[0] */
-    VALUE *ep;			/* cfp[6] / block[1] */
-    rb_iseq_t *block_iseq;	/* cfp[7] / block[2] */
-    VALUE proc;			/* cfp[8] / block[3] */
-    const rb_method_entry_t *me;/* cfp[9] */
+    VALUE klass;		/* cfp[6] / block[1] */
+    VALUE *ep;			/* cfp[7] / block[2] */
+    rb_iseq_t *block_iseq;	/* cfp[8] / block[3] */
+    VALUE proc;			/* cfp[9] / block[4] */
+    const rb_method_entry_t *me;/* cfp[10] */
 } rb_control_frame_t;
 
 typedef struct rb_block_struct {
     VALUE self;			/* share with method frame if it's only block */
+    VALUE klass;		/* share with method frame if it's only block */
     VALUE *ep;			/* share with method frame if it's only block */
     rb_iseq_t *iseq;
     VALUE proc;
@@ -714,7 +719,8 @@
 void rb_vm_inc_const_missing_count(void);
 void rb_vm_gvl_destroy(rb_vm_t *vm);
 VALUE rb_vm_call(rb_thread_t *th, VALUE recv, VALUE id, int argc,
-                 const VALUE *argv, const rb_method_entry_t *me);
+		 const VALUE *argv, const rb_method_entry_t *me,
+		 VALUE defined_class);
 void rb_unlink_method_entry(rb_method_entry_t *me);
 void rb_gc_mark_unlinked_live_method_entries(void *pvm);
 
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 36594)
+++ vm_eval.c	(revision 36595)
@@ -33,11 +33,11 @@
 
 static inline VALUE
 vm_call0(rb_thread_t* th, VALUE recv, VALUE id, int argc, const VALUE *argv,
-	 const rb_method_entry_t *me)
+	 const rb_method_entry_t *me, VALUE defined_class)
 {
     const rb_method_definition_t *def = me->def;
     VALUE val;
-    VALUE klass = me->klass;
+    VALUE klass = defined_class;
     const rb_block_t *blockptr = 0;
 
     if (!def) return Qnil;
@@ -59,7 +59,8 @@
 	    *reg_cfp->sp++ = argv[i];
 	}
 
-	vm_setup_method(th, reg_cfp, recv, argc, blockptr, 0 /* flag */, me);
+	vm_setup_method(th, reg_cfp, recv, argc, blockptr, 0 /* flag */,
+			me, klass);
 	th->cfp->flag |= VM_FRAME_FLAG_FINISH;
 	val = vm_exec(th);
 	break;
@@ -71,7 +72,8 @@
 	    rb_control_frame_t *reg_cfp = th->cfp;
 	    rb_control_frame_t *cfp =
 		vm_push_frame(th, 0, VM_FRAME_MAGIC_CFUNC,
-			      recv, VM_ENVVAL_BLOCK_PTR(blockptr), 0, reg_cfp->sp, 1, me);
+			      recv, klass, VM_ENVVAL_BLOCK_PTR(blockptr),
+			      0, reg_cfp->sp, 1, me);
 
 	    cfp->me = me;
 	    val = call_cfunc(def->body.cfunc.func, recv, def->body.cfunc.argc, argc, argv);
@@ -95,12 +97,12 @@
 	break;
       }
       case VM_METHOD_TYPE_BMETHOD: {
-	val = vm_call_bmethod(th, recv, argc, argv, blockptr, me);
+	val = vm_call_bmethod(th, recv, argc, argv, blockptr, me, klass);
 	break;
       }
       case VM_METHOD_TYPE_ZSUPER: {
 	klass = RCLASS_SUPER(klass);
-	if (!klass || !(me = rb_method_entry(klass, id))) {
+	if (!klass || !(me = rb_method_entry(klass, id, &klass))) {
 	    return method_missing(recv, id, argc, argv, NOEX_SUPER);
 	}
 	RUBY_VM_CHECK_INTS(th);
@@ -144,9 +146,9 @@
 
 VALUE
 rb_vm_call(rb_thread_t *th, VALUE recv, VALUE id, int argc, const VALUE *argv,
-	   const rb_method_entry_t *me)
+	   const rb_method_entry_t *me, VALUE defined_class)
 {
-    return vm_call0(th, recv, id, argc, argv, me);
+    return vm_call0(th, recv, id, argc, argv, me, defined_class);
 }
 
 static inline VALUE
@@ -158,9 +160,8 @@
     rb_method_entry_t *me;
     rb_control_frame_t *cfp = th->cfp;
 
-    if (!cfp->iseq) {
-	klass = cfp->me->klass;
-	klass = RCLASS_SUPER(klass);
+    if (!cfp->iseq && !NIL_P(cfp->klass)) {
+	klass = RCLASS_SUPER(cfp->klass);
 
 	if (klass == 0) {
 	    klass = vm_search_normal_superclass(cfp->me->klass, recv);
@@ -171,12 +172,12 @@
 	rb_bug("vm_call_super: should not be reached");
     }
 
-    me = rb_method_entry(klass, id);
+    me = rb_method_entry(klass, id, &klass);
     if (!me) {
 	return method_missing(recv, id, argc, argv, NOEX_SUPER);
     }
 
-    return vm_call0(th, recv, id, argc, argv, me);
+    return vm_call0(th, recv, id, argc, argv, me, klass);
 }
 
 VALUE
@@ -197,7 +198,8 @@
     }
 }
 
-static inline rb_method_entry_t *rb_search_method_entry(VALUE recv, ID mid);
+static inline rb_method_entry_t *
+    rb_search_method_entry(VALUE recv, ID mid, VALUE *defined_class_ptr);
 static inline int rb_method_call_status(rb_thread_t *th, const rb_method_entry_t *me, call_type scope, VALUE self);
 #define NOEX_OK NOEX_NOSUPER
 
@@ -219,7 +221,8 @@
 rb_call0(VALUE recv, ID mid, int argc, const VALUE *argv,
 	 call_type scope, VALUE self)
 {
-    rb_method_entry_t *me = rb_search_method_entry(recv, mid);
+    VALUE defined_class;
+    rb_method_entry_t *me = rb_search_method_entry(recv, mid, &defined_class);
     rb_thread_t *th = GET_THREAD();
     int call_status = rb_method_call_status(th, me, scope, self);
 
@@ -227,7 +230,7 @@
 	return method_missing(recv, mid, argc, argv, call_status);
     }
     stack_check();
-    return vm_call0(th, recv, mid, argc, argv, me);
+    return vm_call0(th, recv, mid, argc, argv, me, defined_class);
 }
 
 struct rescue_funcall_args {
@@ -264,8 +267,9 @@
     const rb_method_entry_t *me;
     rb_thread_t *th = GET_THREAD();
     int call_status;
+    VALUE defined_class;
 
-    me = rb_method_entry(klass, idRespond_to);
+    me = rb_method_entry(klass, idRespond_to, &defined_class);
     if (me && !(me->flag & NOEX_BASIC)) {
 	VALUE args[2];
 	int arity = rb_method_entry_arity(me);
@@ -277,12 +281,13 @@
 
 	args[0] = ID2SYM(mid);
 	args[1] = Qtrue;
-	if (!RTEST(vm_call0(th, recv, idRespond_to, arity, args, me))) {
+	if (!RTEST(vm_call0(th, recv, idRespond_to, arity, args, me,
+			    defined_class))) {
 	    return Qundef;
 	}
     }
 
-    me = rb_search_method_entry(recv, mid);
+    me = rb_search_method_entry(recv, mid, &defined_class);
     call_status = rb_method_call_status(th, me, CALL_FCALL, Qundef);
     if (call_status != NOEX_OK) {
 	if (rb_method_basic_definition_p(klass, idMethodMissing)) {
@@ -302,7 +307,7 @@
 	}
     }
     stack_check();
-    return vm_call0(th, recv, mid, argc, argv, me);
+    return vm_call0(th, recv, mid, argc, argv, me, defined_class);
 }
 
 VALUE
@@ -347,7 +352,7 @@
 }
 
 static inline rb_method_entry_t *
-rb_search_method_entry(VALUE recv, ID mid)
+rb_search_method_entry(VALUE recv, ID mid, VALUE *defined_class_ptr)
 {
     VALUE klass = CLASS_OF(recv);
 
@@ -386,7 +391,7 @@
                          rb_id2name(mid), type, (void *)recv, flags, klass);
         }
     }
-    return rb_method_entry(klass, mid);
+    return rb_method_entry(klass, mid, defined_class_ptr);
 }
 
 static inline int
Index: proc.c
===================================================================
--- proc.c	(revision 36594)
+++ proc.c	(revision 36595)
@@ -17,6 +17,7 @@
 struct METHOD {
     VALUE recv;
     VALUE rclass;
+    VALUE defined_class;
     ID id;
     rb_method_entry_t *me;
     struct unlinked_method_entry_list_entry *ume;
@@ -889,6 +890,7 @@
 bm_mark(void *ptr)
 {
     struct METHOD *data = ptr;
+    rb_gc_mark(data->defined_class);
     rb_gc_mark(data->rclass);
     rb_gc_mark(data->recv);
     if (data->me) rb_mark_method_entry(data->me);
@@ -935,7 +937,7 @@
 mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
 {
     VALUE method;
-    VALUE rclass = klass;
+    VALUE rclass = klass, defined_class;
     ID rid = id;
     struct METHOD *data;
     rb_method_entry_t *me, meb;
@@ -943,7 +945,7 @@
     rb_method_flag_t flag = NOEX_UNDEF;
 
   again:
-    me = rb_method_entry(klass, id);
+    me = rb_method_entry(klass, id, &defined_class);
     if (UNDEFINED_METHOD_ENTRY_P(me)) {
 	ID rmiss = rb_intern("respond_to_missing?");
 	VALUE sym = ID2SYM(id);
@@ -985,12 +987,12 @@
 	}
     }
     if (def && def->type == VM_METHOD_TYPE_ZSUPER) {
-	klass = RCLASS_SUPER(me->klass);
+	klass = RCLASS_SUPER(defined_class);
 	id = def->original_id;
 	goto again;
     }
 
-    klass = me->klass;
+    klass = defined_class;
 
     while (rclass != klass &&
 	   (FL_TEST(rclass, FL_SINGLETON) || RB_TYPE_P(rclass, T_ICLASS))) {
@@ -1006,6 +1008,7 @@
 
     data->recv = obj;
     data->rclass = rclass;
+    data->defined_class = defined_class;
     data->id = rid;
     data->me = ALLOC(rb_method_entry_t);
     *data->me = *me;
@@ -1119,6 +1122,7 @@
     *data->me = *orig->me;
     if (orig->me->def) orig->me->def->alias_count++;
     data->rclass = orig->rclass;
+    data->defined_class = orig->defined_class;
     data->ume = ALLOC(struct unlinked_method_entry_list_entry);
     OBJ_INFECT(method, obj);
 
@@ -1394,6 +1398,7 @@
 	    proc->block.iseq->klass = mod;
 	    proc->is_lambda = TRUE;
 	    proc->is_from_method = TRUE;
+	    proc->block.klass = mod;
 	}
 	rb_add_method(mod, id, VM_METHOD_TYPE_BMETHOD, (void *)body, noex);
     }
@@ -1498,7 +1503,7 @@
 	rb_thread_t *th = GET_THREAD();
 
 	PASS_PASSED_BLOCK_TH(th);
-	result = rb_vm_call(th, data->recv, data->id,  argc, argv, data->me);
+	result = rb_vm_call(th, data->recv, data->id,  argc, argv, data->me, data->defined_class);
     }
     POP_TAG();
     if (safe >= 0)
@@ -1727,7 +1732,7 @@
 int
 rb_mod_method_arity(VALUE mod, ID id)
 {
-    rb_method_entry_t *me = rb_method_entry(mod, id);
+    rb_method_entry_t *me = rb_method_entry(mod, id, 0);
     return rb_method_entry_arity(me);
 }
 
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 36594)
+++ vm_method.c	(revision 36595)
@@ -22,6 +22,7 @@
     ID mid;			/* method's id */
     VALUE klass;		/* receiver's class */
     rb_method_entry_t *me;
+    VALUE defined_class;
 };
 
 static struct cache_entry cache[CACHE_SIZE];
@@ -373,7 +374,7 @@
 {
     rb_method_entry_t *me;
     Check_Type(klass, T_CLASS);
-    me = rb_method_entry(CLASS_OF(klass), ID_ALLOCATOR);
+    me = rb_method_entry(CLASS_OF(klass), ID_ALLOCATOR, 0);
 
     if (me && me->def && me->def->type == VM_METHOD_TYPE_CFUNC) {
 	return (rb_alloc_func_t)me->def->body.cfunc.func;
@@ -384,7 +385,7 @@
 }
 
 static rb_method_entry_t*
-search_method(VALUE klass, ID id)
+search_method(VALUE klass, ID id, VALUE *defined_class_ptr)
 {
     st_data_t body;
 
@@ -396,6 +397,8 @@
 	if (st_lookup(m_tbl, id, &body)) break;
     }
 
+    if (defined_class_ptr)
+	*defined_class_ptr = klass;
     return (rb_method_entry_t *)body;
 }
 
@@ -406,15 +409,18 @@
  * rb_method_entry() simply.
  */
 rb_method_entry_t *
-rb_method_entry_get_without_cache(VALUE klass, ID id)
+rb_method_entry_get_without_cache(VALUE klass, ID id,
+				  VALUE *defined_class_ptr)
 {
-    rb_method_entry_t *me = search_method(klass, id);
+    VALUE defined_class;
+    rb_method_entry_t *me = search_method(klass, id, &defined_class);
 
     if (ruby_running) {
 	struct cache_entry *ent;
 	ent = cache + EXPR1(klass, id);
 	ent->filled_version = GET_VM_STATE_VERSION();
 	ent->klass = klass;
+	ent->defined_class = defined_class;
 
 	if (UNDEFINED_METHOD_ENTRY_P(me)) {
 	    ent->mid = id;
@@ -427,21 +433,25 @@
 	}
     }
 
+    if (defined_class_ptr)
+	*defined_class_ptr = defined_class;
     return me;
 }
 
 rb_method_entry_t *
-rb_method_entry(VALUE klass, ID id)
+rb_method_entry(VALUE klass, ID id, VALUE *defined_class_ptr)
 {
     struct cache_entry *ent;
 
     ent = cache + EXPR1(klass, id);
     if (ent->filled_version == GET_VM_STATE_VERSION() &&
 	ent->mid == id && ent->klass == klass) {
+	if (defined_class_ptr)
+	    *defined_class_ptr = ent->defined_class;
 	return ent->me;
     }
 
-    return rb_method_entry_get_without_cache(klass, id);
+    return rb_method_entry_get_without_cache(klass, id, defined_class_ptr);
 }
 
 static void
@@ -534,14 +544,15 @@
 rb_export_method(VALUE klass, ID name, rb_method_flag_t noex)
 {
     rb_method_entry_t *me;
+    VALUE defined_class;
 
     if (klass == rb_cObject) {
 	rb_secure(4);
     }
 
-    me = search_method(klass, name);
+    me = search_method(klass, name, &defined_class);
     if (!me && RB_TYPE_P(klass, T_MODULE)) {
-	me = search_method(rb_cObject, name);
+	me = search_method(rb_cObject, name, &defined_class);
     }
 
     if (UNDEFINED_METHOD_ENTRY_P(me)) {
@@ -551,7 +562,7 @@
     if (me->flag != noex) {
 	rb_vm_check_redefinition_opt_method(me, klass);
 
-	if (klass == me->klass) {
+	if (klass == defined_class) {
 	    me->flag = noex;
 	}
 	else {
@@ -563,7 +574,7 @@
 int
 rb_method_boundp(VALUE klass, ID id, int ex)
 {
-    rb_method_entry_t *me = rb_method_entry(klass, id);
+    rb_method_entry_t *me = rb_method_entry(klass, id, 0);
 
     if (me != 0) {
 	if ((ex & ~NOEX_RESPONDS) &&
@@ -644,7 +655,7 @@
 	rb_warn("undefining `%s' may cause serious problems", rb_id2name(id));
     }
 
-    me = search_method(klass, id);
+    me = search_method(klass, id, 0);
 
     if (UNDEFINED_METHOD_ENTRY_P(me)) {
 	const char *s0 = " class";
@@ -773,7 +784,7 @@
     const rb_method_entry_t *me;
     ID id = rb_check_id(&mid);
     if (!id) return Qfalse;
-    me = rb_method_entry(mod, id);
+    me = rb_method_entry(mod, id, 0);
     if (me) {
 	if (VISI_CHECK(me->flag, noex))
 	    return Qtrue;
@@ -969,11 +980,12 @@
     }
 
   again:
-    orig_me = search_method(klass, def);
+    orig_me = search_method(klass, def, 0);
 
     if (UNDEFINED_METHOD_ENTRY_P(orig_me)) {
 	if ((!RB_TYPE_P(klass, T_MODULE)) ||
-	    (orig_me = search_method(rb_cObject, def), UNDEFINED_METHOD_ENTRY_P(orig_me))) {
+	    (orig_me = search_method(rb_cObject, def, 0),
+	     UNDEFINED_METHOD_ENTRY_P(orig_me))) {
 	    rb_print_undef(klass, def, 0);
 	}
     }
@@ -1248,9 +1260,9 @@
 
 	id = rb_to_id(argv[i]);
 	for (;;) {
-	    me = search_method(m, id);
+	    me = search_method(m, id, 0);
 	    if (me == 0) {
-		me = search_method(rb_cObject, id);
+		me = search_method(rb_cObject, id, 0);
 	    }
 	    if (UNDEFINED_METHOD_ENTRY_P(me)) {
 		rb_print_undef(module, id, 0);
@@ -1270,7 +1282,7 @@
 int
 rb_method_basic_definition_p(VALUE klass, ID id)
 {
-    const rb_method_entry_t *me = rb_method_entry(klass, id);
+    const rb_method_entry_t *me = rb_method_entry(klass, id, 0);
     if (me && (me->flag & NOEX_BASIC))
 	return 1;
     return 0;
@@ -1402,7 +1414,8 @@
 
     {
 #define REPLICATE_METHOD(klass, id, noex) \
-	rb_method_entry_set((klass), (id), rb_method_entry((klass), (id)), \
+	rb_method_entry_set((klass), (id), \
+			    rb_method_entry((klass), (id), 0), \
 			    (rb_method_flag_t)(noex | NOEX_BASIC | NOEX_NOREDEF))
 	REPLICATE_METHOD(rb_eException, idMethodMissing, NOEX_PRIVATE);
 	REPLICATE_METHOD(rb_eException, idRespond_to, NOEX_PUBLIC);
Index: class.c
===================================================================
--- class.c	(revision 36594)
+++ class.c	(revision 36595)
@@ -1444,7 +1444,7 @@
 int
 rb_obj_basic_to_s_p(VALUE obj)
 {
-    const rb_method_entry_t *me = rb_method_entry(CLASS_OF(obj), rb_intern("to_s"));
+    const rb_method_entry_t *me = rb_method_entry(CLASS_OF(obj), rb_intern("to_s"), 0);
     if (me && me->def && me->def->type == VM_METHOD_TYPE_CFUNC &&
 	me->def->body.cfunc.func == rb_any_to_s)
 	return 1;
Index: vm.c
===================================================================
--- vm.c	(revision 36594)
+++ vm.c	(revision 36595)
@@ -136,8 +136,8 @@
     /* for return */
     CHECK_STACK_OVERFLOW(th->cfp, iseq->local_size + iseq->st (... truncated)

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

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