summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2013-10-04gc.c: rename heap.free_num to heap.swept_numtmm1
* gc.c: rename heap.free_num as heap.swept_num to clarify meaning and avoid confusion with objspace_free_num(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-04gc.c: add objspace_free_num and make GC.stat[:heap_free_num] use ittmm1
* gc.c (objspace_free_num): new method for available/free slots on heap. [ruby-core:57633] [Bug #8983] * gc.c (gc_stat): change heap_free_num definition to use new method. * test/ruby/test_gc.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-04gc.c: add rb_objspace.limittmm1
* gc.c: add rb_objspace.limit to keep accurate count of total heap slots [ruby-core:57633] [Bug #8983] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-03* gc.c: define gc_profile_record::allocated_size ifko1
CALC_EXACT_MALLOC_SIZE is true. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-02* gc.c: relax GC condition due to malloc_limit.ko1
* gc.c (GC_MALLOC_LIMIT_MAX): change default value (256MB -> 512MB) and permit zero to ignore max value. * gc.c (vm_malloc_increase, vm_xrealloc): do not cause GC on realloc. * gc.c (gc_before_sweep): change debug messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-30gc.c: suppress warningsnobu
* gc.c (gc_before_sweep): use PRIuSIZE instead of "%zu" directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-30* gc.c (rb_gc_disable): do rest_sweep() before disable GC.ko1
This fix may solve a failure of TestTracepointObj#test_tracks_objspace_events [test/-ext-/tracepoint/test_tracepoint.rb:43]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-27* gc.c: add two GC tuning environment variables.ko1
RUBY_GC_MALLOC_LIMIT_MAX and RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR. See r43067 for details. * gc.c (rb_gc_set_params): refactoring. And change verbose notation. Mostly duplicated functions get_envparam_int/double is not cool. Please rewrite it. * test/ruby/test_gc.rb: fix a test for this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-27* gc.c (GC_MALLOC_LIMIT): 8,000,000 -> 8 * 1,024 * 1,024.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-27* gc.c (gc_before_sweep): cast to size_t to suppress warnings.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-27* gc.c: add some fine-grained profiling codes to tuning marking phase.ko1
If you enable RGENGC_PRINT_TICK to 1, then profiling results by RDTSC (on x86/amd64 environment) are printed at last. Thanks Yoshii-san. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-27* gc.c: simplify threshold of GC caused by malloc_increase.ko1
Now, malloc_limit is increased/decreased by mysterious logic. This fix simplify malloc_limit increase/decrease logic such as: if (malloc_increase > malloc_limit) /* so many malloc */ malloc_limit += malloc_limit * (GC_MALLOC_LIMIT_FACTOR-1); else malloc_limit -= malloc_limit * (GC_MALLOC_LIMIT_FACTOR-1)/4; Default value of GC_MALLOC_LIMIT_FACTOR is 1.8. malloc_limit is bounded by GC_MALLOC_LIMIT_MAX (256MB by default). This logic runs at before_sweeep(). So there are no effect from caused by lazy sweep. And we can remove malloc_increase2. * gc.c (HEAP_MIN_SLOTS, FREE_MIN, HEAP_GROWTH_FACTOR): rename to GC_HEAP_MIN_SLOTS, GC_FREE_MIN, GC_HEAP_GROWTH_FACTOR respectively. Check them by `#ifndef' so you can specify these values outside gc.c. * gc.c (ruby_gc_params_t): add initial_malloc_limit_factor and initial_malloc_limit_max. * gc.c (vm_malloc_prepare, vm_xrealloc): use vm_malloc_increase to add and check malloc_increase. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26* gc.c (vm_xrealloc): use TRY_WITH_GC().nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26Fix compilation on gcc 4.6naruse
if __has_feature is not defined, it can't compile git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26gc.c: disable AddressSanitizernobu
* gc.c (mark_locations_array): disable AddressSanitizer. based on a patch by halfie (Ruby Guy) at [ruby-core:57372]. [ruby-core:56155] [Bug #8680] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26gc.c: atomical addnobu
* gc.c (gc_before_sweep, gc_after_sweep): add to increase2 atomically. * gc.c (gc_marks): adjust indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-25* include/ruby/ruby.h: rename RARRAY_RAWPTR() to RARRAY_CONST_PTR().ko1
RARRAY_RAWPTR(ary) returns (const VALUE *) type pointer and usecase of this macro is not acquire raw pointer, but acquire read-only pointer. So we rename to better name. RSTRUCT_RAWPTR() is also renamed to RSTRUCT_CONST_PTR() (I expect that nobody use it). * array.c, compile.c, cont.c, enumerator.c, gc.c, proc.c, random.c, string.c, struct.c, thread.c, vm_eval.c, vm_insnhelper.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24* gc.c (free_method_cache_entry_i): unused functioncharliesome
* gc.c (rb_free_mc_table): ditto * internal.h (method_cache_entry_t): unused struct * vm_method.c (verify_method_cache): remove unused variable * vm_method.c (rb_method_entry): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-24* class.c (class_alloc): remove mc_tblcharliesome
* gc.c (obj_free): ditto * internal.h (struct rb_classext_struct): ditto * method.h (rb_method_entry): remove ent param * vm_method.c: restore the global method cache. Per class cache tables turned out to be far too slow. [ruby-core:57289] [Bug #8930] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04vm.c: prototypenobu
* vm.c (rb_next_class_sequence): use ANSI style definition and prorotype declaration, instead of old-K&R style. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04* class.c, compile.c, eval.c, gc.h, insns.def, internal.h, method.h,charliesome
variable.c, vm.c, vm_core.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Implement class hierarchy method cache invalidation. [ruby-core:55053] [Feature #8426] [GH-387] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-27* gc.c (gc_profile_clear): do rest_sweep() before clearingko1
profile.current_record. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-21* gc.c (getrusage_time): Fallback clock_gettime to getrusage whenakr
clock_gettime fails. Reported by Eric Saxby. [ruby-core:56762] [Bug #8805] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-20* gc.c (rb_gcdebug_print_obj_condition): add printing information.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-19* gc.c: fix around GC_DEBUG.ko1
* gc.c (RVALUE::line): should be VALUE. On some environment (such as mswin64), `int' introduces alignment mismatch. * gc.c (newobj_of): add an assertion to check VALUE alignment. * gc.c (aligned_malloc): `&' is low priority than `=='. * gc.c: define GC_DEBUG everytime and use it as value 0 or 1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-18* error.c, file.c, gc.c, hash.c, thread.c, variable.c, vm_eval.c, bin/erb:ktsj
$SAFE=4 is obsolete. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-15* gc.c (gc_lazy_sweep): remove heap_increment() here because heap_incko1
may be 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-12 * gc.c (gc_marks_test): inhibit gc for st's operation.tarui
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-06* bignum.c (rb_big_realloc): Use VALGRIND_MAKE_MEM_UNDEFINED toakr
declare undefined memory area. (bignew_1): Ditto. * internal.h (VALGRIND_MAKE_MEM_DEFINED): Moved from gc.c (VALGRIND_MAKE_MEM_UNDEFINED): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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