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
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
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
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
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
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
* 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
* 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
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
* gc.h: rb_objspace_garbage_object_p() as an exported function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This function is not opposite against is_live_object()
because is_dying_object() does *not* check object type.
* gc.c (is_dying_object): change condition.
* gc.c (is_live_object): use T_NONE instead of 0.
* gc.c (rb_objspace_dying_object_p): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
From single array, to array of arrays. Each array only has 1024
entries.
* vm.c (Init_vm_objects): change default capa from 1 to 128.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Extend heap only at
(1) after major GC
or
(2) after several (two times, at current) minor GC
Details in https://bugs.ruby-lang.org/issues/9607#note-9
[Bug #9607]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (gc_page_sweep): should not set, but add final_slots into
sweep_page->final_slots.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
clear counter at the beggining of every GC and
count promoted (infant->young) objects.
Some promotions (infant->young) are transition of promoting to old
objects. We should not count such promotions.
With this technique, we don't need to check young objects
at obj_free().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e