diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-06-02 15:32:00 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-06-02 15:32:00 +0900 |
commit | b96a3a6fd2093e1dbea5491c002da515652dd347 (patch) | |
tree | fe074ae6bb178221f297fbb97c67888cc54e4bcf /gc.rb | |
parent | dfc8060756b25a33e078883ef095af6600c0a54b (diff) |
Move `GC.verify_compaction_references` [Bug #18779]
Define `GC.verify_compaction_references` as a built-in ruby method,
according to GC compaction support via `GC::OPTS`.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5972
Diffstat (limited to 'gc.rb')
-rw-r--r-- | gc.rb | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -232,6 +232,26 @@ module GC Primitive.gc_latest_gc_info hash_or_key end + if respond_to?(:compact) + # call-seq: + # GC.verify_compaction_references(toward: nil, double_heap: false) -> hash + # + # Verify compaction reference consistency. + # + # This method is implementation specific. During compaction, objects that + # were moved are replaced with T_MOVED objects. No object should have a + # reference to a T_MOVED object after compaction. + # + # This function doubles the heap to ensure room to move all objects, + # compacts the heap to make sure everything moves, updates all references, + # then performs a full GC. If any object contains a reference to a T_MOVED + # object, that object should be pushed on the mark stack, and will + # make a SEGV. + def self.verify_compaction_references(toward: nil, double_heap: false) + Primitive.gc_verify_compaction_references(double_heap, toward == :empty) + end + end + # call-seq: # GC.using_rvargc? -> true or false # |