diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-31 17:46:51 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-31 17:46:51 +0000 |
commit | ef76e3cfb6710a3cb212f0a4d1319d0f3ac9926c (patch) | |
tree | 9cd1be0798fb330545c8648aadfc3b6f866031a3 /ext/objspace | |
parent | c7c1f371a4f2e96393fe5257637d8ad154511465 (diff) |
Add IMEMO type to heap dump output.
IMEMO objects have many types. Without this change, we cannot see what
types of IMEMO objects are being used when dumping the heap. Adding the
type to the IMEMO object will allow us to gather statistics about IMEMO
objects being used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/objspace')
-rw-r--r-- | ext/objspace/objspace_dump.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c index 9c2055d6d8..e235c58b08 100644 --- a/ext/objspace/objspace_dump.c +++ b/ext/objspace/objspace_dump.c @@ -192,6 +192,25 @@ 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; break; + 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) + default: + return "unknown"; +#undef TYPE_STR + } +} + static void dump_object(VALUE obj, struct dump_config *dc) { @@ -229,6 +248,10 @@ dump_object(VALUE obj, struct dump_config *dc) dump_append(dc, ", \"node_type\":\"%s\"", ruby_node_name(nd_type(obj))); break; + case T_IMEMO: + dump_append(dc, ", \"imemo_type\":\"%s\"", imemo_name(imemo_type(obj))); + break; + case T_SYMBOL: dump_append_string_content(dc, rb_sym2str(obj)); break; |