1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vm_insnhelper.c: no recv

* vm_insnhelper.c (vm_search_normal_superclass): no longer needs
  receiver, klass is always unique in the ancestors now.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-08-03 16:56:08 +00:00
parent e421410edc
commit 260d02d91d
4 changed files with 14 additions and 26 deletions

View file

@ -1,3 +1,8 @@
Sat Aug 4 01:56:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@ruby-lang.org>
* insns.def (invokesuper): reverted r36612 so that super in an

View file

@ -828,7 +828,7 @@ defined
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 @@ invokesuper
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) {

View file

@ -164,7 +164,7 @@ vm_call_super(rb_thread_t *th, int argc, const VALUE *argv)
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;
}

View file

@ -1461,32 +1461,15 @@ vm_method_search(VALUE id, VALUE klass, IC ic, VALUE *defined_class_ptr)
}
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 @@ vm_search_superclass(rb_control_frame_t *reg_cfp, rb_iseq_t *iseq,
}
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;