aboutsummaryrefslogtreecommitdiffstats
path: root/vm_eval.c
Commit message (Collapse)AuthorAgeFilesLines
* * vm_eval.c: [DOC] Fix rdoc formatting of patch from [Bug #9551]zzak2014-07-271-14/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_eval.c: [DOC] [Bug #9551] Improve clarity of Kernel::catchzzak2014-07-271-25/+42
| | | | | | | documentation, patch by Jesse Sielaff. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: rb_vm_env_local_variablesnobu2014-07-011-8/+20
| | | | | | | | * vm.c (rb_vm_env_local_variables): returns array of local variable name symbols in the environment by envval. * proc.c (bind_local_variables): use rb_vm_env_local_variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: constifynobu2014-07-011-1/+1
| | | | | | | | | * vm.c (vm_make_env_each): constify pointer arguments. (collect_local_variables_in_iseq): ditto. (collect_local_variables_in_env): ditto. (vm_collect_local_variables_in_heap): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_eval.c (rb_catch_protect): fix same problem of [Bug #9961].ko12014-06-191-2/+3
| | | | | | | | * vm_eval.c (rb_iterate): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c (rb_vm_rewind_cfp): add new function to rewind specified cfpko12014-06-191-12/+1
| | | | | | | | | | | | | | | with invoking RUBY_EVENT_C_RETURN. [Bug #9961] * vm_core.h: ditto. * eval.c (rb_protect): use it. * eval.c (rb_rescue2): ditto. * vm_eval.c (rb_iterate): ditto. * test/ruby/test_settracefunc.rb: add a test. * vm_core.h (rb_name_err_mesg_new): git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* constify parametersnobu2014-06-181-9/+11
| | | | | | | | * include/ruby/intern.h: constify `argv` parameters. * include/ruby/ruby.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_eval.c: [DOC] [ci skip] Improve instance_eval description when given azzak2014-05-241-6/+16
| | | | | | | block or String arguments. By @nathanl via documenting-ruby/ruby#28 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: hide intermediate hashnobu2014-05-071-3/+3
| | | | | | | * vm_eval.c (rb_f_local_variables): hide intermediate hash and use rb_hash_keys() directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: symbol identitynobu2014-05-071-1/+12
| | | | | | | * vm_eval.c (local_var_list_add): use symbol identity, and get rid of method calls. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: valid name IDs onlynobu2014-05-071-13/+20
| | | | | | | | | * vm.c (vm_collect_local_variables_in_heap): use struct local_var_list instead of VALUE directly. * vm_eval.c (local_var_list_update): add valid name IDs only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: clear intermediate hashnobu2014-05-071-1/+4
| | | | | | | * vm.c (rb_f_local_variables): clear intermediate hash after extracting its keys. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: exclude hidden variablesnobu2014-05-071-3/+5
| | | | | | | | * vm_eval.c (rb_f_local_variables): exclude variables hidden by shadowing. [ruby-core:60501] [Bug #9486] * vm.c (collect_local_variables_in_iseq): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename variablesnobu2014-05-071-5/+5
| | | | | | | | * vm.c (vm_collect_local_variables_in_heap): rename an argument. * vm_eval.c (rb_f_local_variables): rename a local variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_intern.h: VAR_INITIALIZEDnobu2014-04-041-0/+2
| | | | | | | * eval_intern.h (VAR_INITIALIZED): macro to suppress maybe-uninitialized warnings by gcc 4.7 and 4.8. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_eval.c (eval_string_with_cref): Unify to use NIL_P.sorah2014-03-181-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_eval.c (eval_string_with_cref): Use file path even if scope issorah2014-03-181-4/+5
| | | | | | given. Related to [ruby-core:56099] [Bug #8662] and r42103. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_block_call): use PARRAY_CONST_PTR()ko12014-03-171-2/+2
| | | | | | | | | | | | instead of RARRAY_PTR(). * io.c (rb_io_s_popen): ditto. * numeric.c (num_step_size): ditto. * vm_eval.c (rb_apply): ditto. * vm_eval.c (rb_eval_cmd): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: use RARRAY_CONST_PTR to aid RGenGC performancenormal2014-03-071-2/+3
| | | | | | | | | | Pointed out by ko1. * vm_eval.c (vm_call0_body): use RARRAY_CONST_PTR (check_funcall_exec): ditto [ruby-core:61360] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: fix misplaced GC guardnormal2014-03-071-4/+7
| | | | | | | * vm_eval.c (vm_call0_body): fix RB_GC_GUARD location (check_funcall_exec): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: compare method typenobu2014-01-301-1/+1
| | | | | | | * vm_eval.c (vm_call0_body): compare method type with VM_METHOD_TYPE_ZSUPER. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: fix NoMethodError messagenobu2014-01-301-2/+3
| | | | | | * vm_eval.c (vm_call0_body): reuse method type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: fix NoMethodError messagenobu2014-01-301-1/+2
| | | | | | | * vm_eval.c (vm_call0_body): fix NoMethodError message for refined method entry. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: omit klassnobu2014-01-301-11/+10
| | | | | | | * vm_eval.c (rb_search_method_entry): also Qfalse and Qnil are immediate values, so have no RBASIC. omit klass, which is 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: error message encodingnobu2014-01-301-10/+10
| | | | | | | * vm_eval.c (rb_search_method_entry): preserve encoding of method ID in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c (rb_vm_pop_cfunc_frame): added. It cares c_return event.ko12014-01-091-7/+6
| | | | | | | | | | | | | | | | | | | The patch base by drkaes (Stefan Kaes). [Bug #9321] * variable.c (rb_mod_const_missing): use rb_vm_pop_cfunc_frame() instead of rb_frame_pop(). * vm_eval.c (raise_method_missing): ditto. * vm_eval.c (rb_iterate): ditto. * internal.h (rb_vm_pop_cfunc_frame): add decl. * test/ruby/test_settracefunc.rb: add tests. provided by drkaes (Stefan Kaes). * vm.c, eval.c, include/ruby/intern.h (rb_frame_pop): move definition of rb_frame_pop() and deprecate it. It doesn't care about `return' events. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_eval.c (method_missing): use ALLOCV_N() instead ofglass2014-01-011-10/+3
| | | | | | ALLOCA_N() and rb_ary_tmp_new(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN intoko12013-12-201-1/+1
| | | | | | | | | | | | RB_OBJ_WRITE and RB_OBJ_WRITTEN. * array.c, class.c, compile.c, hash.c, internal.h, iseq.c, proc.c, process.c, re.c, string.c, variable.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: promote long-lived NODE_CREF objects to oldgentmm12013-12-081-1/+1
| | | | | | | | | | | | | | | * include/ruby/ruby.h: add RGENGC_WB_PROTECTED_NODE_CREF setting In a large app, this reduces the size of remembered_shady_object_count by 80%. [Bug #9225] [ruby-core:58947] * gc.c (rb_node_newnode): add FL_WB_PROTECTED flag to NODE_CREF * class.c (rewrite_cref_stack): insert OBJ_WRITE for NODE_CREF * iseq.c (set_relation): ditto * iseq.c (rb_iseq_clone): ditto * vm_eval.c (rb_yield_refine_block): ditto * vm_insnhelper.c (vm_cref_push): ditto * vm_insnhelper.h (COPY_CREF): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: suppress warningnobu2013-12-051-1/+1
| | | | | | * vm_eval.c (rb_catch_obj): add cast to suppress warning by VC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: rb_catch_protectnobu2013-12-031-3/+13
| | | | | | | | * vm_eval.c (rb_catch_protect): new function similar to rb_catch_obj(), but protect from all global jumps like as rb_load_protect(), rb_protect(), etc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: blockargnobu2013-11-301-1/+3
| | | | | | * vm_eval.c (rb_yield_block): implement non-nil block argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: rb_yield_blocknobu2013-11-291-0/+11
| | | | | | | | * vm_eval.c (rb_yield_block): yield block with rb_block_call_func arguments. * range.c (range_each): use rb_yield_block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby/ruby.h, enum.c, vm_eval.c: constify argvnobu2013-11-291-3/+3
| | | | | | | | * include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): constify argv. * enum.c (rb_enum_values_pack): ditto. * vm_eval.c (rb_block_call, rb_check_block_call): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c: Use rb_fstring() to de-duplicate string literals in code. ↵tmm12013-11-261-0/+5
| | | | | | | | | | | [ruby-core:58599] [Bug #9159] [ruby-core:54405] * iseq.c (prepare_iseq_build): De-duplicate iseq labels and source locations. * re.c (rb_reg_initialize): Use rb_fstring() for regex string. * string.c (rb_fstring): Handle non-string and already-fstr arguments. * vm_eval.c (eval_string_with_cref): De-duplicate eval source filename. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_intern.h: refine stack overflow detectionnobu2013-11-181-1/+1
| | | | | | | | | | | | * eval_intern.h (TH_PUSH_TAG, TH_EXEC_TAG): refine stack overflow detection. chain local tag after setjmp() successed on it, because calling setjmp() also can overflow the stack. [ruby-dev:47804] [Bug #9109] * vm_eval.c (rb_catch_obj): now th->tag points previous tag until TH_EXEC_TAG(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().glass2013-11-081-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: rename RARRAY_RAWPTR() to RARRAY_CONST_PTR().ko12013-09-251-1/+1
| | | | | | | | | | | | | | | RARRAY_RAWPTR(ary) returns (const VALUE *) type pointer and usecase of this macro is not acquire raw pointer, but acquire read-only pointer. So we rename to better name. RSTRUCT_RAWPTR() is also renamed to RSTRUCT_CONST_PTR() (I expect that nobody use it). * array.c, compile.c, cont.c, enumerator.c, gc.c, proc.c, random.c, string.c, struct.c, thread.c, vm_eval.c, vm_insnhelper.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_eval.c (vm_call0): fix prototype, the id parameter should be ofcharliesome2013-09-071-1/+1
| | | | | | | | | | | | | | type ID, not VALUE * vm_insnhelper.c (check_match): the rb_funcall family of functions does not care about refinements. We need to use rb_method_entry_with_refinements instead to call === with refinements. Thanks to Jon Conley for reporting this bug. [ruby-core:57051] [Bug #8872] * test/ruby/test_refinement.rb: add test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: constifynobu2013-08-271-4/+4
| | | | | | | | * vm_eval.c (rb_check_funcall, rb_check_funcall_with_hook): constify argv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB becauseko12013-08-261-1/+1
| | | | | | | | | | | | | there are not new relations. * enum.c (enum_sort_by): ditto. * struct.c (setup_struct): use RARRAY_RAWPTR(). * vm_eval.c (yield_under): ditto. * ext/pathname/pathname.c (path_entries): use RARRAY_AREF(). * ext/pathname/pathname.c (path_s_glob): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * error.c, file.c, gc.c, hash.c, thread.c, variable.c, vm_eval.c, bin/erb:ktsj2013-08-181-22/+3
| | | | | | $SAFE=4 is obsolete. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: suppress warningnobu2013-08-161-1/+2
| | | | | | | | * vm_eval.c (eval_string_with_cref): move cref inside EXEC_TAG block to suppress a warning that 'cref' might be clobbered by 'longjmp', on gcc 4.7 or later. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_insnhelper.c (vm_push_frame): fix stack overflow check codes.ko12013-08-061-2/+1
| | | | | | | | | | | | | | | | | | Stack overflow check should be done *after* pushing a stack frame. However, some stack overflow checking codes checked *before* pushing a stack frame with iseq->stack_max. To solve this problem, add a new parameter `stack_max' to specify a possible consuming stack size. * vm_core.h (CHECK_VM_STACK_OVERFLOW0): add to share the stack overflow checking code. * insns.def: catch up this change. * vm.c, vm_eval.c: ditto. * test/ruby/test_exception.rb: add a stack overflow test. This code is reported by nobu. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_eval.c (eval_string_with_cref): copy cref to limit the scope ofshugo2013-08-061-0/+9
| | | | | | | | refienements in the eval string. [ruby-core:56329] [Bug #8722] * test/ruby/test_refinement.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y, vm_eval.c: file encoding in evalnobu2013-07-291-20/+27
| | | | | | | | | | | | | | * parse.y (yycompile): store file name as String to keep the encoding. * parse.y (rb_parser_compile_string_path, rb_parser_compile_file_path): new functions to pass file name as a String. * parse.y (gettable_gen): return a copy of the original file name, not a copy in filesystem encoding. * vm_eval.c (eval_string_with_cref): use Qundef instead of "(eval)". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: fix argument typenobu2013-07-291-2/+2
| | | | | | | * vm_eval.c (eval_string_from_file_helper): fix callback argument type. rb_protect passes a VALUE not a pointer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: Check_TypedStructnobu2013-07-221-7/+2
| | | | | | | * vm_eval.c (eval_string_with_cref): check by Check_TypedStruct instead of rb_obj_is_kind_of. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: use file argumentnobu2013-07-221-1/+4
| | | | | | | | * vm_eval.c (eval_string_with_cref): use the given file name unless eval even if scope is given. additional fix for [Bug #8436]. based on the patch by srawlins at [ruby-core:56099] [Bug #8662]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* intern.h: define rb_enumerator_size_funcnobu2013-06-261-1/+1
| | | | | | | | * include/ruby/intern.h (rb_enumerator_size_func): define strict function declaration for rb_enumeratorize_with_size(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e