summaryrefslogtreecommitdiff
path: root/gc.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* fix GC.verify_internal_consistency.Koichi Sasada2019-05-271-16/+51
| | | | | | | | | | 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.
* is_pointer_to_heap() checks also tomb or not.Koichi Sasada2019-05-271-3/+14
| | | | | | | | | 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.
* * expand tabs.git2019-05-241-1/+1
|
* Revert "check it in eden or tomb."Kazuhiro NISHIYAMA2019-05-241-4/+2
| | | | This reverts commit 712c027524e3a03500b3098d950fc2f0608ce897.
* check RVALUE on verifier.Koichi Sasada2019-05-241-50/+55
| | | | | | | | 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.
* check it in eden or tomb.Koichi Sasada2019-05-241-2/+4
| | | | | | 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.
* add separation char on rb_obj_info(imemo obj)Koichi Sasada2019-05-241-1/+1
|
* gc.c: Try pausing MJIT worker during GC.verify_compaction_referencesTakashi Kokubun2019-05-231-0/+2
| | | | | for debugging http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2048247
* add verifier before compactKoichi Sasada2019-05-231-0/+4
|
* prefix ASAN related inline functions asan_Urabe, Shyouhei2019-05-231-69/+69
| | | | requested by Ko1.
* gc_pin() doesn't check is_markable_object().Koichi Sasada2019-05-231-7/+6
| | | | | | 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.
* skip zombies.Koichi Sasada2019-05-231-0/+2
| | | | rb_gc() no longer invokes finalizers, so there are T_ZOMBE objects.
* pin `maybe` pointers.Koichi Sasada2019-05-231-30/+15
| | | | | Objects pointed by "maybe" pointers because of conservative marking should be pinned down.
* Do not kick finalizers on rb_gc().Koichi Sasada2019-05-231-2/+5
| | | | | | | | | | | | | | | | rb_gc() kicks gc_finalize_deferred(), which invokes finalizers. This means that any Ruby program can be run this point and it may be thread switching points and so on. However, it is difficult to think it invokes any Ruby programs. For example, `GC.compact` use `rb_gc()` to implement it, howver, any Ruby program must not be run on this timing. For this reason (it is difficult to image it run any Ruby program), I removed `gc_finalize_deferred()` line in rb_gc(). This patch solves GC.compact issue. [Bug #15809] and re-enable GC.compact test.
* * expand tabs.git2019-05-221-1/+1
|
* gc.c: revert b00f280d4b "Eagerly name modules and classes"Nobuyoshi Nakada2019-05-221-3/+3
| | | | | * gc.c (rb_raw_obj_info): new string objects cannot allocate to create new class path name during GC.
* Eagerly name modules and classesAlan Wu2019-05-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | * variable.c: make the hidden ivars `classpath` and `tmp_classpath` the source of truth for module and constant names. Assign to them when modules are bind to constants. * variable.c: remove references to module name cache, as what used to be the cache is now the source of truth. Remove rb_class_path_no_cache(). * variable.c: remove the hidden ivar `classid`. This existed for the purposes of module name search, which is now replaced. Also, remove the associated rb_name_class(). * class.c: use rb_set_class_path_string to set the name of Object during boot. Must use a fstring as this runs before rb_cString is initialized and creating a normal string leads to a VALUE without a class. * spec/ruby/core/module/name_spec.rb: add a few specs to specify what happens to Module#name across multiple operations. These specs pass without other code changes in this commit. [Feature #15765]
* unify normal and verify ver.Koichi Sasada2019-05-211-50/+58
|
* * expand tabs.git2019-05-201-15/+15
|
* Get rid of undefined behavior that source and destination buffers overlapNobuyoshi Nakada2019-05-201-35/+42
|
* Rename rb_gc_new_location to rb_gc_locationAaron Patterson2019-05-181-11/+11
| | | | | The function will return new or existing locations depending on whether or not the object actually moved, so give it a more appropriate name.
* Add fall through comment for Coverity ScanKazuhiro NISHIYAMA2019-05-181-0/+1
|
* Prevent Dynamic -> Static symbols from movingAaron Patterson2019-05-171-1/+4
| | | | | | | | If a dynamic symbol has been converted to a static symbol, it gets added to the global ID list and should no longer move. C extensions can pass symbols to rb_sym2id and those symbols should no longer be movable. When the symbol is passed to rb_sym2id, the `id` member is set, so we can use its existence to prevent movement.
* don't need to sweep rest.Koichi Sasada2019-05-161-5/+10
| | | | | | | | `transient_heap_evacuate()` disables GC using `rb_gc_disable()` to prohibt GC invocation because of new allocation for evacuated memory. However, `rb_gc_disable()` sweep all rest of unswept pages. We don't need to cancel lazy sweep so this patch introduce `rb_gc_disable_no_rest()` which doesn't cancel lazy sweep.
* Prefix global_symbols with `ruby_`Nobuyoshi Nakada2019-05-161-1/+2
|
* Make internal functions staticNobuyoshi Nakada2019-05-161-3/+6
|
* Rename mjit_gc_finish_hook to mjit_gc_exit_hookTakashi Kokubun2019-05-151-1/+1
| | | | | because @ko1 said "gc_finish" is confusing like a finish of entire GC process
* Suppress unused-but-set-variable warningNobuyoshi Nakada2019-05-151-0/+2
|
* unpin finalizers and update referencesAaron Patterson2019-05-151-10/+2
|