aboutsummaryrefslogtreecommitdiffstats
path: root/proc.c
Commit message (Collapse)AuthorAgeFilesLines
* proc.c: fail symbol proc bindingnobu2016-03-161-0/+2
| | | | | | | * proc.c (proc_binding): proc from symbol can not make a binding. [ruby-core:74100] [Bug #12137] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add example for Method#parameters from [ruby-core:19759]naruse2016-02-091-0/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use `rb_method_visibility_t` instead of `int` in `rb_print_undef`yui-knk2016-01-031-1/+1
| | | | | | | | | | | * eval_error.c (rb_print_undef): Use `rb_method_visibility_t` instead of `int`. * eval_intern.h (rb_print_undef): ditto * proc.c (mnew_internal): ditto * vm_method.c (rb_export_method): ditto [Misc #11649] [ruby-core:71311] [fix GH-1078] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (rb_mod_define_method): should check Symbol or not.ko12015-12-201-1/+6
| | | | | | | | | | | [Bug #11850] * test/ruby/test_method.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (rb_mod_define_method): fix notation.ko12015-12-201-2/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (proc_new): fix notation.ko12015-12-201-3/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: fix infinite loopnobu2015-12-191-3/+1
| | | | | | | * proc.c (rb_proc_get_iseq): proc made from symbol does not have iseq. fix infinite loop. [ruby-core:72381] [Bug #11845] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix commit missnobu2015-12-191-3/+3
| | | | | | * proc.c: fix expanded name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: remove old macronobu2015-12-191-5/+3
| | | | | | * proc.c (proc_get_iseq): remove and expand old name macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (rb_block_arity): should not call GetProcPtr() for symbols.shugo2015-12-171-4/+9
| | | | | | [ruby-core:72205] [Bug #11830] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: remove bm_free, use defaultnormal2015-12-091-7/+1
| | | | | | | | | | | bm_free no longer has special handling of unlinked method entries since r50728 when method entries were made VALUEs for GC safety. * proc.c (bm_free): remove, use default free (method_data_type): use RUBY_TYPED_DEFAULT_FREE git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * *.c (*_memsize): do not check ptr.ko12015-12-091-2/+2
| | | | | | | | | | NULL checking is finished Before call of memsize functions. See r52979. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * introduce new ISeq binary format serializer/de-serializerko12015-12-081-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and a pre-compilation/runtime loader sample. [Feature #11788] * iseq.c: add new methods: * RubyVM::InstructionSequence#to_binary_format(extra_data = nil) * RubyVM::InstructionSequence.from_binary_format(binary) * RubyVM::InstructionSequence.from_binary_format_extra_data(binary) * compile.c: implement body of this new feature. * load.c (rb_load_internal0), iseq.c (rb_iseq_load_iseq): call RubyVM::InstructionSequence.load_iseq(fname) with loading script name if this method is defined. We can return any ISeq object as a result value. Otherwise loading will be continue as usual. This interface is not matured and is not extensible. So that we don't guarantee the future compatibility of this method. Basically, you should'nt use this method. * iseq.h: move ISEQ_MAJOR/MINOR_VERSION (and some definitions) from iseq.c. * encoding.c (rb_data_is_encoding), internal.h: added. * vm_core.h: add several supports for lazy load. * add USE_LAZY_LOAD macro to specify enable or disable of this feature. * add several fields to rb_iseq_t. * introduce new macro rb_iseq_check(). * insns.def: some check for lazy loading feature. * vm_insnhelper.c: ditto. * proc.c: ditto. * vm.c: ditto. * test/lib/iseq_loader_checker.rb: enabled iff suitable environment variables are provided. * test/runner.rb: enable lib/iseq_loader_checker.rb. * sample/iseq_loader.rb: add sample compiler and loader. $ ruby sample/iseq_loader.rb [dir] will compile all ruby scripts in [dir]. With default setting, this compile creates *.rb.yarb files in same directory of target .rb scripts. $ ruby -r sample/iseq_loader.rb [app] will run with enable to load compiled binary data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c: Add call-seq of `Method#super_method`hsbt2015-11-161-1/+6
| | | | | | [ci skip][fix GH-1094] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: cfunc_proc_tnobu2015-11-101-11/+30
| | | | | | | | | * proc.c (cfunc_proc_t): add room for me. * proc.c (cfunc_proc_new): generalise for cfunc proc without env. * proc.c (rb_func_proc_new, rb_func_lambda_new): new functions to make proc/lambda without env from cfunc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* NameError#receiver of uninitialized constantnobu2015-10-281-18/+27
| | | | | | | | | * error.c (name_err_mesg_to_str): quote the name if unprintable. * object.c (check_setter_id): use rb_check_id to convert names. * variable.c (uninitialized_constant): use NameError::message to keep the receiver of uninitialized constant. [Feature #10881] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: remove rb_block_clear_env_selfnobu2015-10-271-11/+0
| | | | | | | * proc.c (rb_block_clear_env_self): removed as deprecated at r52129. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update document [ci skip]nobu2015-10-251-5/+5
| | | | | | | | | * error.c (ArgumentError): [DOC] update document following [Feature #9025] * proc.c (proc_call, proc_curry): [DOC] ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_args.c: symbol procnobu2015-10-161-19/+25
| | | | | | | * vm_args.c (vm_caller_setup_arg_block): store symbols instead of ifuncs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: merge blocksnobu2015-10-151-11/+1
| | | | | | * proc.c (proc_binding): merge blocks in same condition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: refine ifunc checksnobu2015-10-151-8/+13
| | | | | | | | | | | | | * proc.c (IS_METHOD_PROC_IFUNC): separate from IS_METHOD_PROC_ISEQ for vm_ifunc. * proc.c (rb_proc_get_iseq): use RUBY_VM_IFUNC_P to see if iseq is an ifunc. * proc.c (rb_proc_get_iseq, proc_binding): reduce redundant checsk by IS_METHOD_PROC_IFUNC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: void envnobu2015-10-151-2/+13
| | | | | | * proc.c (rb_sym_to_proc): make void env. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: iseq conditionsnobu2015-10-151-3/+3
| | | | | | | | | | * proc.c (rb_block_min_max_arity, rb_mod_define_method): use RUBY_VM_NORMAL_ISEQ_P() to check if iseq. * proc.c (make_curry_proc): IS_METHOD_PROC_ISEQ() includes RUBY_VM_IFUNC_P(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: proc without envnobu2015-10-151-0/+36
| | | | | | | * proc.c (rb_sym_to_proc): move from string.c and create a Proc with no environments. [ruby-core:71088] [Bug #11594] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (rb_method_entry_min_max_arity): should supportko12015-10-061-0/+3
| | | | | | | | OPTIMIZED_METHOD_TYPE_CALL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (Init_Proc): Proc#call and others should be public.ko12015-10-061-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c: enable optimization of Proc#call.ko12015-10-051-8/+3
| | | | | | | | | | [Feature #11569] * NEWS: write about this optimization and incompatibilities. * test/ruby/test_backtrace.rb: catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: set ep properlynobu2015-10-051-0/+1
| | | | | | | * proc.c (proc_new): link ep to calling block. [ruby-core:70980] [Bug #11566] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: fix symbol proc marknobu2015-10-011-1/+3
| | | | | | | * proc.c (proc_mark): block.ep of Proc from Symbol is now NULL. [ruby-core:70961] [Bug #11560] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_args.c: fix marking symbol ifuncnobu2015-10-011-0/+7
| | | | | | | | | | * vm_args.c (vm_caller_setup_arg_block): store new ifunc for symbol in control frame proc to be marked. * proc.c (proc_new), vm_insnhelper.c (vm_yield_with_cfunc): block->proc may be an ifunc now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: include symbol namenobu2015-09-301-0/+5
| | | | | | | * proc.c (proc_to_s): include the original symbol name in string form. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: fix GC guard locationnobu2015-09-281-1/+2
| | | | | | | * proc.c (proc_call): fix GC guard location after the use of its content. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_method.c: reuse method entrynobu2015-08-191-3/+3
| | | | | | | * vm_method.c (rb_obj_respond_to): reuse found method entry instead of searching same entry repeatedly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: fix for uncallable methodnobu2015-08-071-4/+10
| | | | | | | | | | * proc.c (method_super_method): uncallable method entry does not have the defined class, use the owner instead. [ruby-core:70254] [Bug #11419] * test/ruby/test_method.rb (test_super_method_unbound): add test by Akira Matsuda. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (rb_block_clear_env_self): clear by Qfalse intead of Qnil.ko12015-08-041-1/+1
| | | | | | | | | | | [Bug #11409] * test/ruby/test_eval.rb: add tests for this issue, written by @0x0dea. https://github.com/ruby/ruby/pull/988 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c: Removing duplicate doc [fix GH-987][ci skip]hsbt2015-08-041-1/+1
| | | | | | Patch by @ronakjangir47 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: size should be unsigned.ko12015-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | * rb_call_info_t::index * rb_iseq_constant_body::stack_max * rb_iseq_constant_body::local_size * rb_iseq_constant_body::param::size * rb_iseq_constant_body::local_table_size * rb_iseq_constant_body::is_size * rb_iseq_constant_body::callinfo_size * iseq.h: same for iseq_catch_table::size. * compile.c: catch up these fix. * iseq.c: ditto. * proc.c: ditto. * vm.c: ditto. * vm_args.c: ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * make rb_iseq_t T_IMEMO object (type is imemo_iseq).ko12015-07-211-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All contents of previous rb_iseq_t is in rb_iseq_t::body. Remove rb_iseq_t::self because rb_iseq_t is an object. RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq. So RubyVM::ISeq.of(something) method returns different wrapper objects but they point the same T_IMEMO/iseq object. This patch is big, but most of difference is replacement of iseq->xxx to iseq->body->xxx. (previous) rb_iseq_t::compile_data is also located to rb_iseq_t::compile_data. It was moved from rb_iseq_body::compile_data. Now rb_iseq_t has empty two pointers. I will split rb_iseq_body data into static data and dynamic data. * compile.c: rename some functions/macros. Now, we don't need to separate iseq and iseqval (only VALUE). * eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq). * ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq. * gc.c: check T_IMEMO/iseq. * internal.h: add imemo_type::imemo_iseq. * iseq.c: define RubyVM::InstructionSequnce as T_OBJECT. Methods are implemented by functions named iseqw_.... * load.c (rb_load_internal0): rb_iseq_new_top() returns rb_iseq_t (T_IMEMO/iesq). * method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq). * vm_core.h (GetISeqPtr): removed because it is not T_DATA now. * vm_core.h (struct rb_iseq_body): remove padding for [Bug #10037][ruby-core:63721]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: constify rb_method_iseq_t::iseqptr.ko12015-07-211-1/+1
| | | | | | | | | * proc.c (rb_method_entry_min_max_arity): catch up this fix. * vm_insnhelper.c (def_iseq_ptr): constify. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove redundant NULL checks after RUBY_VM_IFUNC_Pnormal2015-07-151-1/+1
| | | | | | | | | | * proc.c (proc_mark): remove redundant check * vm.c (env_mark): ditto This doesn't change object code size, but the unstripped executable is smaller and the code less confusing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove redundant NULL check in mark functionsnormal2015-07-151-6/+6
| | | | | | | | | | | | | gc.c (gc_mark_children)only calls mark_func if the T_DATA ptr is non-NULL, so avoid redundantly checking for that in each mark function. * iseq.c (iseq_mark): remove check for data pointer * proc.c (binding_mark): ditto * vm.c (rb_thread_mark): ditto * vm_trace.c (tp_mark): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h, vm.c: remove rb_proc_t::envval because we can know it viako12015-07-141-5/+3
| | | | | | | | | | | | rb_proc_t::block::ep. rb_vm_proc_envval(const rb_proc_t *proc) returns an Env object which the Proc object use. * proc.c: catch up this fix. * vm_dump.c (rb_vmdebug_proc_dump_raw): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h, vm.c: remvoe rb_env_t::prev_envval because we can know itko12015-07-141-2/+5
| | | | | | | | | | | | | | | | | via env->ep. rb_vm_env_prev_envval(env) returns prev_envval via env->ep. * vm_core.h (rb_vm_env_local_variables): change parameter type from VALUE (T_DATA/env) to `const rb_env_t *' to make same as rb_vm_env_prev_envval(). * proc.c: catch up these changes. * vm_dump.c: ditto. * vm.c: rename macros. * ENV_IN_HEAP_P() to VM_EP_IN_HEAP_P() because it uses ep. * ENV_VAL() to VM_ENV_EP_ENVVAL() because it is too short. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c: refactoring Proc/Env related code.ko12015-07-141-5/+1
| | | | | | | | | | | | | | | | | * vm_core.h: remove blockprocval field from rb_proc_t and rb_binding_t. Instead of this field, mark given block in Proc at rb_env_t::env. * vm.c (vm_make_env_each): make an Env object with this layout. And also simplify parameters. * proc.c: catch up this fix. * vm_core.h: remove rb_env_t::local_size because it is not used. * vm_dump.c (rb_vmdebug_env_dump_raw): catch up this fix. * vm_core.h (rb_vm_make_env_object): remove rb_vm_make_env_object() because it is only refered from vm.c. * vm_eval.c (eval_string_with_cref): catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (rb_method_call): because data->me should be non-NULL,ko12015-07-071-2/+2
| | | | | | | | | do not check data->me * proc.c (method_inspect): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: remove rb_iseq_t::defined_method_id because it is notko12015-07-061-1/+0
| | | | | | | | | | | | | | needed. * eval.c (frame_func_id): simplify. rb_callable_method_entry_t has enough information. * eval.c (frame_called_id): ditto. * iseq.c (prepare_iseq_build): catch up this fix. * proc.c (rb_mod_define_method): ditto. * vm.c (vm_define_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: remove rb_iseq_t::klass to reduce dynamic data.ko12015-07-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | * internal.h, iseq.c (rb_iseq_klass): remove it because rb_iseq_t::klass is removed. * vm_insnhelper.c (vm_super_outside): do not see cfp->iseq, but check callable method entry on a frame. This fix simplify the logic to search super class. * test/ruby/test_method.rb: support super() from Proc. Now, [Bug #4881] and [Bug #3136] was solved. * proc.c (rb_mod_define_method): catch up this change. * vm.c (vm_define_method): ditto. * vm_backtrace.c (rb_profile_frames): now, each `frame' objects are rb_callable_method_entry_t data or iseq VALUEs. This fix introduce minor compatibility issue that rb_profile_frame_label() always returns rb_profile_frame_base_label(). * test/-ext-/debug/test_profile_frames.rb: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h, proc.c (rb_method_entry_location): make it staticko12015-07-061-3/+3
| | | | | | | | and remoev prefix `rb_' because it is used only in proc.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: introduce rb_callable_method_entry_t to removeko12015-07-031-100/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rb_control_frame_t::klass. [Bug #11278], [Bug #11279] rb_method_entry_t data belong to modules/classes. rb_method_entry_t::owner points defined module or class. module M def foo; end end In this case, owner is M. rb_callable_method_entry_t data belong to only classes. For modules, MRI creates corresponding T_ICLASS internally. rb_callable_method_entry_t can also belong to T_ICLASS. rb_callable_method_entry_t::defined_class points T_CLASS or T_ICLASS. rb_method_entry_t data for classes (not for modules) are also rb_callable_method_entry_t data because it is completely same data. In this case, rb_method_entry_t::owner == rb_method_entry_t::defined_class. For example, there are classes C and D, and incldues M, class C; include M; end class D; include M; end then, two T_ICLASS objects for C's super class and D's super class will be created. When C.new.foo is called, then M#foo is searcheed and rb_callable_method_t data is used by VM to invoke M#foo. rb_method_entry_t data is only one for M#foo. However, rb_callable_method_entry_t data are two (and can be more). It is proportional to the number of including (and prepending) classes (the number of T_ICLASS which point to the module). Now, created rb_callable_method_entry_t are collected when the original module M was modified. We can think it is a cache. We need to select what kind of method entry data is needed. To operate definition, then you need to use rb_method_entry_t. You can access them by the following functions. * rb_method_entry(VALUE klass, ID id); * rb_method_entry_with_refinements(VALUE klass, ID id); * rb_method_entry_without_refinements(VALUE klass, ID id); * rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me); To invoke methods, then you need to use rb_callable_method_entry_t which you can get by the following APIs corresponding to the above listed functions. * rb_callable_method_entry(VALUE klass, ID id); * rb_callable_method_entry_with_refinements(VALUE klass, ID id); * rb_callable_method_entry_without_refinements(VALUE klass, ID id); * rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me); VM pushes rb_callable_method_entry_t, so that rb_vm_frame_method_entry() returns rb_callable_method_entry_t. You can check a super class of current method by rb_callable_method_entry_t::defined_class. * method.h: renamed from rb_method_entry_t::klass to rb_method_entry_t::owner. * internal.h: add rb_classext_struct::callable_m_tbl to cache rb_callable_method_entry_t data. We need to consider abotu this field again because it is only active for T_ICLASS. * class.c (method_entry_i): ditto. * class.c (rb_define_attr): rb_method_entry() does not takes defiend_class_ptr. * gc.c (mark_method_entry): mark RCLASS_CALLABLE_M_TBL() for T_ICLASS. * cont.c (fiber_init): rb_control_frame_t::klass is removed. * proc.c: fix `struct METHOD' data structure because rb_callable_method_t has all information. * vm_core.h: remove several fields. * rb_control_frame_t::klass. * rb_block_t::klass. And catch up changes. * eval.c: catch up changes. * gc.c: ditto. * insns.def: ditto. * vm.c: ditto. * vm_args.c: ditto. * vm_backtrace.c: ditto. * vm_dump.c: ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: ArgumentError if no blocknobu2015-06-191-0/+18
| | | | | | | * proc.c (rb_mod_define_method): now requires a block direct to this method call. [ruby-core:69655] [Bug #11283] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e