summaryrefslogtreecommitdiff
path: root/test/ruby/test_gc_compact.rb
AgeCommit message (Collapse)Author
2022-05-24Define unsupported GC compaction methods as rb_f_notimplementMike Dalessio
Fixes [Bug #18779] Define the following methods as `rb_f_notimplement` on unsupported platforms: - GC.compact - GC.auto_compact - GC.auto_compact= - GC.latest_compact_info - GC.verify_compaction_references This change allows users to call `GC.respond_to?(:compact)` to properly test for compaction support. Previously, it was necessary to invoke `GC.compact` or `GC.verify_compaction_references` and check if those methods raised `NotImplementedError` to determine if compaction was supported. This follows the precedent set for other platform-specific methods. For example, in `process.c` for methods such as `Process.fork`, `Process.setpgid`, and `Process.getpriority`. Notes: Merged: https://github.com/ruby/ruby/pull/5934
2022-01-24[wasm] Disallow compactionPeter Zhu
WebAssembly doesn't support signals so we can't use read barriers so we can't use compaction. Notes: Merged: https://github.com/ruby/ruby/pull/5475
2022-01-04Use omit instead of skip: test/ruby/**/*.rbHiroshi SHIBATA
2021-12-17Send the message for s390x to stderr [ci skip]Nobuyoshi Nakada
Parallel worker's stdout is captured as the control protocol. Notes: Merged: https://github.com/ruby/ruby/pull/5286
2021-11-04test/ruby/test_gc_compact.rb: Backpatch the URL to the PRYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/5077
2021-11-04test/ruby/test_gc_compact.rb: Do not run on s390xYusuke Endoh
The compaction tests get stuck randomly on s390x for unknown reason. http://rubyci.s3.amazonaws.com/s390x/ruby-master/log/20211104T030003Z.fail.html.gz ``` [13715/21145] TestGCCompact#test_gc_compact_statstimeout: output interval exceeds 1800.0 seconds. ``` We spent some time to investigate this issue, but we can't figure out why, and it is unlikely that we'll be able to fix it anytime soon. This random failure makes the CI unuseful, so tentatively we suppress this test for a while. A contribution from those who are familiar with s390x is welcome. Notes: Merged: https://github.com/ruby/ruby/pull/5077
2021-08-02Stop infinite object allocation to get rid of OOM killerNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4697
2021-05-25Disable compaction on platforms that can't support itAaron Patterson
Manual compaction also requires a read barrier, so we need to disable even manual compaction on platforms that don't support mprotect. [Bug #17871] Notes: Merged: https://github.com/ruby/ruby/pull/4528
2021-04-09test/ruby/test_gc_compact.rb: Use assert_separately for debuggingYusuke Endoh
... the following timeout failure. http://rubyci.s3.amazonaws.com/rhel_zlinux/ruby-master/log/20210408T213303Z.fail.html.gz ``` [ 8871/21204] TestGCCompact#test_ast_compactstimeout: output interval exceeds 600.0 seconds. timeout: the process group 28416 is alive. PSOUT PGID PID ELAPSED %CPU VSZ COMMAND COMMAND PSOUT 28416 28416 12:46 0.0 108120 gmake gmake TESTS=--hide-skip -v RUBYOPT=-w test-all PSOUT 28416 28423 12:46 88.2 1446124 ruby ./test/runner.rb: TestGCCompact#test_ast_compacts timeout: INT signal sent. timeout: INT signal sent. timeout: TERM signal sent. timeout: TERM signal sent. timeout: KILL signal sent. ``` This error repeatedly occurs on RHEL s390x. This change sends SEGV when timeout occurs so that it should dump the backtrace.
2021-02-25Revert "Add tests for bug 17652"Aaron Patterson
This reverts commit a9920e7782f225b97e173a88640fe9e116b9964f.
2021-02-25Add tests for bug 17652Peter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/4227
2021-02-24Reverting PR #4221Aaron Patterson
It seems this breaks tests on Solaris, so I'm reverting it until we figure out the right fix. http://rubyci.s3.amazonaws.com/solaris11-sunc/ruby-master/log/20210224T210007Z.fail.html.gz
2021-02-24Add tests for bug 17652Peter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/4221
2020-11-25Disable auto compaction on platforms that can't support itAaron Patterson
Both explicit compaction routines (gc_compact and the verify references form) need to clear the heap before executing compaction. Otherwise some objects may not be alive, and we'll need the read barrier. The heap must only contain *live* objects if we want to disable the read barrier during explicit compaction. The previous commit was missing the "clear the heap" phase from the "verify references" explicit compaction function. Fixes [Bug #17306]
2020-11-24Revert "Disable auto compaction on platforms that can't support it"Aaron Patterson
This reverts commit 63ad55cd882e4010fe313d271af006a430b5ffa8. Revert "Disable read barrier on explicit compaction request" This reverts commit 490b57783d80f0c5f7882c66d9fb6aa02713c9a5.
2020-11-24Disable auto compaction on platforms that can't support itAaron Patterson
Auto Compaction uses mprotect to implement a read barrier. mprotect can only work on regions of memory that are a multiple of the OS page size. Ruby's pages are a multiple of 4kb, but some platforms (like ppc64le) don't have 4kb page sizes. This commit disables the features on those platforms. Fixes [Bug #17306]
2020-11-03test/ruby/test_gc_compact.rb: suppress "assigned but unused variable"Yusuke Endoh
2020-11-02Add `GC.auto_compact= true/false` and `GC.auto_compact`Aaron Patterson
* `GC.auto_compact=`, `GC.auto_compact` can be used to control when compaction runs. Setting `auto_compact=` to true will cause compaction to occurr duing major collections. At the moment, compaction adds significant overhead to major collections, so please test first! [Feature #17176]
2020-01-27Moved `GC.verify_compaction_references` to gc.rbNobuyoshi Nakada
And fixed a segfault by coercion of `Qundef`, when any keyword argument without `toward:` option is given.
2019-11-07Add a counter for compactionAaron Patterson
Keep track of the number of times the compactor ran. I would like to use this as a way to keep track of inline cache reference updates.
2019-11-07Use a monotonically increasing number for object_idJohn Hawthorn
This changes object_id from being based on the objects location in memory (or a nearby memory location in the case of a conflict) to be based on an always increasing number. This number is a Ruby Integer which allows it to overflow the size of a pointer without issue (very unlikely to happen in real programs especially on 64-bit, but a nice guarantee). This changes obj_to_id_tbl and id_to_obj_tbl to both be maps of Ruby objects to Ruby objects (previously they were Ruby object to C integer) which simplifies updating them after compaction as we can run them through gc_update_table_refs. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2019-11-06Revert "Use a monotonically increasing number for object_id"Aaron Patterson
This reverts commit bd2b314a05ae9192b3143e1e678a37c370d8a9ce.
2019-11-06Use a monotonically increasing number for object_idJohn Hawthorn
This changes object_id from being based on the objects location in memory (or a nearby memory location in the case of a conflict) to be based on an always increasing number. This number is a Ruby Integer which allows it to overflow the size of a pointer without issue (very unlikely to happen in real programs especially on 64-bit, but a nice guarantee). This changes obj_to_id_tbl and id_to_obj_tbl to both be maps of Ruby objects to Ruby objects (previously they were Ruby object to C integer) which simplifies updating them after compaction as we can run them through gc_update_table_refs. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/2638
2019-09-26Add compaction support to `rb_ast_t`Aaron Patterson
This commit adds compaction support to `rb_ast_t`.
2019-06-30Skip instead of returnNobuyoshi Nakada
2019-06-30Suppress unused variable warningsNobuyoshi Nakada
2019-05-23Test GC.compact with MJIT againTakashi Kokubun
2019-05-23Do not kick finalizers on rb_gc().Koichi Sasada
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.
2019-05-21re-skip tests of GC.compact.Koichi Sasada
2019-05-21enable test for GC.compact to reproduce an issue on CIKoichi Sasada
2019-05-17skip tests for GC.compact to pass CI.Koichi Sasada
Now, GC.compact has issues which makes rubyci RED, so I skip this test and debug soon.
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-04-23Fix complex hash keys to work with compactionAaron Patterson
For example when an array containing objects is a hash key, the contents of the array may move which can cause the hash value for the array to change. This commit makes the default `hash` value based off the object id, so the hash value will remain stable. Fixes test/shell/test_command_processor.rb
2019-04-20skip test until we can guarantee movement of certain objectstenderlove
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20skip test if mjit is enabledtenderlove
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20Workaround Wercker check which is not working nowk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20Skip test_find_collided_object on problematic CIs for nowk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20add more assertions around moved objecttenderlove
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20check the index rather than includetenderlove
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20Try harder to make objects movetenderlove
Sometimes the objects we allocated may not get compacted. This change is to increase the likelyhood that they will move git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67623 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-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-17call verification method in addition to compactiontenderlove
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67579 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-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-09Don't fail the build if we can't get objects to movetenderlove
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-09Try to make compaction more likelytenderlove
This commit tries to make compaction more likely by allocating some objects and then throwing them away git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67482 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