ruby-changes:24565
From: nobu <ko1@a...>
Date: Sat, 4 Aug 2012 01:56:35 +0900 (JST)
Subject: [ruby-changes:24565] nobu:r36616 (trunk): vm_insnhelper.c: no recv
nobu 2012-08-04 01:56:08 +0900 (Sat, 04 Aug 2012) New Revision: 36616 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36616 Log: vm_insnhelper.c: no recv * vm_insnhelper.c (vm_search_normal_superclass): no longer needs receiver, klass is always unique in the ancestors now. Modified files: trunk/ChangeLog trunk/insns.def trunk/vm_eval.c trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 36615) +++ ChangeLog (revision 36616) @@ -1,3 +1,8 @@ +Sat Aug 4 01:56:06 2012 Nobuyoshi Nakada <nobu@r...> + + * vm_insnhelper.c (vm_search_normal_superclass): no longer needs + receiver, klass is always unique in the ancestors now. + Sat Aug 4 01:27:40 2012 Shugo Maeda <shugo@r...> * insns.def (invokesuper): reverted r36612 so that super in an Index: insns.def =================================================================== --- insns.def (revision 36615) +++ insns.def (revision 36616) @@ -828,7 +828,7 @@ case DEFINED_ZSUPER:{ const rb_method_entry_t *me = GET_CFP()->me; if (me) { - VALUE klass = vm_search_normal_superclass(me->klass, GET_SELF()); + VALUE klass = vm_search_normal_superclass(me->klass); ID id = me->def ? me->def->original_id : me->called_id; if (rb_method_boundp(klass, id, 0)) { expr_type = "super"; @@ -1039,7 +1039,7 @@ flag = VM_CALL_SUPER_BIT | VM_CALL_FCALL_BIT; recv = GET_SELF(); - vm_search_superclass(GET_CFP(), GET_ISEQ(), recv, TOPN(num), &id, &klass); + vm_search_superclass(GET_CFP(), GET_ISEQ(), TOPN(num), &id, &klass); ip = GET_ISEQ(); while (ip && !ip->klass) { Index: vm_eval.c =================================================================== --- vm_eval.c (revision 36615) +++ vm_eval.c (revision 36616) @@ -164,7 +164,7 @@ klass = RCLASS_SUPER(cfp->klass); if (klass == 0) { - klass = vm_search_normal_superclass(cfp->me->klass, recv); + klass = vm_search_normal_superclass(cfp->me->klass); } id = cfp->me->def->original_id; } Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 36615) +++ vm_insnhelper.c (revision 36616) @@ -1461,32 +1461,15 @@ } static inline VALUE -vm_search_normal_superclass(VALUE klass, VALUE recv) +vm_search_normal_superclass(VALUE klass) { - if (BUILTIN_TYPE(klass) == T_CLASS || BUILTIN_TYPE(klass) == T_ICLASS) { - klass = RCLASS_ORIGIN(klass); - return RCLASS_SUPER(klass); - } - else if (BUILTIN_TYPE(klass) == T_MODULE) { - VALUE k = CLASS_OF(recv); - while (k) { - if (BUILTIN_TYPE(k) == T_ICLASS && RBASIC(k)->klass == klass) { - return RCLASS_SUPER(k); - } - k = RCLASS_SUPER(k); - } - return rb_cObject; - } - else { - rb_bug("vm_search_normal_superclass: should not be reach here"); - } - - UNREACHABLE; + klass = RCLASS_ORIGIN(klass); + return RCLASS_SUPER(klass); } static void vm_search_superclass(rb_control_frame_t *reg_cfp, rb_iseq_t *iseq, - VALUE recv, VALUE sigval, + VALUE sigval, ID *idp, VALUE *klassp) { ID id; @@ -1532,10 +1515,10 @@ } id = lcfp->me->def->original_id; - klass = vm_search_normal_superclass(lcfp->klass, recv); + klass = vm_search_normal_superclass(lcfp->klass); } else { - klass = vm_search_normal_superclass(reg_cfp->klass, recv); + klass = vm_search_normal_superclass(reg_cfp->klass); } *idp = id; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/