From b0c92d6c3ffc483f00ef9ad6dd41fa500f9a4324 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 21 Aug 2024 14:28:40 -0400 Subject: [PATCH] Change hash_replace_ref_value to assume value moved When hash_foreach_replace_value returns ST_REPLACE, it's guaranteed that the value has moved in hash_replace_ref_value. --- gc/gc.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gc/gc.h b/gc/gc.h index 5427d7ebb1..94a4aab5d1 100644 --- a/gc/gc.h +++ b/gc/gc.h @@ -73,9 +73,7 @@ hash_replace_ref_value(st_data_t *key, st_data_t *value, st_data_t argp, int exi { void *objspace = (void *)argp; - if (rb_gc_impl_object_moved_p(objspace, (VALUE)*value)) { - *value = rb_gc_impl_location(objspace, (VALUE)*value); - } + *value = rb_gc_impl_location(objspace, (VALUE)*value); return ST_CONTINUE; }