From 74b85189b8fd792b98642859639afc5f74a8bb51 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 29 Aug 2013 08:03:23 +0000 Subject: vm_insnhelper.c: fix zsuper in prepended * vm_insnhelper.c (vm_call_method): a method entry refers the based class/module, so should search superclass from the origin i-class where the entry belongs to, to get rid of infinite loop when zsuper in a prepended class/module. [ruby-core:54105] [Bug #8238] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_insnhelper.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'vm_insnhelper.c') diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 761c830235..f196e5dc2d 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1769,6 +1769,8 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) start_method_dispatch: if (ci->me != 0) { if ((ci->me->flag == 0)) { + VALUE klass; + normal_method_dispatch: switch (ci->me->def->type) { case VM_METHOD_TYPE_ISEQ:{ @@ -1801,10 +1803,10 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) return vm_call_bmethod(th, cfp, ci); } case VM_METHOD_TYPE_ZSUPER:{ - VALUE klass; - + klass = ci->me->klass; + klass = RCLASS_ORIGIN(klass); zsuper_method_dispatch: - klass = RCLASS_SUPER(ci->me->klass); + klass = RCLASS_SUPER(klass); ci_temp = *ci; ci = &ci_temp; @@ -1866,6 +1868,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) goto normal_method_dispatch; } else { + klass = ci->me->klass; goto zsuper_method_dispatch; } } -- cgit v1.2.3