aboutsummaryrefslogtreecommitdiffstats
path: root/gc.c
Commit message (Collapse)AuthorAgeFilesLines
* add debug_counters to check details.Koichi Sasada2019-08-021-11/+30
| | | | add debug_counters to check the Hash object statistics.
* Fix assertion failure when VM_CHECK_MODENobuyoshi Nakada2019-08-011-1/+1
| | | | | Some VM frames (dummy and top pushed by `rb_vm_call_cfunc`) has iseq but has no pc.
* fix tracepoint + backtrace SEGV卜部昌平2019-08-011-2/+5
| | | | | | | | | | | | PC modification in gc_event_hook_body was careless. There are (so to say) abnormal iseqs stored in the cfp. We have to check sanity before we touch the PC. This has not been fixed because there was no way to (ab)use the setup from pure-Ruby. However by using our official C APIs it is possible to touch such frame(s), resulting in SEGV. Fixes [Bug #14834].
* Revert "Let prev EP move"Aaron Patterson2019-07-311-4/+2
| | | | | | This reverts commit e352445863588b90f7af6cdf6c1b6dc432ee33ab. This is breaking CI and I'm not sure why yet, so I'll revert for now.
* Let prev EP moveAaron Patterson2019-07-311-2/+4
| | | | | This commit allows the previos EP pointer to move, then updates its location
* pass to obj_info().Koichi Sasada2019-07-261-6/+1
| | | | | obj_info() has a routine to show SPECIAL_CONST_P() objects so we don't need to check it here.
* Let memory sizes of the various IMEMO object types be reflected correctlyLourens Naudé2019-07-231-3/+36
| | | | | | [Feature #15805] Closes: https://github.com/ruby/ruby/pull/2140
* Document BasicObject does not implement #object_id and #send [ci skip]Jeremy Evans2019-07-221-0/+2
| | | | Fixes [Bug #10422]
* constify RHash::ifnone.Koichi Sasada2019-07-221-1/+1
| | | | | | | RHash::ifnone should be protected by write-barriers so this field should be const. However, to introduce GC.compact, the const was removed. This commit revert this removing `const` and modify gc.c `TYPED_UPDATE_IF_MOVED` to remove `const` forcely by a type cast.
* Only disable GC around reference updatingAaron Patterson2019-07-191-2/+3
| | | | | This is the only place that can change the size of the object id tables and cause a GC.
* fix debug counter for Hash counts.Koichi Sasada2019-07-191-6/+6
| | | | | | | | | | | | | | | | | | | Change debug_counters for Hash object counts: * obj_hash_under4 (1-3) -> obj_hash_1_4 (1-4) * obj_hash_ge4 (4-7) -> obj_hash_5_8 (5-8) * obj_hash_ge8 (>=8) -> obj_hash_g8 (> 8) For example on rdoc benchmark: [RUBY_DEBUG_COUNTER] obj_hash_empty 554,900 [RUBY_DEBUG_COUNTER] obj_hash_under4 572,998 [RUBY_DEBUG_COUNTER] obj_hash_ge4 1,825 [RUBY_DEBUG_COUNTER] obj_hash_ge8 2,344 [RUBY_DEBUG_COUNTER] obj_hash_empty 553,097 [RUBY_DEBUG_COUNTER] obj_hash_1_4 571,880 [RUBY_DEBUG_COUNTER] obj_hash_5_8 982 [RUBY_DEBUG_COUNTER] obj_hash_g8 2,189
* fix shared array terminology.Koichi Sasada2019-07-191-3/+3
| | | | | | | | | | | | | | | | | | Shared arrays created by Array#dup and so on points a shared_root object to manage lifetime of Array buffer. However, sometimes shared_root is called only shared so it is confusing. So I fixed these wording "shared" to "shared_root". * RArray::heap::aux::shared -> RArray::heap::aux::shared_root * ARY_SHARED() -> ARY_SHARED_ROOT() * ARY_SHARED_NUM() -> ARY_SHARED_ROOT_REFCNT() Also, add some debug_counters to count shared array objects. * ary_shared_create: shared ary by Array#dup and so on. * ary_shared: finished in shard. * ary_shared_root_occupied: shared_root but has only 1 refcnt. The number (ary_shared - ary_shared_root_occupied) is meaningful.
* simplify around GC_ASSERT()Koichi Sasada2019-07-151-9/+6
|
* Make `stack_check` slightly easier to use in debugger.Samuel Williams2019-07-121-3/+4
|
* Suppress warning on x64-mingwNobuyoshi Nakada2019-07-111-1/+1
|
* Don't manipulate GC flags directlyAaron Patterson2019-07-101-2/+2
| | | | | 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.
* Revert self-referencing finalizer warning [Feature #15974]Nobuyoshi Nakada2019-07-041-64/+0
| | | | | | | | | | | | | | | | | | | | 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
* * expand tabs.git2019-07-041-3/+3
|
* Disable GC during rb_objspace_reachable_object_pNobuyoshi Nakada2019-07-041-33/+54
| | | | Try to fix CI breakage by [Feature #15974].
* Renamed to rb_objspace_reachable_object_pNobuyoshi Nakada2019-07-031-11/+11
|
* Ensure that GC is disabled during compactionAaron Patterson2019-07-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * expand tabs.git2019-07-031-5/+5
|
* Fix up [Feature #15974]Nobuyoshi Nakada2019-07-031-11/+11
| | | | | | * Fixed warning condition * Fixed function signature * Use ident hash
* Warn in verbose mode on defining a finalizer that captures the objectChris Seaton2019-07-031-0/+43
| | | | | | [Feature #15974] Closes: https://github.com/ruby/ruby/pull/2264
* Frozen objects in WeakMapNobuyoshi Nakada2019-06-231-3/+10
| | | | | * gc.c (wmap_aset): bypass check for frozen and allow frozen object in WeakMap. [Bug #13498]
* Adjust indentNobuyoshi Nakada2019-06-191-5/+7
|
* Remove IA64 support.Samuel Williams2019-06-191-23/+2
|
* Rework debug conditional.Samuel Williams2019-06-191-3/+5
|
* Move vm stack init into thread.Samuel Williams2019-06-191-0/+4
|
* Adjust indentNobuyoshi Nakada2019-06-071-212/+212
|
* Pin keys in "compare by identity" hashesAaron Patterson2019-06-031-1/+15
| | | | | | 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.
* object id is stable now for all objects, so we can let hash keys moveAaron Patterson2019-06-031-6/+1
|
* allow objects in imemo envs to moveAaron Patterson2019-06-031-4/+19
|
* get rid of a warning of VC++NAKAMURA Usaku2019-06-041-1/+1
|
* remove `rb_objspace_pinned_object_p()`Koichi Sasada2019-06-031-7/+1
| | | | | Nobody uses this function other than gc.c. We only need RVALUE_PINNED().
* * expand tabs.git2019-05-301-1/+1
|
* reorder bitmap clearing.Koichi Sasada2019-05-301-2/+2
|
* move pinned_bits[] position in struct heap_page.Koichi Sasada2019-05-301-2/+3
| | | | | pinned_bits are not used frequently (only GC.compact use it) so move it at the end of struct heap_page.
* introduce `during_compacting` flag.Koichi Sasada2019-05-301-13/+23
| | | | | 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.
* Prevent MJIT compilation from running while movingTakashi Kokubun2019-05-291-0/+4
| | | | | | | | 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.
* Drop MJIT debug code from GC.compactTakashi Kokubun2019-05-291-2/+0
| | | | | As ko1 added some improvements on GC.compact, I want to check if it solved the problem too.
* remove obsolete rb_gc_finalize_deferred().Koichi Sasada2019-05-281-7/+0
| | | | | | | 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.
* use malloc() instead of calloc().Koichi Sasada2019-05-281-3/+7
| | | | | Here malloc() is enough because all elements of the page_list will be overwrite.
* should skip T_ZOMBIE here.Koichi Sasada2019-05-281-1/+10
|
* should use heap_eden->total_pages.Koichi Sasada2019-05-281-2/+3
| | | | | | 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.
* use only eden_heaps on GC.compact.Koichi Sasada2019-05-281-3/+16
| | | | | | | | `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).
* Suppress warning (uninitialized variable).Koichi Sasada2019-05-281-1/+1
|
* check the object is in tomb_heap.Koichi Sasada2019-05-271-0/+13
|
* add a space between type and othersKoichi Sasada2019-05-271-1/+1
|
* add a line break for each error messageKoichi Sasada2019-05-271-10/+10
|