From 57b817f4c550e54ff57642b50723cc7c92bdd2fe Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 2 Jun 2015 04:20:30 +0000 Subject: * 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 --- insns.def | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'insns.def') diff --git a/insns.def b/insns.def index 7cfd2ee521..74762e7644 100644 --- a/insns.def +++ b/insns.def @@ -760,8 +760,9 @@ defined const rb_method_entry_t *me = rb_method_entry(klass, SYM2ID(obj), 0); if (me) { - if (!(me->flag & NOEX_PRIVATE)) { - if (!((me->flag & NOEX_PROTECTED) && + const rb_method_definition_t *def = me->def; + if (!(def->flag & NOEX_PRIVATE)) { + if (!((def->flag & NOEX_PROTECTED) && !rb_obj_is_kind_of(GET_SELF(), rb_class_real(klass)))) { expr_type = DEFINED_METHOD; @@ -1015,9 +1016,9 @@ defineclass vm_push_frame(th, class_iseq, VM_FRAME_MAGIC_CLASS, klass, 0, VM_ENVVAL_BLOCK_PTR(GET_BLOCK_PTR()), - vm_cref_push(th, klass, NOEX_PUBLIC, NULL), + (VALUE)vm_cref_push(th, klass, NOEX_PUBLIC, NULL), class_iseq->iseq_encoded, GET_SP(), - class_iseq->local_size, 0, class_iseq->stack_max); + class_iseq->local_size, class_iseq->stack_max); RESTORE_REGS(); NEXT_INSN(); -- cgit v1.2.3