Move special constant check in rb_gc_location to gc.c

This commit is contained in:
Peter Zhu 2024-12-16 11:02:12 -05:00
parent d0968b1b4c
commit d28368d27f
Notes: git 2024-12-16 18:32:54 +00:00
2 changed files with 11 additions and 12 deletions

4
gc.c
View File

@ -3150,6 +3150,10 @@ check_id_table_move(VALUE value, void *data)
VALUE
rb_gc_location(VALUE value)
{
if (SPECIAL_CONST_P(value)) {
return value;
}
return rb_gc_impl_location(rb_gc_get_objspace(), value);
}

View File

@ -4012,19 +4012,14 @@ rb_gc_impl_location(void *objspace_ptr, VALUE value)
{
VALUE destination;
if (!SPECIAL_CONST_P(value)) {
asan_unpoisoning_object(value) {
if (BUILTIN_TYPE(value) == T_MOVED) {
destination = (VALUE)RMOVED(value)->destination;
GC_ASSERT(BUILTIN_TYPE(destination) != T_NONE);
}
else {
destination = value;
}
asan_unpoisoning_object(value) {
if (BUILTIN_TYPE(value) == T_MOVED) {
destination = (VALUE)RMOVED(value)->destination;
GC_ASSERT(BUILTIN_TYPE(destination) != T_NONE);
}
else {
destination = value;
}
}
else {
destination = value;
}
return destination;