aboutsummaryrefslogtreecommitdiffstats
path: root/vm_eval.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-02 04:20:30 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-02 04:20:30 +0000
commitdc61ecce09ac75e0dcc336b31b4deb544d3598b1 (patch)
tree4eb5c4ef7ac97b4da216c22bcc1defa67942388f /vm_eval.c
parentbfb7e27fe2b73e054d0382990ceef7189de71d28 (diff)
downloadruby-dc61ecce09ac75e0dcc336b31b4deb544d3598b1.tar.gz
* method.h: make rb_method_entry_t a VALUE.
Motivation and new data structure are described in [Bug #11203]. This patch also solve the following issues. * [Bug #11200] Memory leak of method entries * [Bug #11046] __callee__ returns incorrect method name in orphan proc * test/ruby/test_method.rb: add a test for [Bug #11046]. * vm_core.h: remvoe rb_control_frame_t::me. me is located at value stack. * vm_core.h, gc.c, vm_method.c: remove unlinked_method... codes because method entries are simple VALUEs. * method.h: Now, all method entries has own independent method definititons. Strictly speaking, this change is not essential, but for future changes. * rb_method_entry_t::flag is move to rb_method_definition_t::flag. * rb_method_definition_t::alias_count is now rb_method_definition_t::alias_count_ptr, a pointer to the counter. * vm_core.h, vm_insnhelper.c (rb_vm_frame_method_entry) added to search the current method entry from value stack. * vm_insnhelper.c (VM_CHECK_MODE): introduced to enable/disable assertions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 9f046af2b8..1de398bae3 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -120,8 +120,8 @@ vm_call0_cfunc_with_frame(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv
rb_control_frame_t *reg_cfp = th->cfp;
vm_push_frame(th, 0, VM_FRAME_MAGIC_CFUNC, recv, defined_class,
- VM_ENVVAL_BLOCK_PTR(blockptr), NULL /* cref */,
- 0, reg_cfp->sp, 1, me, 0);
+ VM_ENVVAL_BLOCK_PTR(blockptr), (VALUE)me,
+ 0, reg_cfp->sp, 1, 0);
if (len >= 0) rb_check_arity(argc, len, len);
@@ -200,8 +200,7 @@ vm_call0_body(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv)
case VM_METHOD_TYPE_REFINED:
{
const rb_method_type_t type = ci->me->def->type;
- if (type == VM_METHOD_TYPE_REFINED &&
- ci->me->def->body.orig_me) {
+ if (type == VM_METHOD_TYPE_REFINED && ci->me->def->body.orig_me) {
ci->me = ci->me->def->body.orig_me;
goto again;
}
@@ -283,7 +282,7 @@ vm_call_super(rb_thread_t *th, int argc, const VALUE *argv)
klass = RCLASS_ORIGIN(cfp->klass);
klass = RCLASS_SUPER(klass);
- id = cfp->me->def->original_id;
+ id = rb_vm_frame_method_entry(cfp)->def->original_id;
me = rb_method_entry(klass, id, &klass);
if (!me) {
return method_missing(recv, id, argc, argv, NOEX_SUPER);
@@ -392,7 +391,7 @@ check_funcall_respond_to(rb_thread_t *th, VALUE klass, VALUE recv, ID mid)
VALUE defined_class;
const rb_method_entry_t *me = rb_method_entry(klass, idRespond_to, &defined_class);
- if (me && !(me->flag & NOEX_BASIC)) {
+ if (me && !(me->def->flag & NOEX_BASIC)) {
const rb_block_t *passed_block = th->passed_block;
VALUE args[2], result;
int arity = rb_method_entry_arity(me);
@@ -575,7 +574,7 @@ rb_method_call_status(rb_thread_t *th, const rb_method_entry_t *me, call_type sc
}
klass = me->klass;
oid = me->def->original_id;
- noex = me->flag;
+ noex = me->def->flag;
if (oid != idMethodMissing) {
/* receiver specified form for private method */