1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vm_insnhelper.c: debugging

* vm_insnhelper.c (vm_method_cfunc_entry): check method type if
  debugging.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-09-09 05:17:19 +00:00
parent c2b4d38165
commit f3c33344a4

View file

@ -1478,12 +1478,39 @@ vm_profile_show_result(void)
#define VM_PROFILE_ATEXIT()
#endif
static inline
const rb_method_cfunc_t *
vm_method_cfunc_entry(const rb_method_entry_t *me)
{
#if VM_DEBUG_VERIFY_METHOD_CACHE
switch (me->def->type) {
case VM_METHOD_TYPE_CFUNC:
case VM_METHOD_TYPE_NOTIMPLEMENTED:
break;
# define METHOD_BUG(t) case VM_METHOD_TYPE_##t: rb_bug("wrong method type: " #t)
METHOD_BUG(ISEQ);
METHOD_BUG(ATTRSET);
METHOD_BUG(IVAR);
METHOD_BUG(BMETHOD);
METHOD_BUG(ZSUPER);
METHOD_BUG(UNDEF);
METHOD_BUG(OPTIMIZED);
METHOD_BUG(MISSING);
METHOD_BUG(REFINED);
# undef METHOD_BUG
default:
rb_bug("wrong method type: %d", me->def->type);
}
#endif
return &me->def->body.cfunc;
}
static VALUE
vm_call_cfunc_with_frame(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_t *ci)
{
VALUE val;
const rb_method_entry_t *me = ci->me;
const rb_method_cfunc_t *cfunc = &me->def->body.cfunc;
const rb_method_cfunc_t *cfunc = vm_method_cfunc_entry(me);
int len = cfunc->argc;
/* don't use `ci' after EXEC_EVENT_HOOK because ci can be override */
@ -1523,7 +1550,7 @@ vm_call_cfunc_latter(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_
VALUE val;
int argc = ci->argc;
VALUE *argv = STACK_ADDR_FROM_TOP(argc);
const rb_method_cfunc_t *cfunc = &ci->me->def->body.cfunc;
const rb_method_cfunc_t *cfunc = vm_method_cfunc_entry(ci->me);
th->passed_ci = ci;
reg_cfp->sp -= argc + 1;
@ -1554,7 +1581,7 @@ vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_t *ci)
{
VALUE val;
const rb_method_entry_t *me = ci->me;
int len = me->def->body.cfunc.argc;
int len = vm_method_cfunc_entry(me)->argc;
VALUE recv = ci->recv;
if (len >= 0) rb_check_arity(ci->argc, len, len);