diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-06 18:44:54 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-06 18:44:54 +0000 |
commit | 02d5868962417298cf041ce723d406e16a635693 () | |
tree | 1dc5d1ed654f5c84a78f4941eda131968260c6ca /vm_backtrace.c | |
parent | 202643de00ee1a241aa4c082e74967eda02c4ebb (diff) |
* 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
-rw-r--r-- | vm_backtrace.c | 81 |
1 files changed, 68 insertions, 13 deletions
@@ -9,6 +9,8 @@ **********************************************************************/ #include "internal.h" #include "ruby/debug.h" @@ -1248,15 +1250,24 @@ rb_profile_frames(int start, int limit, VALUE *buff, int *lines) rb_control_frame_t *cfp = th->cfp, *end_cfp = RUBY_VM_END_CONTROL_FRAME(th); for (i=0; i<limit && cfp != end_cfp;) { - if (cfp->iseq && cfp->pc) { /* should be NORMAL_ISEQ */ if (start > 0) { start--; continue; } /* record frame info */ - buff[i] = cfp->iseq->self; - if (lines) lines[i] = calc_lineno(cfp->iseq, cfp->pc); i++; } cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); @@ -1265,42 +1276,83 @@ rb_profile_frames(int start, int limit, VALUE *buff, int *lines) return i; } -#define frame2iseq(frame) frame VALUE rb_profile_frame_path(VALUE frame) { - return rb_iseq_path(frame2iseq(frame)); } VALUE rb_profile_frame_absolute_path(VALUE frame) { - return rb_iseq_absolute_path(frame2iseq(frame)); } VALUE rb_profile_frame_label(VALUE frame) { - return rb_iseq_label(frame2iseq(frame)); } VALUE rb_profile_frame_base_label(VALUE frame) { - return rb_iseq_base_label(frame2iseq(frame)); } VALUE rb_profile_frame_first_lineno(VALUE frame) { - return rb_iseq_first_lineno(frame2iseq(frame)); } VALUE rb_profile_frame_classpath(VALUE frame) { - VALUE klass = rb_iseq_klass(frame2iseq(frame)); if (klass && !NIL_P(klass)) { if (RB_TYPE_P(klass, T_ICLASS)) { @@ -1321,7 +1373,8 @@ rb_profile_frame_classpath(VALUE frame) VALUE rb_profile_frame_singleton_method_p(VALUE frame) { - VALUE klass = rb_iseq_klass(frame2iseq(frame)); if (klass && !NIL_P(klass) && FL_TEST(klass, FL_SINGLETON)) { return Qtrue; } @@ -1333,13 +1386,15 @@ rb_profile_frame_singleton_method_p(VALUE frame) VALUE rb_profile_frame_method_name(VALUE frame) { - return rb_iseq_method_name(frame2iseq(frame)); } VALUE rb_profile_frame_qualified_method_name(VALUE frame) { - VALUE method_name = rb_iseq_method_name(frame2iseq(frame)); if (method_name != Qnil) { VALUE classpath = rb_profile_frame_classpath(frame); VALUE singleton_p = rb_profile_frame_singleton_method_p(frame); |