summaryrefslogtreecommitdiff
path: root/gc/default
AgeCommit message (Collapse)Author
2025-02-10gc.c: Remove no-op codeDaisuke Aritomo
In this context, `vm_locked` is a argument variable, and is not used later in the function. Notes: Merged: https://github.com/ruby/ruby/pull/12718
2025-01-29Use an identity hash instead of array for stress_to_classPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/12664
2025-01-29Fix GC.add_stress_to_class and GC.remove_stress_to_classPeter Zhu
These methods were accidentally removed in [Feature #20470]. This commit adds them back. Notes: Merged: https://github.com/ruby/ruby/pull/12664
2025-01-29Suppress unused-value warningsNobuyoshi Nakada
2025-01-27Fix gc_update_references_weak_table_i for ASANPeter Zhu
If the object is a T_MOVED, then it is poisoned in ASAN, so we need to unpoison it before checking the type. Notes: Merged: https://github.com/ruby/ruby/pull/12644
2025-01-27Use rb_gc_vm_weak_table_foreach for reference updatingPeter Zhu
We can use rb_gc_vm_weak_table_foreach for reference updating of weak tables in the default GC. Notes: Merged: https://github.com/ruby/ruby/pull/12629
2025-01-22Add generic ivar reference updating stepPeter Zhu
Previously, generic ivars worked differently than the other global tables during compaction. The other global tables had their references updated through iteration during rb_gc_update_vm_references. Generic ivars updated the keys when the object moved and updated the values while reference updating the object. This is inefficient as this required one lookup for every moved object and one lookup for every object with generic ivars. Instead, this commit changes it to iterate over the generic ivar table to update both the keys and values. Notes: Merged: https://github.com/ruby/ruby/pull/12607
2025-01-05gc/default/default.c: don't call `malloc_usable_size` when hint is presentJean Boussier
Depending on the allocator, `malloc_usable_size` may be very cheap or quite expensive. On `macOS` for instance, it's about as expensive as `malloc`. In many case we call `objspace_malloc_size` with as size we initially requested as `hint`. The real usable size may be a few bytes bigger, but since we only use that data to feed GC heuristics, I don't think it's very important to be perfectly accurate. It would make sense to call `malloc_usable_size` after growing a String or Array to use the extra capacity, but here we don't do that, so the call isn't worth its cost. Notes: Merged: https://github.com/ruby/ruby/pull/12490
2025-01-02Use rb_darray_insert_without_gc for heap_pages darrayPeter Zhu
rb_darray_insert could trigger a GC, which would cause problems if it freed pages while a new page was being inserted. For example, the following script fails: GC.stress = true GC.auto_compact = :empty 10.times do GC.verify_compaction_references(expand_heap: true, toward: :empty) end It errors out with: 'GC.verify_compaction_references': malloc: possible integer overflow (8*18446744073709551603) (ArgumentError) Notes: Merged: https://github.com/ruby/ruby/pull/12459
2025-01-02Revert "Remove with_gc functions in darray"Peter Zhu
This reverts commit 24a740796050b72aa2d35339ba2a317d4eda7b75. Notes: Merged: https://github.com/ruby/ruby/pull/12459
2024-12-19Prefix asan_poison_object with rbPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/12385
2024-12-19Fix compaction in ASAN with RGENGC_CHECK_MODE enabledPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/12385
2024-12-19Don't calculate the aligned slot when unlocking pagePeter Zhu
If we try to use GET_PAGE_HEADER, it can trigger the read barrier. If we try to align on the slot then we end up unlocking the heap page of a lower memory address. Notes: Merged: https://github.com/ruby/ruby/pull/12385
2024-12-19Don't unpoison a NULL objectPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/12385
2024-12-19Unpoison memory before accessing next element of freelistPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/12385
2024-12-16Move special constant check in rb_gc_location to gc.cPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/12359
2024-12-11Fix compilation with MALLOC_ALLOCATED_SIZEJohn Hawthorn
Previously compilation failed with -DMALLOC_ALLOCATED_SIZE=1 Co-authored-by: Matthew Draper <matthew@trebex.net> Notes: Merged: https://github.com/ruby/ruby/pull/12313
2024-12-11[Bug #20941] Bail out when recursing no memoryNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12307
2024-12-05Use rb_gc_enable/rb_gc_disable_no_rest instead of ruby_disable_gcPeter Zhu
We should use the rb_gc_enable/rb_gc_disable_no_rest APIs instead of directly setting the ruby_disable_gc variable. Notes: Merged: https://github.com/ruby/ruby/pull/12264
2024-12-05darray.h does not depend on internal/bits.hPeter Zhu
darray.h no longer depends on internal/bits.h, so we can remove it. Notes: Merged: https://github.com/ruby/ruby/pull/12270
2024-12-05Standardize on the name "modular GC"Peter Zhu
We have name fragmentation for this feature, including "shared GC", "modular GC", and "external GC". This commit standardizes the feature name to "modular GC" and the implementation to "GC library". Notes: Merged: https://github.com/ruby/ruby/pull/12261
2024-11-29rb_gc_impl_malloc can return NULL卜部昌平
Let there be rooms for each GC implementations how to handle multi threaded situations. They can be totally reentrant, or can have their own mutex, or can rely on rb_thread_call_with_gvl. In any ways the allocator (has been, but now officially is) expected to run properly without a GVL. This means there need be a way for them to inform the interpreter about their allocation failures, without relying on raising exceptions. Let them do so by returning NULL. Notes: Merged: https://github.com/ruby/ruby/pull/12188
2024-11-25Use extconf to build external GC modulesMatt Valentine-House
Co-Authored-By: Peter Zhu <peter@peterzhu.ca> Notes: Merged: https://github.com/ruby/ruby/pull/12149