rb_source_location_cstr is banned in this file

Raison d'etre du gc_impl.c is to purge any internal constructs and rely
solely on our public APIs. rb_source_location_cstr is not public.
This commit is contained in:
卜部昌平 2024-07-10 03:34:54 +02:00
Родитель 1f15149e98
Коммит c49eda91bf
1 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -2337,6 +2337,24 @@ newobj_fill(VALUE obj, VALUE v1, VALUE v2, VALUE v3)
return obj;
}
#ifdef GC_DEBUG
static inline const char*
rb_gc_impl_source_location_cstr(int *ptr)
{
/* We could directly refer `rb_source_location_cstr()` before, but not any
* longer. We have to heavy lift using our debugging API. */
if (! ptr) {
return NULL;
}
else if (! (*ptr = rb_sourceline())) {
return NULL;
}
else {
return rb_sourcefile();
}
}
#endif
static inline VALUE
newobj_init(VALUE klass, VALUE flags, int wb_protected, rb_objspace_t *objspace, VALUE obj)
{
@ -2394,7 +2412,7 @@ newobj_init(VALUE klass, VALUE flags, int wb_protected, rb_objspace_t *objspace,
#endif
#if GC_DEBUG
GET_RVALUE_OVERHEAD(obj)->file = rb_source_location_cstr(&GET_RVALUE_OVERHEAD(obj)->line);
GET_RVALUE_OVERHEAD(obj)->file = rb_gc_impl_source_location_cstr(&GET_RVALUE_OVERHEAD(obj)->line);
GC_ASSERT(!SPECIAL_CONST_P(obj)); /* check alignment */
#endif