summaryrefslogtreecommitdiff
path: root/proc.c
AgeCommit message (Collapse)Author
2016-07-29* proc.c (env_write): remove unused function.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28* vm.c, internal.h: remove RubyVM::Env class and all of env objectsko1
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
2016-07-28* vm_core.h: revisit the structure of frame, block and env.ko1
[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
2016-06-28Passed block symbol to procnobu
* 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
2016-05-15proc.c: fix RDoc of Proc#===/call/yield/[]normal
[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
2016-05-05proc.c: no temporary args arraynobu
* 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
2016-05-05proc.c: no unnecessary temporary arraynobu
* 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
2016-05-05proc.c: suppress a warningnobu
* 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
2016-05-05use TH_JUMP_TAGnobu
* 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
2016-05-04proc.c: separate rb_method_call_with_blocknobu
* 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
2016-05-04proc.c: passed_blocknobu
* 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
2016-05-04proc.c: constifynobu
* 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
2016-03-16proc.c: fail symbol proc bindingnobu
* 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
2016-02-09Add example for Method#parameters from [ruby-core:19759]naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-03Use `rb_method_visibility_t` instead of `int` in `rb_print_undef`yui-knk
* 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
2015-12-20* proc.c (rb_mod_define_method): should check Symbol or not.ko1
[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
2015-12-20* proc.c (rb_mod_define_method): fix notation.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-20* proc.c (proc_new): fix notation.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-19proc.c: fix infinite loopnobu
* 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
2015-12-19fix commit missnobu
* proc.c: fix expanded name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-19proc.c: remove old macronobu
* 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
2015-12-17* proc.c (rb_block_arity): should not call GetProcPtr() for symbols.shugo
[ruby-core:72205] [Bug #11830] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09proc.c: remove bm_free, use defaultnormal
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
2015-12-09* *.c (*_memsize): do not check ptr.ko1
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
2015-12-08* introduce new ISeq binary format serializer/de-serializerko1
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
2015-11-16* proc.c: Add call-seq of `Method#super_method`hsbt
[ci skip][fix GH-1094] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-10proc.c: cfunc_proc_tnobu
* 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
2015-10-28NameError#receiver of uninitialized constantnobu
* 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
2015-10-27proc.c: remove rb_block_clear_env_selfnobu
* 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
2015-10-25update document [ci skip]nobu
* 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
2015-10-16vm_args.c: symbol procnobu
* 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
2015-10-15proc.c: merge blocksnobu
* 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
2015-10-15proc.c: refine ifunc checksnobu
* 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
2015-10-15proc.c: void envnobu
* 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
2015-10-15proc.c: iseq conditionsnobu
* 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
2015-10-15proc.c: proc without envnobu
* 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
2015-10-06* proc.c (rb_method_entry_min_max_arity): should supportko1
OPTIMIZED_METHOD_TYPE_CALL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06* proc.c (Init_Proc): Proc#call and others should be public.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-05* proc.c: enable optimization of Proc#call.ko1
[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
2015-10-05proc.c: set ep properlynobu
* 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
2015-10-01proc.c: fix symbol proc marknobu
* 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
2015-10-01vm_args.c: fix marking symbol ifuncnobu
* 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
2015-09-30proc.c: include symbol namenobu
* 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
2015-09-28proc.c: fix GC guard locationnobu
* 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
2015-08-19vm_method.c: reuse method entrynobu
* 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
2015-08-07proc.c: fix for uncallable methodnobu
* 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
2015-08-04* proc.c (rb_block_clear_env_self): clear by Qfalse intead of Qnil.ko1
[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
2015-08-04* proc.c: Removing duplicate doc [fix GH-987][ci skip]hsbt
Patch by @ronakjangir47 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-24* vm_core.h: size should be unsigned.ko1
* 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
2015-07-21* make rb_iseq_t T_IMEMO object (type is imemo_iseq).ko1
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