aboutsummaryrefslogtreecommitdiffstats
path: root/proc.c
Commit message (Collapse)AuthorAgeFilesLines
* proc.c: fix RDoc of Proc#===/call/yield/[]normal2016-05-151-0/+11
| | | | | | | | | | | | | | | | | [Bug #12332] Since r52050 ("proc.c: enable optimization of Proc#call") for [Feature #11569], we need to maintain this documentation in a way RDoc comprehends. This is probably not worth fixing in RDoc itself since this uses a non-standard internal C API which is subject to change without notice. ref: http://mid.gmane.org/20160429212836.GA16605@dcvr.yhbt.net http://mid.gmane.org/1461959651.806728.670.51764@mail.rambler.ru http://blade.nagaokaut.ac.jp/ruby/ruby-talk/435458 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: no temporary args arraynobu2016-05-051-10/+1
| | | | | | | * proc.c (bmcall): method proc is always lambda, args is the array which is made from argc and argv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: no unnecessary temporary arraynobu2016-05-051-5/+2
| | | | | | | * proc.c (bmcall): get rid of making temporary single element array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: suppress a warningnobu2016-05-051-1/+9
| | | | | | | * proc.c (call_method_data_safe): suppress clobbered warning by old gcc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use TH_JUMP_TAGnobu2016-05-051-1/+1
| | | | | | | | * vm_eval.c (rb_eval_cmd, rb_catch_obj): use TH_JUMP_TAG with the same rb_thread_t used for TH_PUSH_TAG, instead of JUMP_TAG with the current thread global variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: separate rb_method_call_with_blocknobu2016-05-041-19/+33
| | | | | | | * proc.c (rb_method_call_with_block): separate the cases with and without tag for optimization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: passed_blocknobu2016-05-041-14/+13
| | | | | | | * proc.c (passed_block): extract conversion from passed proc value to rb_block_t pointer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: constifynobu2016-05-041-1/+1
| | | | | | * proc.c (method_callable_method_entry): constify data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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