summaryrefslogtreecommitdiff
path: root/vm_eval.c
AgeCommit message (Collapse)Author
2016-12-31vm.c: fix return in lambdanobu
* vm.c (invoke_block_from_c_splattable): pass lambda-ness. * vm_eval.c (yield_under): invoke lambda proc properly. [ruby-core:78917] [Bug #13090] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-26vm_eval.c: Symbol#to_proc and instance_execnobu
* vm_eval.c (yield_under): should evaluate the proc on the first argument. [ruby-core:78839] [Bug #13074] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-07Add clang volatile fixes from FreeBSD and NetBSD.shugo
Use volatile instead of optnone to avoid optimization which causes segmentation faults. Patch by Dimitry Andric. [ruby-core:78531] [Bug #13014] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-14vm_eval.c: fstring instance_evalnobu
* vm_eval.c (singleton_class_for_eval): enable fstring singleton class for instance_eval. [ruby-core:78116] [Bug #12930] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11vm_eval.c: reordernobu
* vm_eval.c (vm_call0_body): reorder the conditions. [ruby-core:78073] [Bug #12920] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-10vm_eval.c: fix refined method when prependednobu
* vm_eval.c (vm_call0_body): refined module should not be skipped as prepended. [ruby-core:78073] [Bug #12920] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05* vm_eval.c (vm_call0_cfunc_with_frame): pass method id toktsj
dtrace hook. follow up r56592. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05* vm_trace.c (tracepoint_attr_callee_id, rb_tracearg_callee_id):ktsj
add TracePoint#callee_id. [ruby-core:77241] [Feature #12747] * cont.c, eval.c, gc.c, include/ruby/intern.h, insns.def, thread.c, vm.c, vm_backtrace.c, vm_core.h, vm_eval.c, vm_insnhelper.c, vm_trace.c: ditto. * test/ruby/test_settracefunc.rb: tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05* eval.c, method.h, proc.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c:ktsj
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
2016-10-29vm_eval.c: follow the original classnobu
* vm_eval.c (vm_call0_body): follow the original class, not to loop the prepended module. [ruby-core:77784] [Bug #12876] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-03* vm_core.h: introduce VM_FRAME_RUBYFRAME_P()ko1
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
2016-08-03* vm_core.h: introduce VM_FRAME_FLAG_CFRAME to represent cfp->iseqko1
type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-29rb_funcallvnobu
* *.c: rename rb_funcall2 to rb_funcallv, except for extensions which are/will be/may be gems. [Fix GH-1406] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55773 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-07-26* vm_insnhelper.c: introduce rb_vm_pop_frame() and use itko1
instead of setting rb_thread_t::cfp directly. * vm_insnhelper.c (vm_pop_frame): return the result of finish frame or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-07* vm_eval.c (yield_under): change prototype to get argc/argv.naruse
* vm_eval.c (specific_eval): change for above. * vm_eval.c (rb_obj_instance_exec): avoid object allocation. * vm_eval.c (rb_mod_module_exec): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18Suppress false warningsnobu
* vm_eval.c (rb_eval_cmd): refactor to share common code, and suppress false maybe-uninitialized warnings by old gcc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18Unnecessary volatilenobu
* vm_eval.c (rb_yield_splat, eval_string_with_cref): remove unnecessary volatile outside PUSH_TAG/POP_TAG. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08* configure.in: check function attirbute const and pure,naruse
and define CONSTFUNC and PUREFUNC if available. Note that I don't add those options as default because it still shows many false-positive (it seems not to consider longjmp). * vm_eval.c (stack_check): get rb_thread_t* as an argument to avoid duplicate call of GET_THREAD(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54952 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-03-28remove rb_thread_t::parse_in_evalnobu
* parse.y (struct parser_params): move parse_in_eval flag from rb_thread_t. * parse.y (rb_parser_set_context): set parsing context, not only mild error flag. * iseq.c (rb_iseq_compile_with_option): the parser now refers no thread local states to be restored. * vm_eval.c (eval_string_with_cref): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-19SyntaxError message at iseq compilenobu
* iseq.c (rb_iseq_compile_with_option): make the parser in mild error. * load.c (rb_load_internal0): ditto. * parse.y (yycompile0): return the error message within the error to be raised. [Feature #11951] * parse.y (parser_compile_error): accumulate error messages in the error_buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-12Malformed RDoc syntax in catch [ci skip]nobu
* vm_eval.c (rb_f_catch): [DOC] fix malformed RDoc syntax, "+...+" cannot enclose non-identifier characters. a patch by Sebastian S in [ruby-core:74278]. [Bug#12170] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-02vm_eval.c: call method_missing by method entrynobu
* vm_eval.c (method_missing): call by found method entry and get rid of searching the same method entry twice. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-02vm_eval.c: method_missing by method_missingnobu
* vm_eval.c (vm_call0_body): calling method_missing method is method_missing(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-28NoMethodError#private_call?nobu
* error.c (nometh_err_initialize): add private_call? parameter. * error.c (nometh_err_private_call_p): add private_call? method, to tell if the exception raised in private form FCALL or VCALL. [Feature #12043] * vm_eval.c (make_no_method_exception): append private_call? argument. * vm_insnhelper.c (ci_missing_reason): copy FCALL flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-20Fix Module#module_eval rdoc [ci skip]nobu
* vm_eval.c (rb_mod_module_eval): [DOC] Fix documentation signature for Module#module_eval. [Fix GH-1258] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-03vm_eval.c: argument namesnobu
* vm_eval.c (make_no_method_exception): enumerate argument meanings instead of a magic number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-30vm_eval.c: fix hook callnobu
* vm_eval.c (rb_check_funcall_with_hook): also should call the given hook before returning Qundef when overridden respond_to? method returned false. [ruby-core:73556] [Bug #12030] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-13vm_eval.c: fstring formatnobu
* vm_eval.c (make_no_method_exception): make format string fstring. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-12vm_eval.c: hook after method_missingnobu
* vm_eval.c (rb_check_funcall_with_hook): call hook after method_missing call when missing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30vm_eval.c: make dsymnobu
* vm_eval.c (rb_throw, rb_catch): get rid of making static IDs, use dynamic symbos instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-20* vm.c (rb_vm_cref_replace_with_duplicated_cref): added.ko1
CREFs should not be shared by methods between `using'. [Bug #11247] * vm_insnhelper.c (vm_cref_replace_with_duplicated_cref): ditto. * vm.c (vm_cref_dup): should copy refinements correctly. * eval.c: use rb_vm_cref_replace_with_duplicated_cref(). * eval_intern.h: add a decl. of rb_vm_cref_replace_with_duplicated_cref(). * vm_eval.c (eval_string_with_cref): do not need to pass scope's CREF because VM can find out CREF from stack frames. * test/ruby/test_refinement.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-13* refactoring CREF related code.ko1
* eval_intern.h: remove unused setter functions. CREF_CLASS_SET() CREF_NEXT_SET() CREF_SCOPE_VISI_COPY() * eval_intern.h: rename flags: * NODE_FL_CREF_PUSHED_BY_EVAL_ -> CREF_FL_PUSHED_BY_EVAL * NODE_FL_CREF_OMOD_SHARED_ -> CREF_FL_OMOD_SHARED and use IMEMO_FL_USER1/2. * vm.c (vm_cref_new): accept push_by_eval parameter. * vm.c (vm_cref_new_use_prev): added for rb_vm_rewrite_cref(). * vm_insnhelper.c (vm_cref_push): accept pushed_by_eval parameter. * vm_insnhelper.h: remove unused macros: COPY_CREF_OMOD() and COPY_CREF(). * vm_eval.c, insns.def: catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-11vm_eval.c: skip internal namesnobu
* vm_eval.c (local_var_list_add): skip internal local variable name by its type but not if it has a name. internal local variable names are just unique per frame, not globally. [ruby-core:71437] [Bug #11674] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-09vm_eval.c: rb_check_funcall_defaultnobu
* vm_eval.c (rb_check_funcall_default): split from rb_check_funcall to return the given fallback value. * object.c (rb_obj_dig): use rb_check_funcall_default so that tail call optimization will be possible. [Feature #11643] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-31use rb_source_loc and rb_source_locationnobu
* error.c, eval.c, eval_error.c, gc.c, variable.c, vm.c, vm_eval.c, vm_trace.c: use rb_source_loc/rb_source_location instead of combination of rb_sourcefile/rb_sourcefilename and rb_sourceline. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29vm_insnhelper.c: use enum and fix typonobu
* vm_insnhelper.c (VM_PROFILE_UP): use enum. * vm_insnhelper.c (vm_profile_show_result): fix typo, "r->c" at the last should be "c->c". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23error.c: separate class namesnobu
* error.c (name_err_mesg_to_str): separate class names from the receiver description. * vm_eval.c (make_no_method_exception, raise_method_missing): add format specifiers for class names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-22Kernel#loop returns the result value of a finished iteratorknu
* vm_eval.c (rb_f_loop): When a loop is stopped by a StopIteration exception, return what the enumerator has returned instead of nil. [ruby-core:71133] [Feature #11498] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-10* vm_eval.c, internal.h (rb_yield_1): added for performance whichko1
doesn't check Qundef. * numeric.c (int_dotimes): use rb_yield_1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-10* vm.c (invoke_block_from_c): split this function into severalko1
functions. * vm_insnhelper.c (vm_yield_callee_setup_arg): remove this function beacuse it is only delegation function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06* method.h: remove METHOD_ENTRY_SAFE(me) and related codeko1
because $SAFE = 3 and 4 is not available. Now, $SAFE is not checked on method dispatch at all. * vm_eval.c, vm_insnhelper.c, vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-05eval_intern.h: pass_passed_blocknobu
* eval_intern.h (pass_passed_block): make helper inline function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-19* vm_core.h: split rb_call_info_t into several structs.ko1
* rb_call_info (ci) has compiled fixed information. * if ci->flag & VM_CALL_KWARG, then rb_call_info is also rb_call_info_with_kwarg. This technique reduce one word for major rb_call_info data. * rb_calling_info has temporary data (argc, blockptr, recv). for each method dispatch. This data is allocated only on machine stack. * rb_call_cache is for inline method cache. Before this patch, only rb_call_info_t data is passed. After this patch, above three structs are passed. This patch improves: * data locarity (rb_call_info is now read-only data). * reduce memory consumption (rb_call_info_with_kwarg, rb_calling_info). * compile.c: use above data. * insns.def: ditto. * iseq.c: ditto. * vm_args.c: ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. * vm_insnhelper.h: ditto. * iseq.h: add iseq_compile_data::ci_index and iseq_compile_data::ci_kw_indx. * tool/instruction.rb: introduce TS_CALLCACHE operand type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-03vm_eval.c: should be singularnobu
* vm_eval.c (raise_method_missing): "names" should be singular. pointed out by Filip Bartuzi. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-03vm_eval.c: refine messagesnobu
* vm_eval.c (raise_method_missing): refine error messages when a symbol is not given. [Fix GH-1013] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-22vm_eval.c: cache resultsnobu
* vm_eval.c (check_funcall_failed, check_funcall_missing): cache results of respond_to? and respond_to_missing?, and search a pulibc method only for compatibility with rb_respond_to. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-22vm_eval.c: pass thread toonobu
* vm_eval.c (check_funcall_missing): pass same thread to call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-22vm_eval.c: reuse found method entrynobu
* vm_eval.c (check_funcall_missing): reuse found method entry instead of searching same entry repeatedly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e