mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
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`.
This commit is contained in:
parent
dfc8060756
commit
b96a3a6fd2
Notes:
git
2022-06-02 18:24:31 +09:00
3 changed files with 29 additions and 48 deletions
20
gc.rb
20
gc.rb
|
@ -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
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue