summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-11 08:42:13 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-11 08:42:13 +0000
commit577eaa60a705efd018a94ec5e752fb77626dba72 (patch)
treeb4edc75a68ef3733d7eb6107e8dae803dcd2f141 /vm.c
parentc5335ee110cfab1179018f6b0dbd504742017a4e (diff)
* insnhelper.ci (vm_call_method): pass mn->nd_clss to
vm_call_cfunc() instead of klass. * vm.c (rb_thread_method_id_and_klass): traverse parent_iseq. * thread.c (call_trace_proc): use rb_thread_method_id_and_klass(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/vm.c b/vm.c
index 46e711d9b6..4c298c327a 100644
--- a/vm.c
+++ b/vm.c
@@ -1378,21 +1378,28 @@ int
rb_thread_method_id_and_klass(rb_thread_t *th, ID *idp, VALUE *klassp)
{
rb_control_frame_t *cfp = th->cfp;
-
- if (cfp->iseq) {
- if (cfp->pc != 0) {
- rb_iseq_t *iseq = cfp->iseq->local_iseq;
- if (idp) *idp = rb_intern(RSTRING_PTR(iseq->name));
- if (klassp) *klassp = iseq->klass;
- return 1;
- }
- }
- else {
+ rb_iseq_t *iseq = cfp->iseq;
+ if (!iseq) {
if (idp) *idp = cfp->method_id;
if (klassp) *klassp = cfp->method_klass;
return 1;
}
- *idp = *klassp = 0;
+ while (iseq) {
+ if (RUBY_VM_IFUNC_P(iseq)) {
+ if (idp) *idp = rb_intern("<ifunc>");
+ if (klassp) *klassp = 0;
+ return 1;
+ }
+ if (iseq->defined_method_id) {
+ if (idp) *idp = iseq->defined_method_id;
+ if (klassp) *klassp = iseq->klass;
+ return 1;
+ }
+ if (iseq->local_iseq == iseq) {
+ break;
+ }
+ iseq = iseq->parent_iseq;
+ }
return 0;
}