summaryrefslogtreecommitdiff
path: root/vm_eval.c
AgeCommit message (Collapse)Author
2015-07-03* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-03* method.h: introduce rb_callable_method_entry_t to removeko1
rb_control_frame_t::klass. [Bug #11278], [Bug #11279] rb_method_entry_t data belong to modules/classes. rb_method_entry_t::owner points defined module or class. module M def foo; end end In this case, owner is M. rb_callable_method_entry_t data belong to only classes. For modules, MRI creates corresponding T_ICLASS internally. rb_callable_method_entry_t can also belong to T_ICLASS. rb_callable_method_entry_t::defined_class points T_CLASS or T_ICLASS. rb_method_entry_t data for classes (not for modules) are also rb_callable_method_entry_t data because it is completely same data. In this case, rb_method_entry_t::owner == rb_method_entry_t::defined_class. For example, there are classes C and D, and incldues M, class C; include M; end class D; include M; end then, two T_ICLASS objects for C's super class and D's super class will be created. When C.new.foo is called, then M#foo is searcheed and rb_callable_method_t data is used by VM to invoke M#foo. rb_method_entry_t data is only one for M#foo. However, rb_callable_method_entry_t data are two (and can be more). It is proportional to the number of including (and prepending) classes (the number of T_ICLASS which point to the module). Now, created rb_callable_method_entry_t are collected when the original module M was modified. We can think it is a cache. We need to select what kind of method entry data is needed. To operate definition, then you need to use rb_method_entry_t. You can access them by the following functions. * rb_method_entry(VALUE klass, ID id); * rb_method_entry_with_refinements(VALUE klass, ID id); * rb_method_entry_without_refinements(VALUE klass, ID id); * rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me); To invoke methods, then you need to use rb_callable_method_entry_t which you can get by the following APIs corresponding to the above listed functions. * rb_callable_method_entry(VALUE klass, ID id); * rb_callable_method_entry_with_refinements(VALUE klass, ID id); * rb_callable_method_entry_without_refinements(VALUE klass, ID id); * rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me); VM pushes rb_callable_method_entry_t, so that rb_vm_frame_method_entry() returns rb_callable_method_entry_t. You can check a super class of current method by rb_callable_method_entry_t::defined_class. * method.h: renamed from rb_method_entry_t::klass to rb_method_entry_t::owner. * internal.h: add rb_classext_struct::callable_m_tbl to cache rb_callable_method_entry_t data. We need to consider abotu this field again because it is only active for T_ICLASS. * class.c (method_entry_i): ditto. * class.c (rb_define_attr): rb_method_entry() does not takes defiend_class_ptr. * gc.c (mark_method_entry): mark RCLASS_CALLABLE_M_TBL() for T_ICLASS. * cont.c (fiber_init): rb_control_frame_t::klass is removed. * proc.c: fix `struct METHOD' data structure because rb_callable_method_t has all information. * vm_core.h: remove several fields. * rb_control_frame_t::klass. * rb_block_t::klass. And catch up changes. * eval.c: catch up changes. * gc.c: ditto. * insns.def: ditto. * vm.c: ditto. * vm_args.c: ditto. * vm_backtrace.c: ditto. * vm_dump.c: ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-25error.c: remove singleton methodnobu
* error.c (rb_name_err_mesg_new): remove singleton method, and unused argument. * vm_eval.c (make_no_method_exception): call rb_name_err_mesg_new directly instead of constant lookup and method invocation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-06* method.h: back to share rb_method_definition_t byko1
rb_method_entry_t. r50728 changed sharing `def's to isolating `def's on alias and so on. However, this change conflicts future improvement plan. So I change back to sharing approach. * method.h: move rb_method_definition_t::flags to rb_method_entry_t::attr::flags. rb_method_entry_t::attr is union with VALUE because this field should have same size of VALUE. rb_method_entry_t is T_IMEMO). And also add the following access macros to it's fileds. * METHOD_ENTRY_VISI(me) * METHOD_ENTRY_BASIC(me) * METHOD_ENTRY_SAFE(me) * vm_method.c (rb_method_definition_addref): added instead of rb_method_definition_clone(). Do not create new definition, but increment alias_count. * class.c (clone_method): catch up this fix. * class.c (method_entry_i): ditto. * proc.c (mnew_internal): ditto. * proc.c (mnew_missing): ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03* method.h: introduce rb_method_refined_t for refined method entry.ko1
* class.c (move_refined_method): catch up this fix. * gc.c (mark_method_entry): ditto. * vm_eval.c (vm_call0_body): ditto. * vm_insnhelper.c (vm_call_method): ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03* class.c (clone_method): remove redundant check for me->def != NULL.ko1
Now, all `me` have `me->def`. * proc.c (rb_method_entry_location): ditto. * vm.c (rb_vm_check_redefinition_opt_method): ditto. * vm.c (add_opt_method): ditto. * vm_eval.c (vm_call0_body): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03* vm_core.h: rename enum missing_reason to enum method_missing_reason.ko1
* vm_core.h: use enum method_missing_reason for rb_thread_t::method_missing_reason. * vm_eval.c: catch up this fix. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03* method.h: split rb_method_definition_t::flag to several flags.ko1
`flag' contains several categories of attributes and it makes us confusion (at least, I had confused). * rb_method_visibility_t (flags::visi) * NOEX_UNDEF -> METHOD_VISI_UNDEF = 0 * NOEX_PUBLIC -> METHOD_VISI_PUBLIC = 1 * NOEX_PRIVATE -> METHOD_VISI_PRIVATE = 2 * NOEX_PROTECTED -> METHOD_VISI_PROTECTED = 3 * NOEX_SAFE(flag)) -> safe (flags::safe, 2 bits) * NOEX_BASIC -> basic (flags::basic, 1 bit) * NOEX_MODFUNC -> rb_scope_visibility_t in CREF * NOEX_SUPER -> MISSING_SUPER (enum missing_reason) * NOEX_VCALL -> MISSING_VCALL (enum missing_reason) * NOEX_RESPONDS -> BOUND_RESPONDS (macro) Now, NOEX_NOREDEF is not supported (I'm not sure it is needed). Background: I did not know what "NOEX" stands for. I asked Matz (who made this name) and his answer was "Nothing". "At first, it meant NO EXport (private), but the original meaning was gone." This is why I remove the mysterious word "NOEX" from MRI. * vm_core.h: introduce `enum missing_reason' to represent method_missing (NoMethodError) reason. * eval_intern.h: introduce rb_scope_visibility_t to represent scope visibility. It has 3 method visibilities (public/private/protected) and `module_function`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-02* method.h: make rb_method_entry_t a VALUE.ko1
Motivation and new data structure are described in [Bug #11203]. This patch also solve the following issues. * [Bug #11200] Memory leak of method entries * [Bug #11046] __callee__ returns incorrect method name in orphan proc * test/ruby/test_method.rb: add a test for [Bug #11046]. * vm_core.h: remvoe rb_control_frame_t::me. me is located at value stack. * vm_core.h, gc.c, vm_method.c: remove unlinked_method... codes because method entries are simple VALUEs. * method.h: Now, all method entries has own independent method definititons. Strictly speaking, this change is not essential, but for future changes. * rb_method_entry_t::flag is move to rb_method_definition_t::flag. * rb_method_definition_t::alias_count is now rb_method_definition_t::alias_count_ptr, a pointer to the counter. * vm_core.h, vm_insnhelper.c (rb_vm_frame_method_entry) added to search the current method entry from value stack. * vm_insnhelper.c (VM_CHECK_MODE): introduced to enable/disable assertions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-01fix typokazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-30* method.h: add VM_METHOD_TYPE_ALIAS rb_method_definition_t::typeko1
to fix [Bug #11173]. Now, inter class/method alias creates new method entry VM_METHOD_TYPE_ALIAS, which has an original method entry. * vm_insnhelper.c (find_defiend_class_by_owner): added. Search corresponding defined_class from owner class/module. * vm_method.c (rb_method_entry_get_without_cache): return me->klass directly for defined_class. Now, no need to check me->klass any more. * vm_method.c (method_entry_set0): separated from method_entry_set(). * vm_method.c (rb_alias): make method entry has VM_METHOD_TYPE_ALIAS. * vm_method.c (release_method_definition): support VM_METHOD_TYPE_ALIAS. * vm_method.c (rb_hash_method_definition): ditto. * vm_method.c (rb_method_definition_eq): ditto. * vm_method.c (release_method_definition): ditto. * vm_insnhelper.c (vm_call_method): ditto. * vm_insnhelper.c (vm_method_cfunc_entry): ditto. * vm_eval.c (vm_call0_body): ditto. * gc.c (mark_method_entry): ditto. * proc.c (method_def_iseq): ditto. * proc.c (method_cref): ditto. * proc.c (rb_method_entry_min_max_arity): ditto. * test/ruby/test_alias.rb: add tests. * test/ruby/test_module.rb: fix a test to catch up current behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-08vm_eval.c: resolve refined method entrynobu
* vm_eval.c (rb_method_call_status): resolve refined method entry to check if undefined. [ruby-core:69064] [Bug #11117] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-06vm_eval.c: undefined refined check_funcallnobu
* vm_eval.c (rb_method_call_status): undefined refined method is not callable unless using. [ruby-core:69064] [Bug #11117] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-23vm_eval.c: allow symbols to instance_eval/execnobu
* vm_eval.c (rb_obj_instance_eval, rb_obj_instance_exec): allow symbols to just instance_eval/exec, execept for definition of singletons. [ruby-core:68961] [Bug #11086] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-03vm_core.h: update for OPT_CALL_CFUNC_WITHOUT_FRAMEnobu
* vm_eval.c (vm_call0_cfunc): update invoker arguments. * vm_insnhelper.c (vm_call_cfunc_latter): ditto. * vm_insnhelper.c (rb_vm_call_cfunc_push_frame): ditto, and prefix with rb_. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-28vm_eval.c: suppress warningsnobu
* vm_eval.c (iterate_method): split to suppress false warnings by gcc 4.4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-28vm_eval.c: simplifynobu
* vm_eval.c (rb_iterate0): simplify TAG_BREAK and TAG_RETRY by sharing common code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-27vm_eval.c: simplify rb_iteratenobu
* internal.h (IFUNC_NEW): add argument for ID. * vm_eval.c (rb_iterate): create ifunnc only when it is used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-11* node.h: remove NODE_IFUNC, NEW_IFUNC.ko1
* internal.h: use T_IMEMO for IFUNC. rename `struct IFUNC' to `struct vm_ifunc' and move the definition from vm_insnhelper.h. Add imemo_ifunc. * gc.c (gc_mark_children): mark imemo_ifunc type T_IMEMO object. * compile.c: catch up these changes. * proc.c: ditto. * vm_core.h (RUBY_VM_IFUNC_P): ditto. * vm_eval.c (rb_iterate): ditto. * vm_insnhelper.c: ditto. * ext/objspace/objspace.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-11* vm_insnhelper.h: use T_IMEMO to create THROW_DATA.ko1
Add THROW_DATA_NEW(). * internal.h: move defnition of `struct THROW_DATA' from vm_insnhelper.h to internal.h. Rename `THROW_DATA' to `vm_throw_data'. * eval_intern.h (THROW_DATA_P): move to internal.h. THROW_DATA is no longer T_NODE, so check T_IMEMO. * gc.c (gc_mark_children): mark THROW_DATA. * vm.c: catch up these changes. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-11* include/ruby/ruby.h: introduce new type T_IMEMO.ko1
T_IMEMO is Internal Memo type, internal use only. T_IMEMO has same purpose of NODE_MEMO. To insert T_IMEMO, type numbers are modified a little. * internal.h: define struct RIMemo. Each RIMemo objects has imemo_type. We can observe it by the imemo_type() function. * gc.c (rb_imemo_new): added. * node.h: remove NODE_CREF and NEW_CREF(). * node.c (rb_gc_mark_node): ditto. * vm.c (vm_cref_new): use rb_imem_new(). * vm_eval.c: ditto. * vm_eval.c (eval_string_with_cref): * vm_eval.c (rb_type_str): * vm_insnhelper.c: use RIMemo objects for CREF. * ext/objspace/objspace.c: support T_IMEMO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-10* vm_eval.c (rb_catch_protect): use THROW_DATA_VAL().ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-10* vm_insnhelper.h: define struct IFUNC.ko1
* vm_eval.c (rb_iterate): use it. * vm_insnhelper.c (vm_yield_with_cfunc): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-10* vm_insnhelper.h: define struct THROW_DATA to representko1
throwing data. Also define accessor functions. * eval_intern.h: move related changes into vm_insnhelper.h. Now these MACROs (functions) are only used in vm*.c. There is only THROW_DATA_P(err) to check this data type or not. * vm.c: catch up these changes. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-08* internal.h: define rb_cref_t and change to use it.ko1
rb_cref_t is data type of CREF. Now, the body is still NODE. It is easy to understand what is CREF and what is pure NODE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-08* internal.h: define CREF accessor macros.ko1
* CREF_CLASS(cref) * CREF_NEXT(cref) * CREF_VISI(cref) * CREF_VISI_SET(cref, v) * CREF_REFINEMENTS(cref) * CREF_PUSHED_BY_EVAL(cref) * CREF_PUSHED_BY_EVAL_SET(cref) * CREF_OMOD_SHARED(cref) * CREF_OMOD_SHARED_SET(cref) * CREF_OMOD_SHARED_UNSET(cref) This is process to change CREF data type from NODE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-06* fix namespace issue on singleton class expressions. [Bug #10943]ko1
* vm_core.h, method.h: remove rb_iseq_t::cref_stack. CREF is stored to rb_method_definition_t::body.iseq_body.cref. * vm_insnhelper.c: modify SVAR usage. When calling ISEQ type method, push CREF information onto method frame, SVAR located place. Before this fix, SVAR is simply nil. After this patch, CREF (or NULL == Qfalse for not iseq methods) is stored at the method invocation. When SVAR is requierd, then put NODE_IF onto SVAR location, and NDOE_IF::nd_reserved points CREF itself. * vm.c (vm_cref_new, vm_cref_dump, vm_cref_new_toplevel): added. * vm_insnhelper.c (vm_push_frame): accept CREF. * method.h, vm_method.c (rb_add_method_iseq): added. This function accepts iseq and CREF. * class.c (clone_method): use rb_add_method_iseq(). * gc.c (mark_method_entry): mark method_entry::body.iseq_body.cref. * iseq.c: remove CREF related codes. * insns.def (getinlinecache/setinlinecache): CREF should be cache key because a different CREF has a different namespace. * node.c (rb_gc_mark_node): mark NODE_IF::nd_reserved for SVAR. * proc.c: catch up changes. * struct.c: ditto. * insns.def: ditto. * vm_args.c (raise_argument_error): ditto. * vm_eval.c: ditto. * test/ruby/test_class.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-06vm_eval.c: next super class from the originalnobu
* vm_eval.c (vm_call_super): search next super class from the original class, to get rid of infinite recursion with prepending. a patch by Seiei Higa <hanachin AT gmail.com> at [ruby-core:68434]. [ruby-core:68093] [Bug #10847] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-05* vm_eval.c (eval_string_with_cref): A binding should keepshugo
refinements activation information and the refinements should be activated in subsequent eval calls with the binding. [ruby-core:67945] [Bug #10818] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-06vm_eval.c: no use of SYM2IDnobu
* vm_eval.c (check_funcall_missing): no longer turn an ID into a symbol temporarily to get rid of use of SYM2ID. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-05convert method name to a Symbolnobu
* vm_eval.c (send_internal), vm_insnhelper.c (vm_call_opt_send): convert String method name into a Symbol, as method_missing method expects its first argument to be a Symbol. [Bug #10828] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-04* vm_eval.c: Fix symbol leak with non optimized +send+ and method_missing ↵marcandre
[#10828] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-16* eval_intern.h, vm.c, vm_eval.c, vm_insnhelper.c:ktsj
change throw mechanism (not save target ep, but save target cfp). It fixes `unexpected break' bug that occurs when TracePoint#binding is called. [ruby-dev:48797] [Bug #10689] * test/ruby/test_settracefunc.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-09vm_eval.c: fix `rb_eval_string_wrap` rdocnobu
* vm_eval.c (rb_eval_string_wrap): [DOC] Fix `rb_eval_string_wrap` documentation. It is referencing `require` instead of `load`. The former does not have the optional argument. [Fix GH-779] [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-25vm_eval.c: preserve encodingnobu
* vm_eval.c (rb_method_call_status): preserve encoding of called method name in error messages. * vm_insnhelper.c (vm_call_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-16vm_eval.c: rb_current_receivernobu
* vm_eval.c (rb_current_receiver): new function to return the receiver in the current control frame. [Feature #10195] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-16vm_eval.c: define IDsnobu
* vm_eval.c (Init_vm_eval): define :tag and :value in advance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-16id.def: move IDs for exceptionnobu
* defs/id.def: add :mesg and :exception and move from other sources. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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