summaryrefslogtreecommitdiff
path: root/class.c
AgeCommit message (Collapse)Author
2016-09-12Copy the serial number from the super class to the singleton classtenderlove
This helps hit inline method caches more frequently. Before this commit: ``` [aaron@TC ruby (trunk)]$ time ./ruby -v benchmark/bm_vm2_poly_singleton.rb ruby 2.4.0dev (2016-09-12 trunk 56141) [x86_64-darwin15] real 0m3.679s user 0m3.632s sys 0m0.022s ``` After this commit: ``` [aaron@TC ruby (trunk)]$ time ./ruby -v benchmark/bm_vm2_poly_singleton.rb ruby 2.4.0dev (2016-09-12 trunk 56141) [x86_64-darwin15] last_commit=Copy the serial number from the super class to the singleton class real 0m2.246s user 0m2.203s sys 0m0.020s ``` [Feature #12364] [ruby-core:75425] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07class.c: instance method conditionsnobu
* class.c (ins_methods_i, ins_methods_prot_i, ins_methods_priv_i), (ins_methods_pub_i): check for each conditions to match. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-23internal.h: inline Check_Typenobu
* internal.h (Check_Type): inline check for the object type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-16prevent rb_cObject from GCnobu
* class.c (Init_class_hierarchy): prevent rb_cObject which is the class tree root, from GC. [ruby-dev:49666] [Bug #12492] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25* class.c (rb_define_class): Fix documentation.eregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25class.c: simplifynobu
* class.c (rb_scan_args): merge code for n_trail. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22* class.c (rb_scan_args): moved to bottom of the file to make thenaruse
effect of `#undef rb_scan_args` the minimum. * include/ruby/ruby.h (rb_scan_args): overwrite only if GCC and optimized. Visual C++ 14 or later can compile it but make it conservative. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21Revert r50102naruse
This reverts "* include/ruby/ruby.h (rb_scan_args): don't use ALWAYS_INLINE with" This rb_scan_args macro is GCCism. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21* include/ruby/ruby.h (rb_scan_args): use __VA_ARGS__ instead ofnaruse
va_arg to allow compilers optimize more aggressive. https://gustedt.wordpress.com/2011/07/10/avoid-writing-va_arg-functions/ rb_scan_args is now expected to be statically resolved. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-07class.c: err if superclass is 0nobu
* class.c (rb_define_class, rb_define_class_id_under): raise ArgumentError if super is 0, deprecated behavior which has been warned long time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-12resolve class name earlier and more consistentlynormal
This further avoids class name resolution issues which came about due to relying on hash table ordering before r53376. Pre-caching the class name when it is never used raises memory use, but the overall gain from moving away from st still gives us a small gain. Reverting r53376 and this patch and testing with "valgrind -v ./ruby -rrdoc -eexit" on x86 (32-bit) shows: before: in use at exit: 1,662,239 bytes in 25,286 blocks total heap usage: 49,514 allocs, 24,228 frees, 6,005,561 bytes allocated after, with this change: in use at exit: 1,646,529 bytes in 24,572 blocks total heap usage: 48,891 allocs, 24,319 frees, 6,003,921 bytes allocated * class.c (Init_class_hierarchy): resolve name for rb_cObject ASAP * object.c (rb_mod_const_set): move name resolution to rb_const_set * variable.c (rb_const_set): do class resolution here [ruby-core:72807] [Bug #11977] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29use id_table for constant tablesnormal
valgrind 3.9.0 on x86-64 reports a minor reduction in memory usage when loading only RubyGems and RDoc by running: ruby -rrdoc -eexit before: HEAP SUMMARY: in use at exit: 2,913,448 bytes in 27,394 blocks total heap usage: 48,362 allocs, 20,968 frees, 9,034,621 bytes alloc after: HEAP SUMMARY: in use at exit: 2,880,056 bytes in 26,712 blocks total heap usage: 47,791 allocs, 21,079 frees, 9,046,507 bytes alloc * class.c (struct clone_const_arg): adjust for id_table (clone_const): ditto (clone_const_i): ditto (rb_mod_init_copy): ditto (rb_singleton_class_clone_and_attach): ditto (rb_include_class_new): ditto (include_modules_at): ditto * constant.h (rb_free_const_table): ditto * gc.c (free_const_entry_i): ditto (rb_free_const_table): ditto (obj_memsize_of): ditto (mark_const_entry_i): ditto (mark_const_tbl): ditto * internal.h (struct rb_classext_struct): ditto * object.c (rb_mod_const_set): resolve class name on assignment * variable.c (const_update): replace with const_tbl_update (const_tbl_update): new function (fc_i): adjust for id_table (find_class_path): ditto (autoload_const_set): st_update => const_tbl_update (rb_const_remove): adjust for id_table (sv_i): ditto (rb_local_constants_i): ditto (rb_local_constants): ditto (rb_mod_const_at): ditto (rb_mod_const_set): ditto (rb_const_lookup): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-22gc.c: do not expose internal singleton classnobu
* gc.c (internal_object_p): should not expose singleton classes without a metaclass. based on patches by ko1 and shugo. [Bug #11740] * class.c (rb_singleton_class_object_p): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-21revert r53228 because this patch breaks rubyspecko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-21* gc.c (internal_object_p): should not expose singleton classesko1
without a metaclass. [Bug #11740] * class.c (rb_singleton_class_has_metaclass_p): added. * test/ruby/test_class.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-04* class.c: fix documentation for rb_define_class{_id}_under.hsbt
[fix GH-991][ci skip] Patch by @kachick git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-30variable.c: rb_class_ivar_setnobu
* variable.c (rb_class_ivar_set): rename as class specific ivar setter, and st_table is no longer involved. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-30variable.c (rb_st_insert_id_and_value): reduce argsnormal
Minor simplification; this will hopefully make future patches for switching to id_table easier-to-review. * internal.h (rb_st_insert_id_and_value): update prototype * variable.c (rb_st_insert_id_and_value): reduce args (find_class_path): adjust call for less args (rb_ivar_set): ditto (rb_cvar_set): ditto * class.c (rb_singleton_class_attached): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-27class.c: refine error messagesnobu
* class.c (rb_define_class, rb_define_class_id_under): refine error messages. * class.c (rb_define_module, rb_define_module_id_under): ditto, and make consistent with class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-31* class.c (move_refined_method): should insert a write barrierko1
from an original class to a created (cloned) method entry. * test/ruby/test_refinement.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-12* class.c (move_refined_method): same as the last commit.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-12* class.c, gc.c vm.c: use ID_TABLE_* instead of ST_*ko1
(such as ST_CONTINUE) for enum rb_id_table_iterator_result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-12* id_table.h: introduce ID key table.ko1
[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
2015-07-21* make rb_iseq_t T_IMEMO object (type is imemo_iseq).ko1
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
2015-07-07* iseq.c, internal.h (rb_iseq_clone): removed because we don't need toko1
clone iseq any more. * class.c (clone_method): share iseq between cloned methods. All of method dependent information are able to refer from method entry. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51171 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-30move RB_GC_GUARD responsibility to rb_add_method_iseqnormal
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
2015-06-28class.c: preserve encodingnobu
* class.c (rb_check_inheritable): preserve encoding in an error message when the superclass is not a class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-28class.c: TypeError when superclass mismatchnobu
* class.c (rb_define_class_id_under): raise TypeError exception same as ruby level class definition when superclass mismatch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-18* method.h: constify rb_method_alias_struct::original_me andko1
rb_method_refined_struct::orig_me. * class.c (move_refined_method): use RB_OBJ_WRITE() for me->def->body.refined.orig_me. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50948 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-06* class.c: ins_methods_push() needs rb_method_visibility_t type onko1
2nd arg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-06* class.c (ins_methods_push): Change type and name of parametersko1
to make more clear. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-06class.c: suppress a warningnobu
* class.c (ins_methods_push): suppress a signed and unsigned comparison warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-05* class.c (ins_methods_push): change 3rd parameter's typeko1
from long to rb_method_visibility_t. * class.c (ins_methods_i): catch up this fix. * class.c (method_entry_i): cast to st_data_t instead of `long'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-04* method.h: constify rb_method_refined_t::orig_me.ko1
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
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 (method_entry_i): mtbl should not have `me' as NULL.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03* class.c (clone_method): do not use me->klass, but use explicitlyko1
passed argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03* vm_core.h (rb_vm_rewrite_cref_stack): rename to rb_vm_rewrite_cref().ko1
* class.c (clone_method): use renamed name. * vm_insnhelper.c (rb_vm_rewrite_cref): do not use `node' in variable names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50752 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* 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: remove rb_method_iseq_t::iseqval.ko1
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
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-01* class.c: remove needless include pragmra for method.h.ko1
* struct.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-31* class.c (rb_class_has_methods): added to reduce depenedencyko1
to internal class data structure. * internal.h: ditto. * hash.c (has_extra_methods): use added function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50700 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-03-11* gc.c: fix memory leak by prepend method.ko1
It is easy to reproduce with such script: module M; def bar; end; end loop{ Class.new do def foo; end prepend M end } * gc.c (obj_free): free T_ICLASS::m_tbl if it is created by prepend. To recognize it, check RICLASS_IS_ORIGIN flag. * gc.c (gc_mark_children): T_ICLASS objects only need to mark T_ICLASS::m_tbl if RICLASS_IS_ORIGIN is set. * gc.c (obj_memsize_of): count T_ICLASS if RICLASS_IS_ORIGIN is set. * internal.h (RCLASS_SET_ORIGIN): add to set RCLASS_SET_ORIGIN. TODO: The word `origin' seems not good name. We need to invent another good name. * class.c: use RCLASS_SET_ORIGIN(). * class.c (class_alloc): zero clear rb_classext_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49931 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-06* class.c (rb_prepend_module): need a WB for klass -> origin.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e