summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2013-06-05 * gc.c (gc_mark): get rid of pushing useless objests.tarui
* gc.c (rgengc_rememberset_mark): bypass gc_mark() in order to push sunny old object at minor gc. * gc.c (gc_mark_children): move sunny old check to gc_mark(). * gc.c (rgengc_check_shady): remove DEMOTE that already unnecessary. * gc.c (rb_gc_writebarrier): ditto. change sunny old check point in order to save mark stack and remove unnatural rest_sweep & demote. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05 * gc.c (rgengc_rememberset_mark): change scan algorithm for performance:tarui
from object's pointer base to bitmap one. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05use attribute is more simple way for r41083naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-05* gc.c (before_gc_sweep): don't optimize it to avoid segv on Ubuntunaruse
10.04 gcc 4.4. http://u32.rubyci.org/~chkbuild/ruby-trunk/log/20130527T190301Z.diff.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-29* gc.c (gc_profile_enable): rest_sweep() to finish last GC.ko1
Profiling record is allocated at first of marking phase. Enable at lazy sweeping may cause an error (SEGV). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27* gc.c (gc_stat): remove wrong rest_sweep().ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27* gc.c (garbage_collect_body): fix GC_ENABLE_LAZY_SWEEP condition.ko1
* gc.c (GC_NOTIFY): move debug print location and use stderr instead of stdout. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27* include/ruby/ruby.h, gc.c: add new internal eventko1
RUBY_INTERNAL_EVENT_GC_END. This event invokes at the end of after_sweep(). Time chart with lazy sweep is here: (1) Kick RUBY_INTERNAL_EVENT_GC_START (2) [gc_marks()] (3) [lazy_sweep()] (4) [... run Ruby program (mutator) with lazy_sweep() ...] (5) [after_sweep()] (6) Kick RUBY_INTERNAL_EVENT_GC_END (7) [... run Ruby program (mutator), and go to (1) ...] * ext/-test-/tracepoint/tracepoint.c, test/-ext-/tracepoint/test_tracepoint.rb: modify a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27* include/ruby/ruby.h: rename RUBY_INTERNAL_EVENT_FREE toko1
RUBY_INTERNAL_EVENT_FREEOBJ. * ext/-test-/tracepoint/tracepoint.c, ext/objspace/object_tracing.c, gc.c, vm_trace.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27* ext/objspace/objspace.c: support ObjectSpace.trace_object_allocations.ko1
Read the following test to know HOWTO. This feature is a sample of RUBY_INTERNAL_EVENT. * test/objspace/test_objspace.rb: add a test. * ext/objspace/object_tracing.c: ditto. * gc.c (rb_gc_count): add. THis function returns GC count. * internal.h: add decl. of rb_gc_count(). Same as `GC.count'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27* include/ruby/ruby.h, gc.c, vm_trace.c: add internal events.ko1
* RUBY_INTERNAL_EVENT_NEWOBJ: object created. * RUBY_INTERNAL_EVENT_FREE: object freeed. * RUBY_INTERNAL_EVENT_GC_START: GC started. And rename `RUBY_EVENT_SWITCH' to `RUBY_INTERNAL_EVENT_SWITCH'. Internal events can not invoke any Ruby program because the tracing timing may be critical (under huge restriction). These events can be hooked only by C-extensions. We recommend to use rb_potponed_job_register() API to call Ruby program safely. This change is mostly written by Aman Gupta (tmm1). https://bugs.ruby-lang.org/issues/8107#note-12 [Feature #8107] * include/ruby/debug.h, vm_trace.c: added two new APIs. * rb_tracearg_event_flag() returns rb_event_flag_t of this event. * rb_tracearg_object() returns created/freeed object. * ext/-test-/tracepoint/extconf.rb, ext/-test-/tracepoint/tracepoint.c, test/-ext-/tracepoint/test_tracepoint.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26* include/ruby/debug.h, vm_trace.c: add rb_postponed_job API.ko1
Postponed jobs are registered with this API. Registered jobs are invoked at `ruby-running-safe-point' as soon as possible. This timing is completely same as finalizer timing. There are two APIs: * rb_postponed_job_register(flags, func, data): register a postponed job with data. flags are reserved. * rb_postponed_job_register_one(flags, func, data): same as `rb_postponed_job_register', but only one `func' job is registered (skip if `func' is already registered). This change is mostly written by Aman Gupta (tmm1). https://bugs.ruby-lang.org/issues/8107#note-15 [Feature #8107] * gc.c: use postponed job API for finalizer. * common.mk: add dependency from vm_trace.c to debug.h. * ext/-test-/postponed_job/extconf.rb, postponed_job.c, test/-ext-/postponed_job/test_postponed_job.rb: add a test. * thread.c: implement postponed API. * vm_core.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26* gc.c (gc_stat): collect promote_operation_count andko1
types (RGENGC_PROFILE >= 2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26* gc.c (gc_stat): collect shade_operation_count,ko1
remembered_sunny_object_count and remembered_shady_object_count for each types when RGENGC_PROFILE >= 2. They are informative for optimization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26* hash.c (rb_hash_tbl_raw), internal.h: added.ko1
Returns st_table without shading hash. * array.c: use rb_hash_tbl_raw() for read-only purpose. * compile.c (iseq_compile_each): ditto. * gc.c (count_objects): ditto. * insns.def: ditto. * process.c: ditto. * thread.c (clear_coverage): ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-25* gc.c (after_gc_sweep): reduce full GC timing.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-24* gc.c: do major/full GC when:ko1
* number of oldgen object is biggger than twice of number of oldgen object at last full GC. * number of remembered shady object is bigger than twice of number of remembered shady object at last full GC. * number of oldgen object and remembered shady object is bigger than half of total object space. (please fix my English!) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-24* gc.c (after_gc_sweep, garbage_collect_body): do major GC (full GC)ko1
before extending heaps. TODO: do major GC when there are many old (promoted) objects. * gc.c (after_gc_sweep): remove TODO comments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-23gc.c: revert r40898nobu
* gc.c (gc_profile_dump_on): revert r40898. ok to show the record accumulating while lazy_sweep(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-23 * gc.c: do not dump the last recordnobu
* gc.c (gc_profile_dump_on): do not dump the last record, for some reason. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-22gc.c: use size_t and no header if next_index == 0nobu
* gc.c (gc_profile_dump_on): use size_t to get rid of overflow and show the header when next_index > 0, instead of next_index != 1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-22* gc.c (gc_prepare_free_objects, rest_sweep, lazy_sweep): fix positionko1
of `during_gc' setting. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21* gc.c (garbage_collect): all GC is start from garbage_collect()ko1
(or garbage_collect_body()). `garbage_collect()' accept additional two parameters `full_mark' and `immediate_sweep'. If `full_mark' is TRUE, then force it full gc (major gc), otherwise, it depends on status of object space. Now, it will be minor gc. If `immediate_sweep' is TRUE, then disable lazy sweep. To allocate free memory, `full_mark' and `immediate_sweep' should be TRUE. Otherwise, they should be FALSE. * gc.c (gc_prepare_free_objects): use `garbage_collect_body()'. * gc.c (slot_sweep, before_gc_sweep, after_gc_sweep): add logging code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21* gc.c: remove gc_profile_record::is_marked. always true.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21* gc.c: fix to collect additional information for GC::Profiler.ko1
* major/minor GC * trigger reason of GC * gc.c (gc_profile_dump_on): change reporting format with added information. * gc.c (gc_profile_record_get): return added information by :GC_FLAGS => array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21* gc.c: GC::Profiler's sweeping time is accumulated all slotko1
sweeping time. At lazy GC, GC::Profiler makes new record entry for each lazy_sweep(). In this change, accumulating all slot_sweep() time. And change indentation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21* gc.c (gc_profile_dump_on): `count' should be (int) because itko1
can be negative number. And use pointer for `record' (don't copy). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-17gc.c: rb_gc_guarded_ptrnobu
* gc.c (rb_gc_guarded_ptr): unoptimize on other compilers than gcc and msvc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-15* gc.c (rb_node_newnode): use newobj_of() instead of rb_newobj().ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-15* gc.c (newobj): rename to `newobj_of' and accept additionalko1
three parameters v1, v2, v3. newobj_of() do OBJSETUP() and fill values with v1, v2, v3. * gc.c (rb_data_object_alloc, rb_data_typed_object_alloc): use newobj_of(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-15* gc.c: add an additional RGENGC_PROFILE mode (2).ko1
Profiling result can be check by GC.stat. * gc.c (type_name): separate from obj_type_name(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-14* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* gc.c: support RGENGC. [ruby-trunk - Feature #8339]ko1
See this ticet about RGENGC. * gc.c: Add several flags: * RGENGC_DEBUG: if >0, then prints debug information. * RGENGC_CHECK_MODE: if >0, add assertions. * RGENGC_PROFILE: if >0, add profiling features. check GC.stat and GC::Profiler. * include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0). * array.c: add write barriers for T_ARRAY and generate sunny objects. * include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if you want to access raw pointers. If you modify the contents which pointer pointed, then you need to care write barrier. * bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects. * complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX and generate sunny objects. * rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write barriers for T_RATIONAL and generate sunny objects. * internal.h: add write barriers for RBasic::klass. * numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects. * object.c (rb_class_allocate_instance), range.c: generate sunny T_OBJECT objects. * string.c: add write barriers for T_STRING and generate sunny objects. * variable.c: add write barriers for ivars. * vm_insnhelper.c (vm_setivar): ditto. * include/ruby/ruby.h, debug.c: use two flags FL_WB_PROTECTED and FL_OLDGEN. * node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED): move flag bits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* gc.c: remove rb_objspace_t::marked_num.ko1
We can use `objspace_live_num()' instead of removed `marked_num' if it is after `after_gc_sweep()' function call. * gc.c (after_gc_sweep): use objspace_live_num() instead of removed rb_objspace_t::marked_num. * gc.c (gc_mark_ptr, gc_marks): remove rb_objspace_t::marked_num code. * gc.c (gc_prepare_free_objects): do not call set_heaps_increment() with checking objspace->heap.marked_num. At this point, we only need to check availability of free-cell. * gc.c (gc_prepare_free_objects): * gc.c (lazy_sweep): call after_gc_sweep() if there are no sweep_able entry. * gc.c (rest_sweep, gc_prepare_free_objects): remove after_gc_sweep() call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* gc.c: disable GC_PROFILE_MORE_DETAIL (fix last commit).ko1
* gc.c (gc_prof_set_malloc_info): fix "objspace->heap.live_num" to "objspace_live_num(objspace)". There is no such member variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* gc.c: refactoring GC::Profiler.ko1
* gc.c (gc_prof_sweep_timer_start/stop): removed because they doesn't support lazy sweep. * gc.c (gc_prof_sweep_slot_timer_start/stop): added. redefine `sweeping time' to accumulated time of all of slot_sweep(). * gc.c (rb_objspace_t::profile::count): renamed to rb_objspace_t::profile::next_index. `counter' seems ambiguous. increment it when next record is acquired. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* include/ruby/ruby.h: constify RBasic::klass and addko1
RBASIC_CLASS(obj) macro which returns a class of `obj'. This change is a part of RGENGC branch [ruby-trunk - Feature #8339]. * object.c: add new function rb_obj_reveal(). This function reveal interal (hidden) object by rb_obj_hide(). Note that do not change class before and after hiding. Only permitted example is: klass = RBASIC_CLASS(obj); rb_obj_hide(obj); .... rb_obj_reveal(obj, klass); TODO: API design. rb_obj_reveal() should be replaced with others. TODO: modify constified variables using cast may be harmful for compiler's analysis and optimizaton. Any idea to prohibt inserting RBasic::klass directly? If rename RBasic::klass and force to use RBASIC_CLASS(obj), then all codes such as `RBASIC(obj)->klass' will be compilation error. Is it acceptable? (We have similar experience at Ruby 1.9, for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)". * internal.h: add some macros. * RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal object. * RBASIC_SET_CLASS(obj, cls) set RBasic::klass. * RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS without write barrier (planned). * RCLASS_SET_SUPER(a, b) set super class of a. * array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c, file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c, parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c, string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c: Use above macros and functions to access RBasic::klass. * ext/coverage/coverage.c, ext/readline/readline.c, ext/socket/ancdata.c, ext/socket/init.c, * ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko1
instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* gc.c (rb_data_object_alloc): check klass only if klass is not 0.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* gc.c (rb_data_object_alloc, rb_data_typed_object_alloc):ko1
use NEWOBJ_OF() instead of NEWOBJ(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-30gc.c: _aligned_mallocnobu
* gc.c (aligned_malloc): declare _aligned_malloc() prototype for old VC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24gc.c: fix compile errornobu
* gc.c (gc_prepare_free_objects): fix compile error. there should be free objects when new slot is added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24* gc.c (GC_ENABLE_LAZY_SWEEP): new macro to switch lazy sweepingnari
for debugging. [Feature #8024] [ruby-dev:47135] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24* gc.c: We have no chance to expand the heap when lazy sweeping isnari
restricted. So collecting is often invoked if there is not enough free space in the heap. Try to expand heap when this is the case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-18* gc.c: Improve accuracy of objspace_live_num() andnari
allocated/freed counters. patched by tmm1(Aman Gupta). [Bug #8092] [ruby-core:53392] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-18* gc.c: Avoid unnecessary heap growth. patched by tmm1(Aman Gupta).nari
[Bug #8093] [ruby-core:53393] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-18* gc.c: Fix unlimited memory growth with large values ofnari
RUBY_FREE_MIN. patched by tmm1(Aman Gupta). [Bug #8095] [ruby-core:53405] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-13* gc.c: allow to tune growth of heap by environment variablenari
RUBY_HEAP_SLOTS_GROWTH_FACTOR. patched by tmm1(Aman Gupta). [Feature #8015] [ruby-core:53131] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e