* 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
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
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
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
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
(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
(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
* 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
* 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
* 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
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
* 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
* 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
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
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
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
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
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
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
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
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