summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2014-10-14* gc.c (rb_obj_id): [DOC] Fix typo, clean up sentence, and wrap colszzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-06symbol.h: move struct RSymbolnobu
* symbol.h (struct RSymbol): move from internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-28* gc.c (rb_gcdebug_print_obj_condition): use RVALUE_REMEMBEREDktsj
because GET_HEAP_REMEMBERSET_BITS is obsoleted. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-27ruby.h: deprecate plain Datanobu
* include/ruby/ruby.h (rb_data_object_alloc_deprecated): deprecate Data_Make_Struct and Data_Wrap_Struct. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-14compile.c, gc.c: suppress warningsnobu
* compile.c (iseq_compile_each): suppress implicit conversion warning by old apple gcc 4.2. * gc.c (RVALUE_FLAGS_AGE, heap_page_allocate): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11* vm.c (rb_vm_register_special_exception): make new function toko1
make and register special exceptions. * vm.c (rb_vm_mark): do not need to mark special exceptions because they are registerd by rb_gc_register_mark_object(). * eval.c (Init_eval): use rb_vm_register_special_exception(). * gc.c (Init_GC): ditto. * proc.c (Init_Proc): ditto. * thread.c (Init_Thread): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11* gc.c (rb_gc_mark_values): added.ko1
This function is similar to rb_gc_mark_locations(), but not conservertive. * internal.h: ditto. * vm.c (env_mark): use rb_gc_mark_values() because env values should be Ruby VALUEs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11* gc.c (gc_mark_ptr): rename to gc_mark_set.ko1
* gc.c (gc_mark): add gc_mark_ptr() to skip is_markable_object() check. gc_mark_maybe() can use gc_mark_ptr() directly because passed pointer is checked by is_pointer_to_heap(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11* include/ruby/ruby.h, gc.c: add new internal eventsko1
RUBY_INTERNAL_EVENT_GC_ENTER and RUBY_INTERNAL_EVENT_GC_EXIT. When invoking GC process, GC_ENTER event is called. When exiting from GC process, GC_EXIT event is called. Incremental GC (incremental marking and lazy sweep) can call these events many times. For example (minor marking): (1) GC_ENTER - (2) GC_START (minor GC) (minor marking) - (3) GC_END_MARK (start lazy sweep) (4) GC_EXIT (ruby process) (5) GC_ENTER (lazy sweep) (6) GC_EXIT (ruby process) (... repeat (5), (6)) (7) GC_ENTER (finish lazy sweep) - (8) GC_END_SWEEP (9) GC_EXIT 2nd example (incremental major marking): (1) GC_ENTER - (2) GC_START (minor GC) (start incremental marking) (3) GC_EXIT (ruby process) (4) GC_ENTER (incremental marking) (5) GC_EXIT (ruby process) (... repeat (4), (5)) (6) GC_ENTER (finish incremental marking) - (7) GC_END_MARK (start lazy sweep) (8) GC_EXIT (ruby process) (9) GC_ENTER (lazy sweep) (10) GC_EXIT (ruby process) (... repeat (9), (10)) (11) GC_ENTER (finish lazy marking) - (12) GC_STOP_SWEEP (13) GC_EXIT Thease internal events enable to measure GC pause time completely. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11* include/ruby/ruby.h: freeze nil/true/false.ko1
* gc.c (should_be_finalizable): check frozen after checkin FL_ABLE. * object.c (rb_obj_taint): check OBJ_TAINTABLE(obj). * object.c (rb_obj_freeze): remove immediate_frozen_tbl because all of immediate values are frozen. YAY! * object.c (rb_obj_frozen_p): ditto. * test/ruby/test_eval.rb: skip instance_variable_set for frozen objects. * test/ruby/test_weakmap.rb: check ArgumentError instead of RuntimeError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10gc.c: preserve encodingnobu
* gc.c (should_be_callable): preserve encoding of class name in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (gc_stat): update rdoc.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (gc_stat_internal): rename:ko1
* malloc_increase -> malloc_increase_bytes * malloc_limit -> malloc_increase_bytes_limit * oldmalloc_increase -> oldmalloc_increase_bytes * oldmalloc_limit -> oldmalloc_increase_bytes_limit ref: [Feature #9924] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (gc_stat_internal): rename `heap_used' to `heap_allocated_pages'.ko1
ref: [Feature #9924] * test/ruby/test_gc.rb: add constraints test for gc stat information. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (gc_stat_internal): rename:ko1
* remembered_shady_object -> remembered_wb_unprotected_objects * remembered_shady_object_limit -> remembered_wb_unprotected_objects_limit * old_object -> old_objects * old_object_limit -> old_objects_limit ref: [Feature #9924] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (gc_stat_internal): support:ko1
* total_allocated_pages * total_freed_pages ref: [Feature #9924] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (objspace_total_slot): rename objspace_available_slots.ko1
* gc.c (objspace_live_slot, objspace_free_slot): rename ..._slot() to ..._slots(). * gc.c (objspace_free_slot): should subtract heap_pages_final_slots. * gc.c (gc_stat_internal): * add `heap_available_slots' field * rename heap_live_slot to heap_live_slots * rename heap_free_slot to heap_free_slots ref: [Feature #9924] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c: refactoring for RGENGC_PROFILE > 0.ko1
* rename rb_objspace_t::profile::..._count to rb_objspace_t::profile::total_..._count * rename promote_infant_types to promote_types * gc.c (gc_remember_unprotected): count remembered shady objects here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c (init_mark_stack): MEMZERO() receive type as 2nd argument insteadnagachika
of size. Coverity Scan found this bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09s/stressfull/stressful/gkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c: rename rb_objspace_t::marked_objects to marked_slots.ko1
* gc.c (gc_marks_start): should be clear first. * gc.c (gc_marks_start): remembered shady objects are also marked. * gc.c (gc_stat_internal): add heap_marked_slots. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c: renameko1
* total_allocated_object_num -> total_allocated_objects * total_allocated_object_num_at_gc_start -> total_allocated_objects_at_gc_start * total_freed_object_num -> total_freed_objects * gc.c (gc_stat_internal): * rename total_allocated_object -> total_allocated_objects * rename total_freed_object -> total_freed_objects git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c (gc_stat_internal): fix symbol namesko1
* heap_final_slot -> heap_final_slots * heap_swept_slot -> heap_swept_slots git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c (rb_objspace_t::heap_pages): rename field names:ko1
* used -> allocated_pages * increment -> allocatable_pages * length -> sorted_length And remove unused `limt' field. * gc.c: rename macros: * heap_pages_used -> heap_allocated_pages * heap_pages_length -> heap_pages_sorted_length * heap_pages_increment -> heap_allocatable_pages * gc.c (gc_stat_internal): fix symbol names ref: [Feature #9924] https://docs.google.com/spreadsheets/d/11Ua4uBr6o0k-nORrZLEIIUkHJ9JRzRR0NyZfrhEEnc8/edit?usp=sharing Yellow color fields in this table are changed. * test/ruby/test_gc.rb: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09gc.c: fix typosnobu
* gc.c (gc_stat_transition): fix typos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c: continue layout changing.ko1
newobj_of() also touch: (4) increment total_allocated_object_num (5) check hook_events And gather fields related to marking phase. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c: fix layout of rb_objsapce_t to improve cache locality.ko1
newobj_of() accesses: (1) rb_objspace_t::flags (2) rb_objspace_t::eden_heap::freelist (3) and rb_objspace_t::eden_heap::free_pages if freelist is NULL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c: move rb_objspace_t::flags::gc_stressfull after during_gcko1
to make accesssing both parameters easy. * gc.c (heap_get_freeobj): add LIKELY() hint. * gc.c (heap_get_freeobj_from_next_freepage): ditto. * gc.c (newobj_of): check both parameters at once for exceptional case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c: add rb_objspace_t::flags::gc_stressfull andko1
ruby_gc_stressfull macro. Rename objspace->gc_stress to objspace->gc_stress_mode. If objspace->gc_stress_mode is true (!nil and !false) then ruby_gc_stressfull becomes TRUE. ruby_gc_stressfull will speedup newobj_of() slightly. * gc.c: initialize ruby_gc_stress(full|_mode) by gc_params.gc_stress even if ENABLE_VM_OBJSPACE is false. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c: remvoe ruby_disable_gc_stress and add ruby_disable_gcko1
to speed-up newobj_of(). * gc.c (ready_to_gc): check ruby_disable_gc. * signal.c: use ruby_disable_gc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c: rename gc_stat entries and check stat transition.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c (gc_sweep_rest): remove wrong modification of during_gc flag.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c (rb_objspace_t::profile): reduce padding.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c: pack boolean values into rb_objspace_t::flags with bit fieldsko1
to improve cache locality. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-08* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-08* gc.c: add incremental GC algorithm. [Feature #10137]ko1
Please refer this ticket for details. This change also introduces the following changes. * Remove RGENGC_AGE2_PROMOTION and introduce object age (0 to 3). Age can be count with FL_PROMOTE0 and FL_PROMOTE1 flags in RBasic::flags (2 bit). Age == 3 objects become old objects. * WB_PROTECTED flag in RBasic to WB_UNPROTECTED bitmap. * LONG_LIVED bitmap to represent living objects while minor GCs It specifies (1) Old objects and (2) remembered shady objects. * Introduce rb_objspace_t::marked_objects which counts marked objects in current marking phase. marking count is needed to introduce incremental marking. * rename mark related function and sweep related function to gc_(marks|sweep)_(start|finish|step|rest|continue). * rename rgengc_report() to gc_report(). * Add obj_info() function to get cstr of object details. * Add MEASURE_LINE() macro to measure execution time of specific line. * and many small fixes. * include/ruby/ruby.h: add flag USE_RINCGC. Now USE_RINCGC can be set only with USE_RGENGC. * include/ruby/ruby.h: introduce FL_PROMOTED0 and add FL_PROMOTED1 to count object age. * include/ruby/ruby.h: rewrite write barriers for incremental marking. * debug.c: catch up flag name changes. * internal.h: add rb_gc_writebarrier_remember() instead of rb_gc_writebarrier_remember_promoted(). * array.c (ary_memcpy0): use rb_gc_writebarrier_remember(). * array.c (rb_ary_modify): ditto. * hash.c (rb_hash_keys): ditto. * hash.c (rb_hash_values): ditto. * object.c (init_copy): use rb_copy_wb_protected_attribute() because FL_WB_PROTECTED is moved from RBasic::flags. * test/objspace/test_objspace.rb: catch up ObjectSpace.dump() changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-17* gc.c (obj_memsize_of): don't calculate memsize of T_NODEktsj
when called from check_gen_consistency. It fixes segmentation fault on RGENGC_CHECK_MODE >= 1 introduced by r47188. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-16node.h: extract NODE functions from gc.cnobu
* node.h (rb_gc_free_node, rb_node_memsize, rb_gc_mark_node): extract functions for NODE from obj_free(), obj_memsize_of(), gc_mark_children() in gc.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-15gc.c: memsize of T_NODEnobu
* gc.c (obj_memsize_of): fix size of T_NODE and comments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-30* gc.c: remove unused macros.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO usenormal
Using calloc where possible reduces code and binary sizes. * include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement (Data_Make_Struct, TypedData_Make_Struct): ZALLOC replaces ALLOC+memset * compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO * cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO * io.c (rb_io_reopen): ditto * iseq.c (prepare_iseq_build): ditto * parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto * re.c (match_alloc): ditto * variable.c (rb_const_set): ditto * ext/socket/raddrinfo.c (get_addrinfo): ditto * ext/strscan/strscan.c (strscan_s_allocate): ditto * gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25* gc.c: change objspace::rgengc::parent_object_is_old (boolean)ko1
to objspace::rgengc::parent_object (VALUE). Use Qfalse or RVALUE pointer instead of FALSE and TRUE. * gc.c (gc_marks_body): should clear parent_object just before gc_mark_roots() because there are no parents objects for root objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25* gc.c (rb_gc_writebarrier_remember_promoted): should remember onlyko1
OLD objects on RGENGC_AGE2_PROMOTION. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25* gc.c (gc_mark_stacked_objects): fix error message.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-24* gc.c: fix major GC flags.ko1
* add GPR_FLAG_MAJOR_BY_FORCE, which indicates major GC by METHOD, CAPI and so on (see GC_BY). * remove GPR_FLAG_MAJOR_BY_RESCAN because not used. * remove GPR_FLAG_MAJOR_BY_STRESS, use FORCE instead. * test/ruby/test_gc.rb: catch up. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-16* gc.c (gc_mark_roots): call rb_vm_mark directly.ko1
* vm.c: remove mark function for RubyVM object because RubyVM object marked manually. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-10gc.c: fix typonobu
* gc.c (global_list): fix typo, capital 'L'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-09* symbol.c: remove rb_gc_mark_symbols().ko1
fstrings refered by static symbols and pinned dynamic symbols are registerd by rb_gc_register_mark_object(). frstring refered by dynamic symbols (not pinned symbols) are refered from global_symbols.dsymbol_fstr_hash (Hash object). Note that fstrings refered from dynamic symbols must live loger than symbol objects themselves because rb_gc_free_dsymbol() uses fstring to remove from symbol tables. This is why we can not mark fstrings from dynamic symbols. This technique reduces root objects for GC marking. * gc.c (gc_mark_roots): ditto. * internal.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-07* gc.c: revert miss-commit.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-07* parse.y: need to use updated (re-created) symbols.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e