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 --- vm_core.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'vm_core.h') diff --git a/vm_core.h b/vm_core.h index b806ce6b6d..d1f71c4061 100644 --- a/vm_core.h +++ b/vm_core.h @@ -440,8 +440,6 @@ typedef struct rb_vm_struct { VALUE verbose, debug, orig_progname, progname; VALUE coverages; - struct unlinked_method_entry_list_entry *unlinked_method_entry_list; - VALUE defined_module_hash; #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE @@ -513,10 +511,9 @@ typedef struct rb_control_frame_struct { VALUE *ep; /* cfp[6] / block[2] */ rb_iseq_t *block_iseq; /* cfp[7] / block[3] */ VALUE proc; /* cfp[8] / block[4] */ - const rb_method_entry_t *me;/* cfp[9] */ #if VM_DEBUG_BP_CHECK - VALUE *bp_check; /* cfp[10] */ + VALUE *bp_check; /* cfp[9] */ #endif } rb_control_frame_t; @@ -954,7 +951,6 @@ void rb_vm_gvl_destroy(rb_vm_t *vm); VALUE rb_vm_call(rb_thread_t *th, VALUE recv, VALUE id, int argc, const VALUE *argv, const rb_method_entry_t *me, VALUE defined_class); -void rb_gc_mark_unlinked_live_method_entries(void *pvm); void rb_thread_start_timer_thread(void); void rb_thread_stop_timer_thread(int); @@ -1001,6 +997,8 @@ int rb_autoloading_value(VALUE mod, ID id, VALUE* value); void rb_vm_rewrite_cref_stack(rb_cref_t *node, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr); +const rb_method_entry_t *rb_vm_frame_method_entry(const rb_control_frame_t *cfp); + #define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack] #define RUBY_CONST_ASSERT(expr) (1/!!(expr)) /* expr must be a compile-time constant */ -- cgit v1.2.3