From 0a6816ecd79fac5dfb32eb237f4c31bb45c9460d Mon Sep 17 00:00:00 2001 From: mame Date: Tue, 5 Dec 2017 07:16:42 +0000 Subject: 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://ci.ruby-lang.org/ruby/trunk@61023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- hash.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'hash.c') diff --git a/hash.c b/hash.c index c8d1406cc7..cd1cc1437f 100644 --- a/hash.c +++ b/hash.c @@ -426,6 +426,14 @@ rb_hash_new(void) return hash_alloc(rb_cHash); } +VALUE +rb_hash_new_compare_by_id(void) +{ + VALUE hash = rb_hash_new(); + RHASH(hash)->ntbl = rb_init_identtable(); + return hash; +} + VALUE rb_hash_new_with_size(st_index_t size) { -- cgit v1.2.3