aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-06 19:08:05 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-06 19:08:05 +0000
commit447a412c3da550d174df583e037244bb87acc91a (patch)
treef12c1173d913215a15c522c1949ac131dfda4232 /eval.c
parent6534fa992c94f689614198e4a079a08fc480a7e6 (diff)
downloadruby-447a412c3da550d174df583e037244bb87acc91a.tar.gz
* vm_core.h: remove rb_iseq_t::defined_method_id because it is not
needed. * eval.c (frame_func_id): simplify. rb_callable_method_entry_t has enough information. * eval.c (frame_called_id): ditto. * iseq.c (prepare_iseq_build): catch up this fix. * proc.c (rb_mod_define_method): ditto. * vm.c (vm_define_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c58
1 files changed, 4 insertions, 54 deletions
diff --git a/eval.c b/eval.c
index 3462a802d4..e50bc256ab 100644
--- a/eval.c
+++ b/eval.c
@@ -922,80 +922,30 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE
return result;
}
-static const rb_callable_method_entry_t *
-method_entry_of_iseq(const rb_control_frame_t *cfp, const rb_iseq_t *iseq)
-{
- rb_thread_t *th = GET_THREAD();
- const rb_control_frame_t *cfp_limit;
-
- cfp_limit = (rb_control_frame_t *)(th->stack + th->stack_size);
- while (cfp_limit > cfp) {
- if (cfp->iseq == iseq) return rb_vm_frame_method_entry(cfp); /* TODO: fix me */
- cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
- }
- return 0;
-}
-
static ID
frame_func_id(rb_control_frame_t *cfp)
{
- const rb_iseq_t *iseq = cfp->iseq;
- const rb_callable_method_entry_t *me_local;
const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(cfp);
if (me) {
return me->def->original_id;
}
- while (iseq) {
- if (RUBY_VM_IFUNC_P(iseq)) {
- const struct vm_ifunc *ifunc = (struct vm_ifunc *)iseq;
- if (ifunc->id) return ifunc->id;
- return idIFUNC;
- }
- me_local = method_entry_of_iseq(cfp, iseq);
- if (me_local) {
- return me_local->def->original_id;
- }
- if (iseq->defined_method_id) {
- return iseq->defined_method_id;
- }
- if (iseq->local_iseq == iseq) {
- break;
- }
- iseq = iseq->parent_iseq;
+ else {
+ return 0;
}
- return 0;
}
static ID
frame_called_id(rb_control_frame_t *cfp)
{
- const rb_iseq_t *iseq = cfp->iseq;
- const rb_callable_method_entry_t *me_local;
const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(cfp);
if (me) {
return me->called_id;
}
- while (iseq) {
- if (RUBY_VM_IFUNC_P(iseq)) {
- const struct vm_ifunc *ifunc = (struct vm_ifunc *)iseq;
- if (ifunc->id) return ifunc->id;
- return idIFUNC;
- }
- me_local = method_entry_of_iseq(cfp, iseq);
- if (me_local) {
- return me_local->called_id;
- }
- if (iseq->defined_method_id) {
- return iseq->defined_method_id;
- }
- if (iseq->local_iseq == iseq) {
- break;
- }
- iseq = iseq->parent_iseq;
+ else {
+ return 0;
}
- return 0;
}
ID