Move more of GC.latest_gc_info into Ruby

This commit is contained in:
Peter Zhu 2024-09-17 10:33:47 -04:00
parent 461c48960d
commit f8e1c93fe1
Notes: git 2024-09-18 16:58:23 +00:00
2 changed files with 9 additions and 14 deletions

10
gc.rb
View file

@ -320,7 +320,15 @@ module GC
# it is overwritten and returned.
# This is intended to avoid probe effect.
def self.latest_gc_info hash_or_key = nil
Primitive.gc_latest_gc_info hash_or_key
if hash_or_key == nil
hash_or_key = {}
elsif Primitive.cexpr!("RBOOL(!SYMBOL_P(hash_or_key) && !RB_TYPE_P(hash_or_key, T_HASH))")
raise TypeError, "non-hash or symbol given"
end
Primitive.cstmt! %{
return rb_gc_latest_gc_info(hash_or_key);
}
end
# call-seq: