summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2013-07-24* array.c, gc.c: move ary_unprotect_logging() intoko1
rb_gc_unprotect_logging() which is general version * include/ruby/ruby.h: add USE_RGENGC_LOGGING_WB_UNPROTECT to enable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-23* gc.c (gc_before_sweep): fix spacing.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-23* gc.c (heap_get_freeobj): clear slot->freelist here.ko1
This means that this slot doesn't have any free objects. And store this slot with objspace->heap.using_slot. * gc.c (gc_before_sweep): restore objspace->freelist into objspace->heap.using_slot->freelist. This means that using_slot has free objects which are pointed from objspace->freelist. * gc.c (gc_slot_sweep): do not need to clear slot->freelist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-22* gc.c (gc_slot_sweep): need to add empty RVALUE as freeobj.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-19gc.c: suppress warningnobu
* gc.c (heap_assign_slot): suppress implicit conversion warning. delta is not greater than sizeof(RVALUE). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-19* gc.c: declare type_name() at the beggining of file.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-19* gc.c, internal.h (rb_gc_writebarrier_remember_promoted): add a newko1
function to remember an specified object. This api is only experimental (strongly depend on WB/rgengc strategy). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17* gc.c: rename gc related functions with prefix "gc_".ko1
* before_gc_sweep() -> gc_before_sweep(). * after_gc_sweep() -> gc_after_sweep(). * lazy_sweep() -> gc_lazy_sweep(). * rest_sweep() -> gc_rest_sweep(). * slot_sweep() -> gc_slot_sweep(). * gc.c: rename a heap management function with prefix "heap_". * get_freeobj() -> heap_get_freeobj(). * gc.c: rename markable_object_p() to is_markable_object(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17* gc.c: rename heap management functions with prefix "heap_".ko1
* allocate_sorted_array() -> heap_allocate_sorted_array(). * slot_add_freeobj() -> heap_slot_add_freeobj(). * assign_heap_slot() -> heap_assign_slot(). * add_heap_slots() -> heap_add_slots(). * init_heap() -> heap_init(). * set_heap_increment() -> heap_set_increment(). * gc.c (initial_expand_heap): inlined in rb_gc_set_params(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17* gc.c: catch up last changes for debugging/checking mode.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17* gc.c (rb_objspace_free): free slot itself.ko1
* gc.c (objspace_each_objects): fix condition. Use slot->body instead of slot. * gc.c (count_objects): use "slot" variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17* gc.c (unlink_heap_slot): fix memory leak.ko1
free slot itself at free_heap_slot(). Reproduce-able code is here: N1 = 100_000; N2 = 1_000_000 N1.times{ary = []; N2.times{ary << ''}} Maybe this problem is remaining in Ruby 2.0.0. * gc.c (unlink_heap_slot): remove not working code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17* gc.c: re-design the heap structure.ko1
(1) The heap is consists of a set of slots. (2) Each "slot" has a "slot_body". slot::start and slot::limit specify RVALUE beginning address and number of RVALUE in a "slot_body". (3) "slot_body" contains a pointer to slot (slot_body::header::slot) and an array of RVALUE. (4) heap::sorted is an array of "slots", sorted by an address of slot::body. See https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/GC_design for more details (figure). * gc.c: Avoid "heaps" terminology. It is ambiguous. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-17* gc.c: fix heaps_header and heaps_slot to reduce memory consumption.ko1
(1) move heaps_header::start and limit to heaps_slot. (2) remove heaps_header::end which can be calculated by start+limit. * gc.c: catch up above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* gc.c: slim a path of newobj_of().ko1
* gc.c (objspace): add a new field objspace::freelist, which contains available RVALUEs. * gc.c (newobj_of): simply call new function `get_freeobj()'. get_freeobj() returns objspace::freelist. If objspace::freelist is not available, refill objspace::freelist with a slot pointed by objspace::heap::free_slots. * gc.c (before_gc_sweep): clear objspace::freelist. * gc.c (slot_sweep): clear slot::freelist. * gc.c (heaps_prepare_freeslot): renamed to heaps_prepare_freeslot. * gc.c (unlink_free_heap_slot): remove unused function. * gc.c (rb_free_const_table): remove unused function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* gc.c (link_free_heap_slot): removed.ko1
* gc.c (slot_sweep): use `heaps_add_freeslot' instead of `link_free_heap_slot'. * gc.c (assign_heap_slot): use local variable `slot' instead of `heaps'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* gc.c (assign_heap_slot): refactoring variable names.ko1
* gc.c (slot_add_freeobj): added. * gc.c (heaps_add_freeslot): added. * gc.c (finalize_list, rb_gc_force_recycle, slot_sweep): use `slot_add_freeobj' instead of modifying linked list directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* gc.c (lazy_sweep): refactoring.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16revert last commit because it fails test-all.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-16* gc.c (after_gc_sweep): refactoring code.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-26* gc.c (is_before_sweep): Add a missing space before a parenthesis.kou
* gc.c (rb_gc_force_recycle): Add a missing space around a parenthesis. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-25 * gc.c (is_before_sweep): Add new helper function that check the objecttarui
is before sweep? * gc.c (rb_gc_force_recycle): Have to clear mark bit if object's slot already ready to mainor sweep. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-25* gc.c: fix oldgen/remembered_shady counting algorithm.ko1
* gc.c (rgengc_check_shady): increment `objspace->rgengc.remembered_shady_object_count' here. * gc.c (rgengc_remember): return FALSE if obj is already remembered. * gc.c (rgengc_rememberset_mark): make it void. * gc.c (gc_mark_children): fix to double counting oldgen_object_count at minor GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-24* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-24 * gc.c (typedef struct rb_objspace): Change members for monitor objects.tarui
* gc.c (gc_marks_test): Check all WriteBarrier Errors and track them in obj-tree. * gc.c (rgengc_check_shady): Ditto. * gc.c (gc_marks): Move 2 funtion calls to gc_marks_test for test initialize. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-23* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-23 * gc.c (after_gc_sweep): Have to record malloc info before reset.tarui
* gc.c (gc_prof_timer_start): Pick out part of new record creation as gc_prof_setup_new_record. * gc.c (gc_prof_set_malloc_info): Move point of recording allocation size to front of mark. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22* include/ruby/ruby.h, gc.c: rename macros and functions:ko1
OBJ_WB_GIVEUP() -> OBJ_WB_UNPROTECT(), rb_obj_wb_giveup() -> rb_obj_wb_unprotect(), rb_gc_giveup_promoted_writebarrier() -> rb_gc_writebarrier_unprotect_promoted(), * class.c, eval.c, hash.c: use OBJ_WB_UNPROTECT(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22* gc.c (rgengc_check_shady): add new WB miss checkingko1
on RGENGC_CHECK_MODE >= 2. (1) Save bitmaps before marking (2) Run full marking (3) On each traceable object, (a) object was not oldgen (== newly or shady object) && (b) parent object was oldgen && (c) parent object was not remembered && (d) object was not rememberd then, it should be WB miss. This idea of this checker is by Masaya Tarui <tarui@ruby-lang.org>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c (gc_prof_set_heap_info, after_gc_sweep): callko1
gc_prof_set_heap_info() just after sweeping to calculate live object number correctly. (live object number = total generated number (before marking) - total freed number (after sweeping)) * gc.c (gc_marks): record `oldgen_object_count' into current profile` record directly. * gc.c (rgengc_rememberset_mark): same for remembered_normal_objects and remembered_shady_objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c (rb_objspace::profile): rename rb_objspace::profile::record toko1
records (because it points a set of records) and add a field rb_objspace::profile::current_record to point a current profiling record. * gc.c: use above fields. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c (rb_gc_giveup_promoted_writebarrier): remove `rest_sweep()'ko1
because all of remembered objects are called for gc_mark_children(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c (rgengc_rememberset_mark): call gc_mark_children() forko1
remembered objects directly instead of pushing on the mark stack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c (slot_sweep_body): rename to slot_sweep().ko1
No need to separate major/minor GC. * gc.c (gc_setup_mark_bits): remove gc_clear_mark_bits() and unify to this function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c (check_bitmap_consistency): add to check flag and bitmap consistency.ko1
Use this function in several places. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 * gc.c (typedef enum): Introdule flags of major gc reason.tarui
* gc.c (garbage_collect_body): Ditto. * gc.c (gc_profile_flags): Ditto. * gc.c (gc_profile_dump_on): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c (allocate_sorted_heaps): remove unused variable `add'.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* include/ruby/ruby.h: constify RArray::as::ary and RArray::heap::ptr.ko1
Use RARRAY_ASET() or RARRAY_PTR_USE() to modify Array objects. * array.c, gc.c: catch up above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* include/ruby/ruby.h: support write barrier protection for T_STRUCT.ko1
Introduce the following C APIs: * RSTRUCT_RAWPTR(st) returns pointer (do WB on your risk). The type of returned pointer is (const VALUE *). * RSTRUCT_GET(st, idx) returns idx-th value of struct. * RSTRUCT_SET(st, idx, v) set idx-th value by v with WB. And * RSTRUCT_PTR(st) returns pointer with shady operation. The type of returned pointer is (VALUE *). * struct.c, re.c, gc.c, marshal.c: rewrite with above APIs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c (gc_sweep): profile sweep time correctly when LAZY_SWEEP isko1
disabled. * gc.c (gc_marks_test): store oldgen count and shady count before test marking and restore them after marking. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c: enable lazy sweep (commit miss).ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21revert last commit (operation miss).ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c: fix to use total_allocated_object_num and heaps_usedko1
at the GC time for profiler. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c: fix to use total_allocated_object_num and heaps_usedko1
at the GC time for profiler. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c: RGENGC_CHECK_MODE should be 0.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c (gc_marks_body): fix to get `th' in this function.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c (heaps_header/heaps_slot): embed bitmaps into heaps_slot.ko1
no need to maintain allocation/free bitmaps. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21* gc.c (slot_sweep_body): add counters at a time.ko1
* gc.c (gc_profile_dump_on): fix line break position. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20 * gc.c: refactoring bitmaps. introduce bits_t type and some Consts.tarui
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e