path: root/hash.c
diff options
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-05 07:16:42 (GMT)
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-05 07:16:42 (GMT)
commit0a6816ecd79fac5dfb32eb237f4c31bb45c9460d (patch)
tree63c3def6ba4957dace4d3fba56f1da964b9750de /hash.c
parentaa87ae7a04b9c4845ef4326b63150027ed1036a9 (diff)
Revamp method coverage to support define_method
Traditionally, method coverage measurement was implemented by inserting `trace2` instruction to the head of method iseq. So, it just measured methods defined by `def` keyword. This commit drastically changes the measuring mechanism of method coverage; at `RUBY_EVENT_CALL`, it keeps a hash from rb_method_entry_t* to runs (i.e., it counts the runs per method entry), and at `Coverage.result`, it creates the result hash by enumerating all `rb_method_entry_t*` objects (by `ObjectSpace.each_object`). git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
1 files changed, 8 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index c8d1406..cd1cc14 100644
--- a/hash.c
+++ b/hash.c
@@ -427,6 +427,14 @@ rb_hash_new(void)
+ VALUE hash = rb_hash_new();
+ RHASH(hash)->ntbl = rb_init_identtable();
+ return hash;
rb_hash_new_with_size(st_index_t size)
VALUE ret = rb_hash_new();