ruby-changes:70388
From: Alan <ko1@a...>
Date: Tue, 21 Dec 2021 06:14:05 +0900 (JST)
Subject: [ruby-changes:70388] 39cf0b5314 (master): Show whether object is garbage in rb_raw_obj_info()
https://git.ruby-lang.org/ruby.git/commit/?id=39cf0b5314 From 39cf0b5314c206fee5a331dcccd2d80bda11c417 Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Mon, 20 Dec 2021 16:13:34 -0500 Subject: Show whether object is garbage in rb_raw_obj_info() When using `rp(obj)` for debugging during development, it may be useful to know that an object is soon to be swept. Add a new letter to the object dump for whether the object is garbage. It's easy to forget about lazy sweep. --- gc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gc.c b/gc.c index 936874dabad..5a723762ad9 100644 --- a/gc.c +++ b/gc.c @@ -13093,13 +13093,14 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L13093 const int age = RVALUE_FLAGS_AGE(RBASIC(obj)->flags); if (is_pointer_to_heap(&rb_objspace, (void *)obj)) { - APPENDF((BUFF_ARGS, "%p [%d%s%s%s%s%s] %s ", + APPENDF((BUFF_ARGS, "%p [%d%s%s%s%s%s%s] %s ", (void *)obj, age, C(RVALUE_UNCOLLECTIBLE_BITMAP(obj), "L"), C(RVALUE_MARK_BITMAP(obj), "M"), C(RVALUE_PIN_BITMAP(obj), "P"), C(RVALUE_MARKING_BITMAP(obj), "R"), C(RVALUE_WB_UNPROTECTED_BITMAP(obj), "U"), + C(rb_objspace_garbage_object_p(obj), "G"), obj_type_name(obj))); } else { -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/