aboutsummaryrefslogtreecommitdiffstats
path: root/gc.c
Commit message (Collapse)AuthorAgeFilesLines
* * 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
|
* * expand tabs.git2019-05-151-5/+5
|
* Add object packing strategies for compactionAaron Patterson2019-05-141-20/+66
| | | | | | | | This commit adds an alternative packing strategy for compaction. Instead of packing towards "most pinned" pages, we can pack towards "most empty" pages. The idea is that we can double the heap size, then pack all objects towards the empty side of the heap. This will ensure maximum chaos for testing / verification.
* Fixing function nameAaron Patterson2019-05-141-1/+1
| | | | | This function is used for marking / pinning vm stack values, so it should have "vm" in the function name to be more clear.
* turn T_MOVED in to a linked listAaron Patterson2019-05-131-5/+24
|
* Don't run the compactor if GC is disabledAaron Patterson2019-05-131-3/+9
| | | | | | GC is required for pinning / marking objects. If the compactor runs without pinning everything, then it will blow up, so just return early if the GC is disabled.
* Fix typosKazuhiro NISHIYAMA2019-05-131-2/+2
|
* Pin finalizer tableAaron Patterson2019-05-081-5/+21
| | | | | | Objects in the finalizer table stay pinned for now. In some cases, the key could move which would cause a miss when removing the object from the table (leading to a T_MOVED reference staying in the table).
* * expand tabs.git2019-05-091-1/+1
|
* Calling `obj_info` during sweep is unsafeAaron Patterson2019-05-081-3/+10
| | | | | | | | | | | | | | | | | | | | | `obj_info` will look at references of objects in some cases (for example it will try to access path information on ISeq objects). But during the sweep phase, if the referenced object is collected before `obj_info` is called, then it could be a bad ref and a segv will occur. For example: A -> B Sweep phase: 1. obj_info(B) 2. Sweep and free B 3. obj_info(A); A tries to read B 4. SEGV This commit simply removes the call to `obj_info` during the sweep phase.
* Reduce ONIG_NREGION from 10 to 4: power of 2 and testing revealed most ↵Lourens Naudé2019-05-071-0/+11
| | | | | | pattern matches are less than or equal to 4 results Closes: https://github.com/ruby/ruby/pull/2135
* add new debug_counters about is_pointer_to_heap().Koichi Sasada2019-05-071-0/+6
| | | | | is_pointer_to_heap() is used for conservative marking. To analyze this function's behavior, introduce some debug_counters.
* avoid passing NULL to memsetUrabe, Shyouhei2019-04-291-8/+6
| | | | | | | | | `GC::Profiler.enable; GC::Profiler.clear` tries to clear objspace->profile.records but it has never been allocated before. Thus the MEMCPY took NULL argument before this changeset. The objspace->profile.records is allocated appropriately elsewhere. Why not juts free it if any? That should work.
* zero-fill before GC markUrabe, Shyouhei2019-04-261-0/+1
| | | | | | Depending on architectures, setjmp might not fully fill a jmp_buf. On such machines the union can contain wobbly bits. They are then scanned during mark_locations_array(). This is bad.
* disable assertion when MSAN is activeUrabe, Shyouhei2019-04-261-0/+2
| | | | | | | | These assertions check if a newly allocated object (which is marked as an uninitialized memory region in MSAN) is in fact a T_NONE. Thus they intentionally read uninitialized memory regions, which do not interface well with MSAN. Just disalbe them.
* Defer setting gc_stress instead of setting dont_gcNobuyoshi Nakada2019-04-241-5/+1
| | | | [Bug #15784]
* Defer setting gc_stress until inits doneNobuyoshi Nakada2019-04-241-0/+10
| | | | [Bug #15784]
* Oops, bad merge 🙇‍♂️Aaron Patterson2019-04-221-1/+0
|
* Prevent rb_define_(class|module) classes from movingAaron Patterson2019-04-221-1/+1
| | | | | | | | | | | | Before this commit, classes and modules would be registered with the VM's `defined_module_hash`. The key was the ID of the class, but that meant that it was possible for hash collisions to occur. The compactor doesn't allow classes in the `defined_module_hash` to move, but if there is a conflict, then it's possible a class would be removed from the hash and not get pined. This commit changes the key / value of the hash just to be the class itself, thus preventing movement.
* Remove redundant castkazu2019-04-211-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Make sure the has_remembered_objects flag is correctly settenderlove2019-04-201-4/+7
| | | | | | | Remembered objects can move between pages, so we need to make sure the flags on the page are set correctly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Always pin stack zombie and moved slotstenderlove2019-04-201-0/+5
| | | | | | We should always pin stack zombies and moved git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add `GC.compact` again.tenderlove2019-04-201-33/+1258
| | | | | | 🙏 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Only mark the superclass if there is onetenderlove2019-04-191-2/+6
| | | | | | | Some classes don't have a superclass, so we should check to see if it's there before marking. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e