aboutsummaryrefslogtreecommitdiffstats
path: root/vm_method.c
Commit message (Collapse)AuthorAgeFilesLines
* vm_method.c: fix aliased original namenobu2016-03-081-4/+4
| | | | | | | | * vm_method.c (rb_alias): the original name should be properly available method_added method, set the name before calling the hook. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_method.c: fix assertionnobu2016-03-011-1/+1
| | | | | | | | * vm_method.c (prepare_callable_method_entry): assert same condition only once for each case, not twice for module instance method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_method.c: for hidden objectnobu2016-02-241-1/+3
| | | | | | | * vm_method.c (rb_method_basic_definition_p): methods of hidden objects cannot be overridden, return TRUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c: fix grammar in respond_to? warning.hsbt2016-01-191-2/+2
| | | | | | [fix GH-1047] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use `rb_method_visibility_t` instead of `int` in `rb_print_undef`yui-knk2016-01-031-3/+3
| | | | | | | | | | | * 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
* * vm_method.c (rb_method_entry_make, check_override_opt_method):shugo2015-12-181-0/+22
| | | | | | | | | should check whether a newly created method override a optimize method in case the method is defined in a prepended module of a built-in class. [ruby-core:72226] [Bug #11836] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c (rb_class_clear_method_cache): should clear allko12015-11-181-6/+20
| | | | | | | | | | | | | | | | | | | | | | | | | RCLASS_CALLABLE_M_TBLs of all sub-classes (T_ICLASS). RCLASS_CALLABLE_M_TBL() caches complemented method entries. It should be cleared when the modules are cleared. On previous version clears only for direct children. It is enough for normal modules because corresponding T_ICLASSes are direct children. However, refinements create complex data structure. So that we need to clear all children (and descendants). [ruby-core:71423] [Bug #11672] * vm_method.c (rb_clear_method_cache_by_class): rb_mKernel doesn't call rb_class_clear_method_cache, so that clear child T_ICLASSes. * test/ruby/test_refinement.rb: enable disabled test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c (prepare_callable_method_entry): useko12015-11-181-2/+1
| | | | | | | | | RCLASS_CALLABLE_M_TBL() instead of accessing a filed directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: introduce the folliwing field and macros.ko12015-11-181-9/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * rb_method_definition_t::complemented_count to count shared method entries because of complemented method entries and separate from alias_count. Shared `def' only by complemented method entries should not prevent method re-definition warning. * METHOD_ENTRY_COMPLEMENTED(me) to represent complemented method entry. * METHOD_ENTRY_COMPLEMENTED_SET(me) to check it as complemented me. * vm_insnhelper.c (aliased_callable_method_entry): should also check me->def->complemented_count. * vm_method.c (method_definition_addref_complement): add to count complemented method entries number. * vm_method.c (rb_method_definition_release): release `def' iff alias_count == 0 and complemented_count == 0. * test/ruby/test_module.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert r52614, r52615, r52617 because they cause serious errorsko12015-11-171-26/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h (METHOD_ENTRY_COMPLEMENTED(_SET)): introduced to recognizeko12015-11-171-2/+2
| | | | | | | | | | | | | complemented method entries or not. There are some cases that callabe method entries do not have defined_class. * vm_method.c (rb_method_entry_complement_defined_class): use METHOD_ENTRY_COMPLEMENTED_SET(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: introduce rb_method_definition_t::complemented_count.ko12015-11-171-9/+26
| | | | | | | | | | | | | | | | | | * vm_method.c (method_definition_addref_complement): introduced. def->alias_count is used to decide warn or do not warn at method redefinition. Complented methods should not prevent redefiniton warnings. * vm_method.c (rb_method_definition_release): release def iff alias_count == 0 && complemented_count == 0. * test/ruby/test_module.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_method.c: check if frozen [Fix GH-1096]nobu2015-11-151-0/+1
| | | | | | | * vm_method.c (set_method_visibility): should fail if the receiver is frozen. [ruby-core:71489] [Bug #11687] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c (vm_define_method): do not use current CREF immediately,ko12015-11-131-1/+9
| | | | | | | | | | | | | | | | but check CREF in environment or methods. Methods defined in methods should be public. [Bug #11571] * vm_method.c (rb_scope_module_func_check): check CREF in env or me. if CREF is contained by `me', then return FALSE. * test/ruby/test_method.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: constify rb_cref_t::scope_visi;ko12015-11-131-6/+10
| | | | | | | | | | | * eval_intern.h (CREF_SCOPE_VISI_COPY): catch up this fix. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h: RUBY_DTRACE_HOOKnobu2015-10-311-3/+1
| | | | | | | | | | | * internal.h (RUBY_DTRACE_HOOK): extract from RUBY_DTRACE_CREATE_HOOK for other type hooks. * gc.c (RUBY_DTRACE_GC_HOOK): ditto. * parse.y (RUBY_DTRACE_PARSE_HOOK): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c: added documentation of protected/private methods.hsbt2015-10-301-5/+11
| | | | | | | | [fix GH-1072] * test/ruby/test_module.rb: added testcase for method_defined? [fix GH-1071] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* NameError#receiver of uninitialized constantnobu2015-10-281-4/+4
| | | | | | | | | * 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
* * vm_method.c(rb_method_entry_make):sorah2015-10-261-1/+1
| | | | | | | [DOC] [ci skip] Remove a needless space from comment [Fixes GH-1069] Patch by @yui-knk git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_method.c: remove common codenobu2015-10-241-16/+1
| | | | | | * vm_method.c (rb_undef): remove code almost common to proc.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: remove METHOD_ENTRY_SAFE(me) and related codeko12015-10-061-3/+1
| | | | | | | | | | 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
* vm_eval.c: cache resultsnobu2015-08-221-7/+15
| | | | | | | | * 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
* vm_eval.c: redefined respond_to_missing?nobu2015-08-201-20/+37
| | | | | | | * vm_method.c (basic_obj_respond_to): call respond_to_missing? only when redefined. [ruby-core:70460] [Bug #11465] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c: share with rb_obj_respond_tonobu2015-08-201-5/+20
| | | | | | | | | * vm_eval.c (check_funcall_respond_to): share the behavior with rb_obj_respond_to. [ruby-core:70460] [Bug #11465] * vm_method.c (vm_respond_to): extract from rb_obj_respond_to and merge r39881. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_method.c: reuse method entrynobu2015-08-191-5/+12
| | | | | | | * 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
* * id_table.h: introduce ID key table.ko12015-08-121-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | [Feature #11420] This table only manage ID->VALUE table to reduce overhead of st. Some functions prefixed rb_id_table_* are provided. * id_table.c: implement rb_id_table_*. There are several algorithms to implement it. Now, there are roughly 4 types: * st * array * hash (implemented by Yura Sokolov) * mix of array and hash The macro ID_TABLE_IMPL can choose implementation. You can see detailes about them at the head of id_table.c. At the default, I choose 34 (mix of list and hash). This is not final decision. Please report your suitable parameters or your data structure. * symbol.c: introduce rb_id_serial_t and rb_id_to_serial() to represent ID by serial number. * internal.h: use id_table for method tables. * class.c, gc.c, marshal.c, vm.c, vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c: typo fix [fix GH-993][ci skip] Patch by @0x0deahsbt2015-08-111-8/+8
| | | | | | * test/ruby/test_refinement.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * make rb_iseq_t T_IMEMO object (type is imemo_iseq).ko12015-07-211-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * method.h: introduce rb_callable_method_entry_t to removeko12015-07-031-96/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* vm_method.c: remove unused codenobu2015-07-011-12/+0
| | | | | | | * vm_method.c (rb_method_entry_make): remove unused code to prohibit method re-definition, introduced at r34983. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_method.c: no NOEX macrosnobu2015-07-011-9/+4
| | | | | | | * vm_method.c (rb_method_entry_make): NOEX macros are no longer defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_method.c: orignial visibilitiesnobu2015-07-011-6/+8
| | | | | | | * vm_method.c (Init_eval_method): copy the orignial visibilities, instead of setting explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move RB_GC_GUARD responsibility to rb_add_method_iseqnormal2015-06-301-0/+1
| | | | | | | | | | | | | | | | | | | This simplifies all the callers and makes code easier to use and review. I was confused about the need for RB_GC_GUARD in define_{aset,aref}_method of struct.c without reading rb_add_method_iseq. Likewise, do the same for rb_iseq_clone, where the GC guard only seems neccesary iff RGenGC is disabled. * vm_method.c (rb_add_method_iseq): add RB_GC_GUARD * class.c (clone_method): remove RB_GC_GUARD * struct.c (define_aref_method): ditto (define_aset_method): ditto * vm.c (vm_define_method): * iseq.c (rb_iseq_clone): add RB_GC_GUARD git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c (rb_method_entry_create): need to callko12015-06-251-3/+5
| | | | | | | | | | | | | method_definition_reset() if def is given. Actually, `me' is a new object, so we don't need to call it. It is just to make sure. * vm_method.c (method_definition_reset): remove duplicated insertion. * vm_method.c (rb_method_entry_clone): assgine dst->def here, not in method_definition_reset(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c: make a rb_method_definition_t data (def) *after* makingko12015-06-251-107/+110
| | | | | | | | | | | | | | | | | a rb_method_entry_t data (me). Normally, `me' points `def'. Some Ruby objects pointed from `def' and objects are marked by `me' (mark_method_entry() in gc.c). However, `def' is built before making a `me', then nobody can mark objects pointed from `def' before making (and pointing from) `me'. I hope this patch solve #11244. * vm_method.c: remove `rb_' prefix from some static functions. * method.h (rb_method_entry_create): constify * gc.c (mark_method_entry): add checking `def' and `def->body.iseq.iseqptr' availability because they can be NULL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c (rb_method_definition_reset): need a WB forko12015-06-241-2/+8
| | | | | | | | VM_METHOD_TYPE_ATTRSET. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_method.c: use the current visibilitynobu2015-06-241-10/+12
| | | | | | | * vm_method.c (rb_attr): simply use the current visibility, instead of tests for each visibilities. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_method.c: remove redundant checknobu2015-06-241-9/+2
| | | | | | | | * vm_method.c (rb_attr): remove redundant check. attribute names given in ruby level should be checked before calling this function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: embed rb_method_entry_t::attr::flags (5 bits) intoko12015-06-101-8/+6
| | | | | | | | | | | | rb_method_entry_t::flags to make one word spare space. Add some macros to access these flags. * vm_method.c: use these macros. * internal.h: define IMEMO_FL_USHIFT and IMEMO_FL_USER[0-4] for T_IMEMO local flags. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c: use VM_ASSERT instead of assert().ko12015-06-101-3/+3
| | | | | | | | | | * vm_args.c: ditto. * vm_insnhelper.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: back to share rb_method_definition_t byko12015-06-061-60/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * internal.h: move definition of rb_cref_t to method.h.ko12015-06-051-2/+2
| | | | | | | | | | | | | | | | | * eval_intern.h: move definition of rb_scope_visibility_t to method.h. * method.h: change rb_cref_t::scope_visi from VALUE to rb_scope_visibility_t. [Bug #11219] * vm.c (vm_cref_new): accept rb_method_visibility_t directly. * vm_insnhelper.c (rb_vm_rewrite_cref): don't use 0, but METHOD_VISI_UNDEF. * vm_method.c (rb_scope_visibility_set): don't need to use cast. * vm_method.c (rb_scope_module_func_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c (rb_add_method_iseq): use intermediate struct toko12015-06-041-4/+8
| | | | | | | | | | avoid initializing struct with variables. [Bug #11217] * method.h: add a comment about it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: constify rb_method_refined_t::orig_me.ko12015-06-041-11/+10
| | | | | | | | | | | | | | | Also constify the following functions. * rb_resolve_refined_method() * rb_method_entry_with_refinements() * rb_method_entry_without_refinements() * rb_method_entry_copy()'s parameter. * class.c: catch up this fix. * vm_insnhelper.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: introduce rb_method_refined_t for refined method entry.ko12015-06-031-10/+10
| | | | | | | | | | | | * 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
* * vm_method.c: rename `rb_frame_...' to `rb_scope_...'.ko12015-06-031-10/+10
| | | | | | | | | * eval_intern.h: move decl. of rb_scope_visibility_set() to method.h. * load.c: catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: split rb_method_definition_t::flag to several flags.ko12015-06-031-84/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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
* * vm_method.c (rb_method_definition_set): remove a double assignment.mame2015-06-021-1/+1
| | | | | | Coverity Scan found this bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c (rb_alias): rename parameter names.ko12015-06-021-9/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: remove rb_method_iseq_t::iseqval.ko12015-06-021-9/+10
| | | | | | | | | | | | | While making a r50728, iseqval is needed (to mark correctly), but now just iseqptr is enough. * class.c: catch up this fix. * gc.c: ditto. * proc.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e