summaryrefslogtreecommitdiff
path: root/vm_eval.c
AgeCommit message (Collapse)Author
2014-11-15vm_eval.c: UncaughtThrowErrornobu
* vm_eval.c (rb_throw_obj): throw UncaughtThrowError instead of ArgumentError. [Feature #10480] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-14vm_eval.c (rb_eval_cmd): use pre-defined idCallnormal
No need to use rb_intern, here. Reduces size slightly on x86-64: $ ~/linux/scripts/bloat-o-meter ruby.before ruby.after add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-31 (-31) function old new delta rb_eval_cmd 813 782 -31 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-14vm_eval.c (rb_yield_splat): add missing GC guardnormal
Nobody uses this function in our source tree, but maybe this bug is triggered by certain C extensions. [Bug #10509] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-09vm.c: super in bmethodnobu
* vm_eval.c (vm_call_super): allow bound proc method to call super method. * vm_insnhelper.c (vm_yield_with_cfunc): push defined class and bound proc method entry to the control frame. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-02* rewrite method/block parameter fitting logic to optimizeko1
keyword arguments/parameters and a splat argument. [Feature #10440] (Details are described in this ticket) Most of complex part is moved to vm_args.c. Now, ISeq#to_a does not catch up new instruction format. * vm_core.h: change iseq data structures. * introduce rb_call_info_kw_arg_t to represent keyword arguments. * add rb_call_info_t::kw_arg. * rename rb_iseq_t::arg_post_len to rb_iseq_t::arg_post_num. * rename rb_iseq_t::arg_keywords to arg_keyword_num. * rename rb_iseq_t::arg_keyword to rb_iseq_t::arg_keyword_bits. to represent keyword bitmap parameter index. This bitmap parameter shows that which keyword parameters are given or not given (0 for given). It is refered by `checkkeyword' instruction described bellow. * rename rb_iseq_t::arg_keyword_check to rb_iseq_t::arg_keyword_rest to represent keyword rest parameter index. * add rb_iseq_t::arg_keyword_default_values to represent default keyword values. * rename VM_CALL_ARGS_SKIP_SETUP to VM_CALL_ARGS_SIMPLE to represent (ci->flag & (SPLAT|BLOCKARG)) && ci->blockiseq == NULL && ci->kw_arg == NULL. * vm_insnhelper.c, vm_args.c: rewrite with refactoring. * rewrite splat argument code. * rewrite keyword arguments/parameters code. * merge method and block parameter fitting code into one code base. * vm.c, vm_eval.c: catch up these changes. * compile.c (new_callinfo): callinfo requires kw_arg parameter. * compile.c (compile_array_): check the last argument Hash object or not. If Hash object and all keys are Symbol literals, they are compiled to keyword arguments. * insns.def (checkkeyword): add new instruction. This instruction check the availability of corresponding keyword. For example, a method "def foo k1: 'v1'; end" is cimpiled to the following instructions. 0000 checkkeyword 2, 0 # check k1 is given. 0003 branchif 9 # if given, jump to address #9 0005 putstring "v1" 0007 setlocal_OP__WC__0 3 # k1 = 'v1' 0009 trace 8 0011 putnil 0012 trace 16 0014 leave * insns.def (opt_send_simple): removed and add new instruction "opt_send_without_block". * parse.y (new_args_tail_gen): reorder variables. Before this patch, a method "def foo(k1: 1, kr1:, k2: 2, **krest, &b)" has parameter variables "k1, kr1, k2, &b, internal_id, krest", but this patch reorders to "kr1, k1, k2, internal_id, krest, &b". (locate a block variable at last) * parse.y (vtable_pop): added. This function remove latest `n' variables from vtable. * iseq.c: catch up iseq data changes. * proc.c: ditto. * class.c (keyword_error): export as rb_keyword_error(). * common.mk: depend vm_args.c for vm.o. * hash.c (rb_hash_has_key): export. * internal.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-19vm_eval.c: fix super from eval with scopenobu
* vm_eval.c (eval_string_with_cref): fix super from eval with scope. set klass in the current control frame to the class of the receiver in the context to be evaluated, this class/module must match the actual receiver to call super. [ruby-core:65122] [Bug #10263] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-27* vm_eval.c: [DOC] Fix rdoc formatting of patch from [Bug #9551]zzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-27* vm_eval.c: [DOC] [Bug #9551] Improve clarity of Kernel::catchzzak
documentation, patch by Jesse Sielaff. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-01vm.c: rb_vm_env_local_variablesnobu
* 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
2014-07-01vm.c: constifynobu
* 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
2014-06-19* vm_eval.c (rb_catch_protect): fix same problem of [Bug #9961].ko1
* vm_eval.c (rb_iterate): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-19* vm.c (rb_vm_rewind_cfp): add new function to rewind specified cfpko1
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
2014-06-18constify parametersnobu
* 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
2014-05-24* vm_eval.c: [DOC] [ci skip] Improve instance_eval description when given azzak
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
2014-05-07vm_eval.c: hide intermediate hashnobu
* 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
2014-05-07vm_eval.c: symbol identitynobu
* 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
2014-05-07vm_eval.c: valid name IDs onlynobu
* 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
2014-05-07vm.c: clear intermediate hashnobu
* 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
2014-05-07vm_eval.c: exclude hidden variablesnobu
* 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
2014-05-07rename variablesnobu
* 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
2014-04-04eval_intern.h: VAR_INITIALIZEDnobu
* 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
2014-03-18* vm_eval.c (eval_string_with_cref): Unify to use NIL_P.sorah
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-18* vm_eval.c (eval_string_with_cref): Use file path even if scope issorah
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
2014-03-17* enumerator.c (enumerator_block_call): use PARRAY_CONST_PTR()ko1
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
2014-03-07vm_eval.c: use RARRAY_CONST_PTR to aid RGenGC performancenormal
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
2014-03-07vm_eval.c: fix misplaced GC guardnormal
* 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
2014-01-30vm_eval.c: compare method typenobu
* 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
2014-01-30vm_eval.c: fix NoMethodError messagenobu
* 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
2014-01-30vm_eval.c: fix NoMethodError messagenobu
* 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
2014-01-30vm_eval.c: omit klassnobu
* 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
2014-01-30vm_eval.c: error message encodingnobu
* 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
2014-01-09* vm.c (rb_vm_pop_cfunc_frame): added. It cares c_return event.ko1
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
2014-01-01* vm_eval.c (method_missing): use ALLOCV_N() instead ofglass
ALLOCA_N() and rb_ary_tmp_new(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20* include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN intoko1
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
2013-12-08gc.c: promote long-lived NODE_CREF objects to oldgentmm1
* 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
2013-12-05vm_eval.c: suppress warningnobu
* 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
2013-12-03vm_eval.c: rb_catch_protectnobu
* 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
2013-11-30vm_eval.c: blockargnobu
* 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
2013-11-29vm_eval.c: rb_yield_blocknobu
* 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
2013-11-29ruby/ruby.h, enum.c, vm_eval.c: constify argvnobu
* 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
2013-11-26* compile.c: Use rb_fstring() to de-duplicate string literals in code. ↵tmm1
[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
2013-11-18eval_intern.h: refine stack overflow detectionnobu
* 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
2013-11-08* dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().glass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-25* include/ruby/ruby.h: rename RARRAY_RAWPTR() to RARRAY_CONST_PTR().ko1
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
2013-09-07* vm_eval.c (vm_call0): fix prototype, the id parameter should be ofcharliesome
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
2013-08-27vm_eval.c: constifynobu
* 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
2013-08-26* array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB becauseko1
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
2013-08-18* error.c, file.c, gc.c, hash.c, thread.c, variable.c, vm_eval.c, bin/erb:ktsj
$SAFE=4 is obsolete. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-16vm_eval.c: suppress warningnobu
* 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
2013-08-06* vm_insnhelper.c (vm_push_frame): fix stack overflow check codes.ko1
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