diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2020-07-09 18:37:03 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2020-07-10 22:42:35 -0400 |
commit | cbf52087a2d4ac3c2db698ddc5b0b023f6bb2eca (patch) | |
tree | 842ed5b35d025abc47e54f47c54d7ead80397b1b /ext/objspace/objspace_dump.c | |
parent | 021cec938af55a7ef368eadc99a6e3ff2252510e (diff) | |
download | ruby-cbf52087a2d4ac3c2db698ddc5b0b023f6bb2eca.tar.gz |
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.
Diffstat (limited to 'ext/objspace/objspace_dump.c')
-rw-r--r-- | ext/objspace/objspace_dump.c | 24 |
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: |