summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gc.c4
-rw-r--r--gc/default/default.c19
2 files changed, 11 insertions, 12 deletions
diff --git a/gc.c b/gc.c
index c5277ee2c8..dfef384eb3 100644
--- a/gc.c
+++ b/gc.c
@@ -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);
}
diff --git a/gc/default/default.c b/gc/default/default.c
index 9f4e9fd6e5..a6f980d407 100644
--- a/gc/default/default.c
+++ b/gc/default/default.c
@@ -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;