summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2019-05-16Prefix global_symbols with `ruby_`Nobuyoshi Nakada
2019-05-16Make internal functions staticNobuyoshi Nakada
2019-05-15Rename mjit_gc_finish_hook to mjit_gc_exit_hookTakashi Kokubun
because @ko1 said "gc_finish" is confusing like a finish of entire GC process
2019-05-15Suppress unused-but-set-variable warningNobuyoshi Nakada
2019-05-15unpin finalizers and update referencesAaron Patterson
2019-05-15* expand tabs.git
2019-05-14Add object packing strategies for compactionAaron Patterson
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.
2019-05-14Fixing function nameAaron Patterson
This function is used for marking / pinning vm stack values, so it should have "vm" in the function name to be more clear.
2019-05-13turn T_MOVED in to a linked listAaron Patterson
2019-05-13Don't run the compactor if GC is disabledAaron Patterson
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.
2019-05-13Fix typosKazuhiro NISHIYAMA
2019-05-08Pin finalizer tableAaron Patterson
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).
2019-05-09* expand tabs.git
2019-05-08Calling `obj_info` during sweep is unsafeAaron Patterson
`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.
2019-05-07Reduce ONIG_NREGION from 10 to 4: power of 2 and testing revealed most ↵Lourens Naudé
pattern matches are less than or equal to 4 results Closes: https://github.com/ruby/ruby/pull/2135
2019-05-07add new debug_counters about is_pointer_to_heap().Koichi Sasada
is_pointer_to_heap() is used for conservative marking. To analyze this function's behavior, introduce some debug_counters.
2019-04-29avoid passing NULL to memsetUrabe, Shyouhei
`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.
2019-04-26zero-fill before GC markUrabe, Shyouhei
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.
2019-04-26disable assertion when MSAN is activeUrabe, Shyouhei
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.
2019-04-24Defer setting gc_stress instead of setting dont_gcNobuyoshi Nakada
[Bug #15784]
2019-04-24Defer setting gc_stress until inits doneNobuyoshi Nakada
[Bug #15784]
2019-04-22Oops, bad merge 🙇‍♂️Aaron Patterson
2019-04-22Prevent rb_define_(class|module) classes from movingAaron Patterson
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.
2019-04-21Remove redundant castkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20Make sure the has_remembered_objects flag is correctly settenderlove
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
2019-04-20Always pin stack zombie and moved slotstenderlove
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
2019-04-20Add `GC.compact` again.tenderlove
🙏 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-19Only mark the superclass if there is onetenderlove
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
2019-04-17* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17Reverting compaction for nowtenderlove
For some reason symbols (or classes) are being overridden in trunk git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17Super should be marked regardless of whether or not ext existstenderlove
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17update super even if there is no exttenderlove
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17make verification more stricttenderlove
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17Adding `GC.compact` and compacting GC support.tenderlove
This commit adds the new method `GC.compact` and compacting GC support. Please see this issue for caveats: https://bugs.ruby-lang.org/issues/15626 [Feature #15626] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10Adjusted stylesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10Reverting all commits from r67479 to r67496 because of CI failureskazu
Because hard to specify commits related to r67479 only. So please commit again. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10Adjusted stylesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-09Pin weakmap referencestenderlove
Weak map references can't move because the st_table needs their address as a key. But, we also need to remove T_NONE from the map so they aren't reused. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-09Adding `GC.compact` and compacting GC support.tenderlove
This commit adds the new method `GC.compact` and compacting GC support. Please see this issue for caveats: https://bugs.ruby-lang.org/issues/15626 [Feature #15626] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-07gc.c: missing breaknobu
* gc.c (obj_memsize_of): T_RATIONAL and T_COMPLEX cannot be an imemo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-02Fix more ASAN errorstenderlove
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-02Extract type to sym as a new functiontenderlove
I will use this from another function in compaction git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-02Fix ASAN errortenderlove
This code was trying to access memory before unpoisoning it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-02Poison / verify the freelisttenderlove
This commit just adds poisoning around the freelist to help debugging. Also verify that the freelist only contains T_NONE objects when checking the heap integrity git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-01Fix ASAN errors when walking the heaptenderlove
verify_internal_consistency_i and gc_verify_heap_page would walk the heap, reading data from each slot, but would not unpoison the object before reading. This commit unpoisons the slot before reading so that we won't get ASAN errors git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-22[DOC] fix markups [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-09Early return in gc_mark_childrennobu
for types Float, Bignum and Symbol as they do not have references and singleton classes. [Fix GH-2091] From: Lourens Naudé <lourens@bearmetal.eu> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e