diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-01-27 10:46:57 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-01-27 10:52:37 +0900 |
commit | af899503a646f20d63d4aa2f358894b98f85dab7 (patch) | |
tree | e1af8f8b914690c9446e70ad4168b99ecfb5b640 /gc.rb | |
parent | 9b55a9649fb1973180559a067cfee0d6f234fef8 (diff) |
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.rb | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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 |