summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2019-07-12Make `stack_check` slightly easier to use in debugger.Samuel Williams
2019-07-11Suppress warning on x64-mingwNobuyoshi Nakada
2019-07-10Don't manipulate GC flags directlyAaron Patterson
We need to disable the GC around compaction (for now) because object id book keeping can cause malloc to happen and that can trigger GC.
2019-07-04Revert self-referencing finalizer warning [Feature #15974]Nobuyoshi Nakada
It has caused CI failures. * d0cd0866d82a58933e5dccd073c753c0c2ad4eb5 Disable GC during rb_objspace_reachable_object_p * 89cef1c56b3a0f9c5e6ccc22a5044477a4fd16c1 Version guard for [Feature #15974] * 796eeb6339952d92ae1b353d450c7883e589852d. Fix up [Feature #15974] * 928260c2a613bbdd4402c300e0bf86ae7562e52a. Warn in verbose mode on defining a finalizer that captures the object
2019-07-04* expand tabs.git
2019-07-04Disable GC during rb_objspace_reachable_object_pNobuyoshi Nakada
Try to fix CI breakage by [Feature #15974].
2019-07-03Renamed to rb_objspace_reachable_object_pNobuyoshi Nakada
2019-07-03Ensure that GC is disabled during compactionAaron Patterson
Various things can cause GC to occur when compaction is running, for example resizing the object identity map: ``` frame #24: 0x000000010c784a10 ruby`gc_grey [inlined] push_mark_stack(stack=<unavailable>, data=<unavailable>) at gc.c:4311:42 frame #25: 0x000000010c7849ff ruby`gc_grey(objspace=0x00007fc56c804400, obj=140485906037400) at gc.c:4907 frame #26: 0x000000010c78f881 ruby`gc_start at gc.c:6464:8 frame #27: 0x000000010c78f5d1 ruby`gc_start [inlined] gc_marks_start(objspace=0x00007fc56c804400, full_mark=<unavailable>) at gc.c:6009 frame #28: 0x000000010c78f3c0 ruby`gc_start at gc.c:6291 frame #29: 0x000000010c78f399 ruby`gc_start(objspace=0x00007fc56c804400, reason=<unavailable>) at gc.c:7104 frame #30: 0x000000010c78930c ruby`objspace_xmalloc0 [inlined] objspace_malloc_fixup(objspace=<unavailable>, mem=0x000000011372a000, size=<unavailable>) at gc.c:9665:5 frame #31: 0x000000010c7892f5 ruby`objspace_xmalloc0(objspace=0x00007fc56c804400, size=12582912) at gc.c:9707 frame #32: 0x000000010c89bc13 ruby`st_init_table_with_size(type=<unavailable>, size=<unavailable>) at st.c:605:39 frame #33: 0x000000010c89c5e2 ruby`rebuild_table_if_necessary [inlined] rebuild_table(tab=0x00007fc56c40b250) at st.c:780:19 frame #34: 0x000000010c89c5ac ruby`rebuild_table_if_necessary(tab=0x00007fc56c40b250) at st.c:1142 frame #35: 0x000000010c89c379 ruby`st_insert(tab=0x00007fc56c40b250, key=140486132605040, value=140485922918920) at st.c:1161:5 frame #36: 0x000000010c794a16 ruby`gc_compact_heap [inlined] gc_move(objspace=0x00007fc56c804400, scan=<unavailable>, free=<unavailable>, moved_list=140485922918960) at gc.c:7441:9 frame #37: 0x000000010c794917 ruby`gc_compact_heap(objspace=0x00007fc56c804400, comparator=<unavailable>) at gc.c:7695 frame #38: 0x000000010c79410d ruby`gc_compact [inlined] gc_compact_after_gc(objspace=0x00007fc56c804400, use_toward_empty=1, use_double_pages=<unavailable>, use_verifier=1) at gc.c:0:22 ``` We *definitely* need the heap to be in a consistent state during compaction, so this commit sets the current state to "during_gc" so that nothing will trigger a GC until the heap finishes compacting. This fixes the bug we saw when running the tests for https://github.com/ruby/ruby/pull/2264
2019-07-03* expand tabs.git
2019-07-03Fix up [Feature #15974]Nobuyoshi Nakada
* Fixed warning condition * Fixed function signature * Use ident hash
2019-07-03Warn in verbose mode on defining a finalizer that captures the objectChris Seaton
[Feature #15974] Closes: https://github.com/ruby/ruby/pull/2264
2019-06-23Frozen objects in WeakMapNobuyoshi Nakada
* gc.c (wmap_aset): bypass check for frozen and allow frozen object in WeakMap. [Bug #13498]
2019-06-19Adjust indentNobuyoshi Nakada
2019-06-19Remove IA64 support.Samuel Williams
2019-06-19Rework debug conditional.Samuel Williams
2019-06-19Move vm stack init into thread.Samuel Williams
2019-06-07Adjust indentNobuyoshi Nakada
2019-06-03Pin keys in "compare by identity" hashesAaron Patterson
Hashes that compare by identity care about the location of the object in memory. Since they care about the memory location, we can't let them move.
2019-06-03object id is stable now for all objects, so we can let hash keys moveAaron Patterson
2019-06-03allow objects in imemo envs to moveAaron Patterson
2019-06-04get rid of a warning of VC++NAKAMURA Usaku
2019-06-03remove `rb_objspace_pinned_object_p()`Koichi Sasada
Nobody uses this function other than gc.c. We only need RVALUE_PINNED().
2019-05-30* expand tabs.git
2019-05-30reorder bitmap clearing.Koichi Sasada
2019-05-30move pinned_bits[] position in struct heap_page.Koichi Sasada
pinned_bits are not used frequently (only GC.compact use it) so move it at the end of struct heap_page.
2019-05-30introduce `during_compacting` flag.Koichi Sasada
Usually PINNED_BITS are not needed (only for GC.compact need it) so skip updating PINNED_BITS if the marking is not by GC.compact.
2019-05-29Prevent MJIT compilation from running while movingTakashi Kokubun
pointers. Instead of 4fe908c1643c3f355edd787bb651aefb53b996c0, just locking the MJIT worker may be fine for this case. And also we might have the same issue in all `gc_compact_after_gc` calls.
2019-05-29Drop MJIT debug code from GC.compactTakashi Kokubun
As ko1 added some improvements on GC.compact, I want to check if it solved the problem too.
2019-05-28remove obsolete rb_gc_finalize_deferred().Koichi Sasada
rb_gc_finalize_deferred() is remained for compatibility with C-extensions. However, this function is no longer working from Ruby 2.4 (crash with SEGV immediately). So remove it completely.
2019-05-28use malloc() instead of calloc().Koichi Sasada
Here malloc() is enough because all elements of the page_list will be overwrite.
2019-05-28should skip T_ZOMBIE here.Koichi Sasada
2019-05-28should use heap_eden->total_pages.Koichi Sasada
The size of page_list is heap_eden->total_pages, but init_cursors() assumes the size of page_list is `heap_allocated_pages`. This patch fix it.
2019-05-28use only eden_heaps on GC.compact.Koichi Sasada
`heap_pages_sorted` includes eden and tomb pages, so we should not use tomb pages for GC.compact (or we should move all of tomb pages into eden pages). Now, I choose only eden pages. If we allow to move Zombie objects (objects waiting for finalizers), we should use both type of pages (TODO).
2019-05-28Suppress warning (uninitialized variable).Koichi Sasada
2019-05-27check the object is in tomb_heap.Koichi Sasada
2019-05-27add a space between type and othersKoichi Sasada
2019-05-27add a line break for each error messageKoichi Sasada
2019-05-27fix GC.verify_internal_consistency.Koichi Sasada
Fix debug output to dump more useful information on GC.compact debugging. check_rvalue_consistency_force() now accepts `terminate` flag to terminate a program with rb_bug() or only print error message. GC.verify_internal_consistency use this flag (== FALSE) to dump all of debug output.
2019-05-27is_pointer_to_heap() checks also tomb or not.Koichi Sasada
is_pointer_to_heap(obj) checks this obj belong to a heap page. However, this function returns TRUE even if the page is tomb page. This is re-commit of [712c027524]. heap_page_add_freeobj() should not use is_pointer_to_heap(), but should check more explicitly.
2019-05-24* expand tabs.git
2019-05-24Revert "check it in eden or tomb."Kazuhiro NISHIYAMA
This reverts commit 712c027524e3a03500b3098d950fc2f0608ce897.
2019-05-24check RVALUE on verifier.Koichi Sasada
GC.verify_internal_consistency() checks health of each RVALUE with check_rvalue_consistency(). However, this function is enabled only on debug environment (RGENGC_CHECK_MODE>1). So introduce new function check_rvalue_consistency_force() and use it in GC.verify_internal_consistency.
2019-05-24check it in eden or tomb.Koichi Sasada
is_pointer_to_heap() checks if it is in valid pointer to the RVALUE in any heap_page_body. However, it returns true if it points tomb pages. This patch check it points to eden pages.
2019-05-24add separation char on rb_obj_info(imemo obj)Koichi Sasada
2019-05-23gc.c: Try pausing MJIT worker during GC.verify_compaction_referencesTakashi Kokubun
for debugging http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2048247
2019-05-23add verifier before compactKoichi Sasada
2019-05-23prefix ASAN related inline functions asan_Urabe, Shyouhei
requested by Ko1.
2019-05-23gc_pin() doesn't check is_markable_object().Koichi Sasada
Caller of gc_pin() should check it is a mark-able object. So gc_pin() doesn't need to check it. With this fix, we can refactoring around it.
2019-05-23skip zombies.Koichi Sasada
rb_gc() no longer invokes finalizers, so there are T_ZOMBE objects.
2019-05-23pin `maybe` pointers.Koichi Sasada
Objects pointed by "maybe" pointers because of conservative marking should be pinned down.