diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-24 04:36:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-24 04:36:00 +0000 |
commit | ac94eb1a9116858396998b4b93122bef942f5378 (patch) | |
tree | 591ad16f4fc583792462899d0e9bd482fa086d52 /vm_insnhelper.c | |
parent | bd88e6c0b5f01ebdd2d758bd86845eb44605d4f0 (diff) | |
download | ruby-ac94eb1a9116858396998b4b93122bef942f5378.tar.gz |
vm_insnhelper.c: compare with me in method top cfp
* vm_insnhelper.c (vm_call_method): block level control frame does not
have method entry, so obtain the method entry from method top-level
control frame to be compared with refined method entry.
[ruby-core:52750] [Bug #7925]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 636cd39c2c..0c447aaeda 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1675,6 +1675,24 @@ find_refinement(VALUE refinements, VALUE klass) static int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2); static VALUE vm_call_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_t *ci); +static rb_control_frame_t * +current_method_entry(rb_thread_t *th, rb_control_frame_t *cfp) +{ + rb_control_frame_t *top_cfp = cfp; + + if (cfp->iseq && cfp->iseq->type == ISEQ_TYPE_BLOCK) { + rb_iseq_t *local_iseq = cfp->iseq->local_iseq; + do { + cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); + if (RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) { + /* TODO: orphan block */ + return top_cfp; + } + } while (cfp->iseq != local_iseq); + } + return cfp; +} + static #ifdef _MSC_VER __forceinline @@ -1767,10 +1785,12 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) } me = rb_method_entry(refinement, ci->mid, &defined_class); if (me) { - if (ci->call == vm_call_super_method && - cfp->me && - rb_method_definition_eq(me->def, cfp->me->def)) { - goto no_refinement_dispatch; + if (ci->call == vm_call_super_method) { + rb_control_frame_t *top_cfp = current_method_entry(th, cfp); + if (top_cfp->me && + rb_method_definition_eq(me->def, top_cfp->me->def)) { + goto no_refinement_dispatch; + } } ci->me = me; ci->defined_class = defined_class; |