aboutsummaryrefslogtreecommitdiffstats
path: root/gc.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-27 10:46:57 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-27 10:52:37 +0900
commitaf899503a646f20d63d4aa2f358894b98f85dab7 (patch)
treee1af8f8b914690c9446e70ad4168b99ecfb5b640 /gc.rb
parent9b55a9649fb1973180559a067cfee0d6f234fef8 (diff)
downloadruby-af899503a646f20d63d4aa2f358894b98f85dab7.tar.gz
Moved `GC.verify_compaction_references` to gc.rb
And fixed a segfault by coercion of `Qundef`, when any keyword argument without `toward:` option is given.
Diffstat (limited to 'gc.rb')
-rw-r--r--gc.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/gc.rb b/gc.rb
index a87f9185f9..b405b59822 100644
--- a/gc.rb
+++ b/gc.rb
@@ -166,6 +166,24 @@ module GC
def self.compact
__builtin_rb_gc_compact
end
+
+ # call-seq:
+ # GC.verify_compaction_references(toward: nil, double_heap: nil) -> nil
+ #
+ # 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)
+ __builtin_gc_verify_compaction_references(toward, double_heap)
+ end
end
module ObjectSpace