diff options
author | 卜部昌平 <[email protected]> | 2024-07-10 03:34:54 +0200 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2024-07-10 12:15:35 +0900 |
commit | c49eda91bf9139b33d01584bb1524e2ac3278101 (patch) | |
tree | d89654af6e098875739272cd3f6435cfb2b1bb89 | |
parent | 1f15149e98796800f229f1bea7770d253fab5532 (diff) |
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.
-rw-r--r-- | gc_impl.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -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 |