summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2020-07-09 18:37:03 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2020-07-10 22:42:35 -0400
commitcbf52087a2d4ac3c2db698ddc5b0b023f6bb2eca (patch)
tree842ed5b35d025abc47e54f47c54d7ead80397b1b /ext
parent021cec938af55a7ef368eadc99a6e3ff2252510e (diff)
Fix missing imemo cases in objspace_dump by refactoring
imemo_callcache and imemo_callinfo were not handled by the `objspace` module and were showing up as "unknown" in the dump. Extract the code for naming imemos and use that in both the GC and the `objspace` module.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3304
Diffstat (limited to 'ext')
-rw-r--r--ext/objspace/objspace_dump.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c
index 7dd0731c43..95bd8ac8dd 100644
--- a/ext/objspace/objspace_dump.c
+++ b/ext/objspace/objspace_dump.c
@@ -195,28 +195,6 @@ dump_append_string_content(struct dump_config *dc, VALUE obj)
}
}
-static const char *
-imemo_name(int imemo)
-{
- switch(imemo) {
-#define TYPE_STR(t) case(imemo_##t): return #t
- TYPE_STR(env);
- TYPE_STR(cref);
- TYPE_STR(svar);
- TYPE_STR(throw_data);
- TYPE_STR(ifunc);
- TYPE_STR(memo);
- TYPE_STR(ment);
- TYPE_STR(iseq);
- TYPE_STR(tmpbuf);
- TYPE_STR(ast);
- TYPE_STR(parser_strterm);
- default:
- return "unknown";
-#undef TYPE_STR
- }
-}
-
static void
dump_object(VALUE obj, struct dump_config *dc)
{
@@ -251,7 +229,7 @@ dump_object(VALUE obj, struct dump_config *dc)
return;
case T_IMEMO:
- dump_append(dc, ", \"imemo_type\":\"%s\"", imemo_name(imemo_type(obj)));
+ dump_append(dc, ", \"imemo_type\":\"%s\"", rb_imemo_name(imemo_type(obj)));
break;
case T_SYMBOL: