summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2015-12-09* gc.c (gc_mark_stacked_objects): fix typo.ko1
reported by XIE Zhibang. [Bug #11763] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09* *.c (*_memsize): do not check ptr.ko1
NULL checking is finished Before call of memsize functions. See r52979. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08gc.c: NULL check at memsizenobu
* gc.c (rb_objspace_data_type_memsize): consider NULL data uses no memory without calling dsize function as well as other functions. fix SEGV in test/objspace with RUBY_ISEQ_DUMP_DEBUG=to_binary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08make local symbols staticnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-22* gc.c (rb_raw_obj_info): fix compile errors when USE_RGENGCodaira
is 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-19* gc.c (gc_start): force to invoke GC by GC.startko1
even if it is GC.disable'd. * test/ruby/test_gc.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-19* gc.c: trivial performance improvements.ko1
name modified vm1_gc_short_lived* 1.015 vm1_gc_short_with_complex_long* 1.014 vm1_gc_short_with_long* 1.000 vm1_gc_short_with_symbol* 1.016 vm1_gc_wb_ary* 1.002 vm1_gc_wb_ary_promoted* 0.996 vm1_gc_wb_obj* 1.045 vm1_gc_wb_obj_promoted* 1.014 vm3_gc 1.021 * gc.c (gc_writebarrier_generational): reorder parameters to optimize register passing function call. * gc.c (gc_writebarrier_incremental): ditto. * gc.c (rb_gc_writebarrier): remove LIKELY(). LIKELY() seems to move related functions not better places. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-18gc.c: use BUILTIN_TYPEnobu
* gc.c (rb_raw_obj_info): BUILTIN_TYPE works fro non-special_const objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-18* gc.c (rb_raw_obj_info): fix trivial issues.ko1
* support SPECIAL_CONSTs. * fix IMEMO/ment outputs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-31internal.h: RUBY_DTRACE_HOOKnobu
* 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
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-30* gc.c (newobj_slowpath): do not need to use flags hack (commit miss).ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-30* gc.c (heap_get_freeobj_from_next_freepage): not so UNLIKELY.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-30* gc.c (newobj_slowpath): reduce 1 parameter to use only registersko1
for performance. On my laptop, 'N.times{x = []}' (where N = 29_000_000) is 1.86 sec -> 1.74 sec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29* gc.c (gc_mark_ptr): specify NOINLINE so that gc_mark() can returnko1
immediately when obj is not a markable object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29gc.c: separate event hook call from newobj_initnobu
* gc.c (newobj_init): separate event hook call and remove the argument for it. * gc.c (newobj_slowpath): call event hook after initialized the new object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29* gc.c (rb_imemo_new): should not pass FL_WB_PROTECTED flag.ko1
* gc.c (rb_wb_protected_newobj_of): add more assertions. * gc.c (rb_wb_unprotected_newobj_of): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29* gc.c: introduce rb_wb_unprotected_newobj_of() andko1
rb_wb_protected_newobj_of(), pass the WB_PROTECTED information explicitly. * internal.h: use introduced functions by NEWOBJ_OF(). `flag' is immediate value, so that C compilers can solve them at compile time. * include/ruby/ruby.h: add a commnent about that. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29gc.c: fix UNLIKELY usagenobu
* gc.c (gc_event_hook_needed_p): UNLIKELY makes no sense for boolean flag value. * gc.c (gc_event_hook, newobj_init): use in conditions instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29* gc.c: add rb_objspace::flags::has_hook to represent hook availability.ko1
* gc.c: add gc_event_hook_available_p(objspace) to check that flag. * gc.c (newobj_of): use gc_event_hook_available_p() instead of checking gc_event_hook_needed_p(objspace, RUBY_INTERNAL_EVENT_NEWOBJ). for performance. * gc.c (newobj_init): add UNLIKELY() for FL_WB_PROTECTED flag. * gc.c (newobj_init): change parameters order (trivial change). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29* gc.c (gc_mark_ptr): remove debug code for #11244.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29revert r52336 (commit miss)ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29* gc.c (gc_mark_ptr): remove debug code for #11244.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18* numeric.c: Good-by Borland-C.kosaki
* include/ruby/backward/rubyio.h: ditto. * include/ruby/backward/st.h: ditto. * include/ruby/backward/util.h: ditto. * include/ruby/backward/rubysig.h: ditto. * include/ruby/backward/classext.h: ditto. * dln.c: ditto. * gc.c: ditto. * win32/resource.rb: ditto. * win32/dir.h: ditto. * ext/tk/tcltklib.c: ditto. * NEWS: announce that Borland-C is no longer supported. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18* dln.c: simplify #ifdef. _WIN32 and __CYGWIN__ are exclusive.kosaki
see include/ruby/defines.h * gc.c: ditto. * ext/sdbm/_sdbm.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-10* gc.c (newobj_of_slowpass): fix typo (pass -> path).ko1
Pointed out by Yukihiro Matsumoto <matz@ruby-lang.org>. * gc.c (newobj_of_...): `of' is unnecessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-10* import a github pull requestko1
https://github.com/ruby/ruby/pull/1050 by Kazuho Oku <kazuho@natadeco.co>. This pull request has the following commits. * gc.c: reduce # of args to 6 (max. of register args on x86-64) so that the `newobj_of_slowpass` can be called via TCO. * gc.c (newobj_of), string.c (str_duplicate): for performance, the hot functions must be inlined. * gc.c: for performance, preceding arguments of `.*newobj_of.*` must be same, so that the arg registers can be reused in case of TCO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-07* gc.c (newobj_of): divide fast path and slow pathko1
to avoid register savings for fast path. This idea is given by Kazuho Oku <kazuho@natadeco.co>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06* gc.h, gc.c: introduce new debug function rb_obj_info_dump(VALUE obj)ko1
which prints the result of rb_raw_obj_info(..., obj). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-15gc.c: define objspace functions alwaysnobu
* gc.c (rb_objspace_alloc, rb_objspace_free): define always regardless ENABLE_VM_OBJSPACE, and free heap pages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-07vm_core.h: objspace alwaysnobu
* vm_core.h (rb_vm_struct): define objspace always regardless ENABLE_VM_OBJSPACE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-03* gc.c (rb_raw_obj_info): iseq->body->location.first_lineno is Fixnum.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-03* gc.c (rb_raw_obj_info): should support IMEMO/iseq.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-16* gc.c (gc_mark_children): check if RCLASS_EXT is validktsj
before marking. This fixes the following test failure introduced in r51126: make test-all TESTOPTS='--gc-stress ruby/test_refinement.rb' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51591 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-08-11ruby.h: check integer overflownobu
* include/ruby/ruby.h (ALLOCV_N): check integer overflow, as well as ruby_xmalloc2. pointed out by Paul <pawlkt AT gmail.com>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-06gc.c: move tmp buffer functionsnobu
* gc.c (rb_alloc_tmp_buffer, rb_free_tmp_buffer): move from node.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-06ruby_atomic.h: atomic VALUE operationsnobu
* ruby_atomic.h (ATOMIC_VALUE_EXCHANGE, ATOMIC_VALUE_CAS): add atomic operations for VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-29* gc.c: document argument passed to finalizer proc.hsbt
[fix GH-976][ci skip] Patch by @alexdowad git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51418 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-21* gc.c (internal_object_p): Now a singleton classes appear byko1
ObjectSpace.each_object. [Bug #11360] * test/ruby/test_objectspace.rb: add a test about it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-18gc.c: reduce EXEC_TAGsnobu
* gc.c (run_finalizer): set and restore safe level here to reduce nested EXEC_TAGs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14use _Static_assert with clangkazu
* gc.c (__has_feature): move into internal.h. * internal.h (__has_feature): ditto. * internal.h (__has_extension): new macro. * internal.h (STATIC_ASSERT): use _Static_assert with clang. [ruby-core:69931] [Bug #11343] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-05gc.c (gc_profile_record_get): fix spelling error in keysnormal
This may cause compatibility problems for some users, but maybe nobody tracked it closely in the past because it is disabled by default. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51151 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-07-02* gc.c: remove `#define RGENGC_OBJ_INFO 1' line introduced toko1
debug Bug #11244. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02* gc.c (rb_raw_obj_info): separated from rb_obj_info().ko1
Fill internal object information into passed buffer. * gc.h: declare rb_raw_obj_info(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-25* vm_method.c: make a rb_method_definition_t data (def) *after* makingko1
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
2015-06-24* gc.c (obj_info, method_type_name): show method type name in a stringko1
instead of a number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e