From dcc976add9cb92d0dae75f85428a7751e7b40bef Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 28 Feb 2024 10:59:50 -0500 Subject: [PATCH] Remove unused rb_gc_id2ref_obj_tbl --- gc.c | 21 +++------------------ internal/gc.h | 1 - 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/gc.c b/gc.c index d488286ff9301a..92d78f036ea01e 100644 --- a/gc.c +++ b/gc.c @@ -4424,20 +4424,6 @@ rb_gc_is_ptr_to_obj(const void *ptr) return is_pointer_to_heap(objspace, ptr); } -VALUE -rb_gc_id2ref_obj_tbl(VALUE objid) -{ - rb_objspace_t *objspace = &rb_objspace; - - VALUE orig; - if (st_lookup(objspace->id_to_obj_tbl, objid, &orig)) { - return orig; - } - else { - return Qundef; - } -} - /* * call-seq: * ObjectSpace._id2ref(object_id) -> an_object @@ -4463,7 +4449,6 @@ id2ref(VALUE objid) #endif rb_objspace_t *objspace = &rb_objspace; VALUE ptr; - VALUE orig; void *p0; objid = rb_to_int(objid); @@ -4485,9 +4470,9 @@ id2ref(VALUE objid) } } - if (!UNDEF_P(orig = rb_gc_id2ref_obj_tbl(objid)) && - is_live_object(objspace, orig)) { - + VALUE orig; + if (st_lookup(objspace->id_to_obj_tbl, objid, &orig) && + is_live_object(objspace, orig)) { if (!rb_multi_ractor_p() || rb_ractor_shareable_p(orig)) { return orig; } diff --git a/internal/gc.h b/internal/gc.h index 325a95f4b4d780..b11f1775fba872 100644 --- a/internal/gc.h +++ b/internal/gc.h @@ -242,7 +242,6 @@ size_t rb_gc_obj_slot_size(VALUE obj); bool rb_gc_size_allocatable_p(size_t size); int rb_objspace_garbage_object_p(VALUE obj); bool rb_gc_is_ptr_to_obj(const void *ptr); -VALUE rb_gc_id2ref_obj_tbl(VALUE objid); VALUE rb_define_finalizer_no_check(VALUE obj, VALUE block); void rb_gc_mark_and_move(VALUE *ptr);