aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-06 18:44:54 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-06 18:44:54 +0000
commit02d5868962417298cf041ce723d406e16a635693 (patch)
tree1dc5d1ed654f5c84a78f4941eda131968260c6ca /vm_insnhelper.c
parent202643de00ee1a241aa4c082e74967eda02c4ebb (diff)
downloadruby-02d5868962417298cf041ce723d406e16a635693.tar.gz
* vm_core.h: remove rb_iseq_t::klass to reduce dynamic data.
* internal.h, iseq.c (rb_iseq_klass): remove it because rb_iseq_t::klass is removed. * vm_insnhelper.c (vm_super_outside): do not see cfp->iseq, but check callable method entry on a frame. This fix simplify the logic to search super class. * test/ruby/test_method.rb: support super() from Proc. Now, [Bug #4881] and [Bug #3136] was solved. * proc.c (rb_mod_define_method): catch up this change. * vm.c (vm_define_method): ditto. * vm_backtrace.c (rb_profile_frames): now, each `frame' objects are rb_callable_method_entry_t data or iseq VALUEs. This fix introduce minor compatibility issue that rb_profile_frame_label() always returns rb_profile_frame_base_label(). * test/-ext-/debug/test_profile_frames.rb: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c51
1 files changed, 6 insertions, 45 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 2c6e76ce6e..864a3dabc5 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2173,58 +2173,19 @@ vm_super_outside(void)
static int
vm_search_superclass(rb_control_frame_t *reg_cfp, rb_iseq_t *iseq, VALUE sigval, rb_call_info_t *ci)
{
- const rb_callable_method_entry_t *me;
-
- while (iseq && !iseq->klass) {
- iseq = iseq->parent_iseq;
- }
+ const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(reg_cfp);
- if (iseq == 0) {
+ if (me == NULL) {
return -1;
}
-
- ci->mid = iseq->defined_method_id;
-
- if (iseq != iseq->local_iseq) {
- /* defined by Module#define_method() */
- rb_control_frame_t *lcfp = GET_CFP();
-
- if (!sigval) {
- /* zsuper */
- return -2;
- }
-
- while (lcfp->iseq != iseq) {
- rb_thread_t *th = GET_THREAD();
- VALUE *tep = VM_EP_PREV_EP(lcfp->ep);
- while (1) {
- lcfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(lcfp);
- if (RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, lcfp)) {
- return -1;
- }
- if (lcfp->ep == tep) {
- break;
- }
- }
- }
-
- me = rb_vm_frame_method_entry(lcfp);
-
- /* temporary measure for [Bug #2420] [Bug #3136] */
- if (!me) {
- fprintf(stderr, "kore?\n");
- return -1;
- }
-
- ci->mid = me->def->original_id;
- ci->klass = vm_search_normal_superclass(me->defined_class);
+ else if (me->def->type == VM_METHOD_TYPE_BMETHOD && !sigval) {
+ return -2;
}
else {
- me = rb_vm_frame_method_entry(reg_cfp);
+ ci->mid = me->def->original_id;
ci->klass = vm_search_normal_superclass(me->defined_class);
+ return 0;
}
-
- return 0;
}
static void