From bd78983475c06ed29711433a349a05482081cc34 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 28 Aug 2009 02:45:41 +0000 Subject: * method.h (rb_method_definition_t): split from rb_method_entry_t to deal aliases. [ruby-dev:39165] * proc.c (struct METHOD): contains rb_method_entry_t copy. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_insnhelper.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'vm_insnhelper.c') diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 5da3f1783..117bf9579 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -361,15 +361,14 @@ vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, { VALUE val = 0; int state = 0; + const rb_method_definition_t *def = me->def; VALUE klass = me->klass; ID id = me->called_id; EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, id, klass); TH_PUSH_TAG(th); -#if defined(__cplusplus) || (__STDC_VERSION__ >= 199901L) - // TODO: fix me. separate event -#endif + /* TODO: fix me. separate event */ if (th->event_flags & (RUBY_EVENT_C_RETURN | RUBY_EVENT_VM)) { state = TH_EXEC_TAG(); } @@ -384,7 +383,7 @@ vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, cfp->me = me; reg_cfp->sp -= num + 1; - val = call_cfunc(me->body.cfunc.func, recv, (int)me->body.cfunc.argc, num, reg_cfp->sp + 1); + val = call_cfunc(def->body.cfunc.func, recv, (int)def->body.cfunc.argc, num, reg_cfp->sp + 1); if (reg_cfp != th->cfp + 1) { rb_bug("cfp consistency error - send"); @@ -410,7 +409,7 @@ vm_call_bmethod(rb_thread_t *th, VALUE recv, int argc, const VALUE *argv, /* control block frame */ (cfp-2)->me = me; - GetProcPtr(me->body.proc, proc); + GetProcPtr(me->def->body.proc, proc); val = rb_vm_invoke_proc(th, proc, recv, argc, argv, blockptr); return val; } @@ -443,7 +442,7 @@ vm_setup_method(rb_thread_t *th, rb_control_frame_t *cfp, { int opt_pc, i; VALUE *sp, *rsp = cfp->sp - argc; - rb_iseq_t *iseq = me->body.iseq; + rb_iseq_t *iseq = me->def->body.iseq; VM_CALLEE_SETUP_ARG(opt_pc, th, iseq, argc, rsp, &blockptr); @@ -502,7 +501,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, if (me != 0) { if ((me->flag == 0)) { normal_method_dispatch: - switch (me->type) { + switch (me->def->type) { case VM_METHOD_TYPE_ISEQ:{ vm_setup_method(th, cfp, recv, num, blockptr, flag, me); return Qundef; @@ -516,7 +515,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, if (num != 1) { rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", num); } - val = rb_ivar_set(recv, me->body.attr_id, *(cfp->sp - 1)); + val = rb_ivar_set(recv, me->def->body.attr_id, *(cfp->sp - 1)); cfp->sp -= 2; break; } @@ -524,7 +523,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, if (num != 0) { rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", num); } - val = rb_attr_get(recv, me->body.attr_id); + val = rb_attr_get(recv, me->def->body.attr_id); cfp->sp -= 1; break; } @@ -547,7 +546,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, } } case VM_METHOD_TYPE_OPTIMIZED:{ - switch (me->body.optimize_type) { + switch (me->def->body.optimize_type) { case OPTIMIZED_METHOD_TYPE_SEND: { rb_control_frame_t *reg_cfp = cfp; rb_num_t i = num - 1; @@ -583,12 +582,12 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, } default: rb_bug("eval_invoke_method: unsupported optimized method type (%d)", - me->body.optimize_type); + me->def->body.optimize_type); } break; } default:{ - rb_bug("eval_invoke_method: unsupported method type (%d)", me->type); + rb_bug("eval_invoke_method: unsupported method type (%d)", me->def->type); break; } } @@ -1309,7 +1308,7 @@ vm_search_superclass(rb_control_frame_t *reg_cfp, rb_iseq_t *ip, } } - id = lcfp->me->original_id; + id = lcfp->me->def->original_id; klass = vm_search_normal_superclass(lcfp->me->klass, recv); } else { @@ -1531,8 +1530,8 @@ vm_expandarray(rb_control_frame_t *cfp, VALUE ary, rb_num_t num, int flag) static inline int check_cfunc(const rb_method_entry_t *me, VALUE (*func)()) { - if (me && me->type == VM_METHOD_TYPE_CFUNC && - me->body.cfunc.func == func) { + if (me && me->def->type == VM_METHOD_TYPE_CFUNC && + me->def->body.cfunc.func == func) { return 1; } else { -- cgit