aboutsummaryrefslogtreecommitdiffstats
path: root/proc.c
Commit message (Collapse)AuthorAgeFilesLines
* proc.c: enable Proc#to_s rdocnobu2016-11-201-8/+8
| | | | | | * proc.c (proc_to_s): move just after the rdoc comment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: suppress warningnobu2016-11-201-1/+1
| | | | | | | * proc.c (NO_CLOBBERED): suppress clobbered warning which appears only on mingw. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix typo in code doc of proc.ca_matsuda2016-11-081-1/+1
| | | | | | | | | | | | | | | | | | Insure has a different meaning than ensure and we mean the latter in this case. *Ensure* is to do or have what is necessary for success. Example: These blankets ensure that you’ll be warm enough. *Insure* is to cover with an insurance policy. Example: I will insure my home with additional fire and flood policies. Patch by: Dimitris Zorbas <zorbash@skroutz.gr> (@Zorbash) Signed-off-by: Akira Matsuda <ronnie@dio.jp> closes #1352 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c, method.h, proc.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c:ktsj2016-11-051-1/+1
| | | | | | | | | TracePoint#method_id should return method_id, not callee_id. [ruby-core:77241] [Feature #12747] * test/ruby/test_settracefunc.rb: change accordingly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [DOC] replace Fixnum with Integer [ci skip]nobu2016-10-261-2/+2
| | | | | | * numeric.c: [DOC] update document for Integer class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: follow the original classnobu2016-10-251-1/+1
| | | | | | | * proc.c (mnew_internal): follow the original class, not to loop the prepended module. [ruby-core:77591] [Bug #12832] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h (ST2FIX): new macro to convert st_index_t to Fixnum.usa2016-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | a hash value of Object might be Bignum, but it causes many troubles expecially the Object is used as a key of a hash. so I've gave up to do so. * array.c (rb_ary_hash): use above macro. * bignum.c (rb_big_hash): ditto. * hash.c (rb_obj_hash, rb_hash_hash): ditto. * numeric.c (rb_dbl_hash): ditto. * proc.c (proc_hash): ditto. * re.c (rb_reg_hash, match_hash): ditto. * string.c (rb_str_hash_m): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: trivial optimizationnobu2016-09-251-4/+3
| | | | | | * proc.c (rb_proc_arity): reduce repeated GetProcPtr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* replace fixnum by integer in documents.akr2016-09-081-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c: [DOC] fix Object#define_singleton_method andsho-h2016-09-031-4/+4
| | | | | | | main.define_method return value. [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (mnew_missing): Remove an unused argument.yui-knk2016-08-181-5/+4
| | | | | | After r51126 rid is not used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: introduce VM_FRAME_RUBYFRAME_P()ko12016-08-031-4/+4
| | | | | | | | | | | | | | and VM_FRAME_CFRAME_P(). Most of case, RUBY_VM_NORMAL_ISEQ_P() is no longer needed. * vm_core.h: introduce rb_obj_is_iseq(). * cont.c, vm.c: VM_FRAME_MAGIC_DUMMY with VM_FRAME_FLAG_CFRAME. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: introduce VM_FRAME_FLAG_CFRAME to represent cfp->iseqko12016-08-031-1/+1
| | | | | | | type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * proc.c (env_write): remove unused function.ko12016-07-291-10/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c, internal.h: remove RubyVM::Env class and all of env objectsko12016-07-281-45/+36
| | | | | | | | | | | | | | | | | | | | are imemo objects (imemo_env). * NEWS: describe this change. I believe nobody touch these objects because there are no method defined. * vm_core.h: remove the following definitions. * rb_cEnv decl. * GetEnvPtr() because Env is no longer T_DATA object. * vm_core.h (rb_env_t): fix layout for imemo values. * vm_core.h (vm_assert_env): added. * vm_core.h (vm_env_new): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: revisit the structure of frame, block and env.ko12016-07-281-200/+319
| | | | | | | | | | | | | | | | | | | | | | [Bug #12628] This patch introduce many changes. * Introduce concept of "Block Handler (BH)" to represent passed blocks. * move rb_control_frame_t::flag to ep[0] (as a special local variable). This flags represents not only frame type, but also env flags such as escaped. * rename `rb_block_t` to `struct rb_block`. * Make Proc, Binding and RubyVM::Env objects wb-protected. Check [Bug #12628] for more details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Passed block symbol to procnobu2016-06-281-0/+3
| | | | | | | | * proc.c (passed_block): convert passed block symbol to proc. based on the patch by Daisuke Sato in [ruby-dev:49695]. [Bug #12531] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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